}
// Test internal linking of PIE binaries where it is supported.
- if goos == "linux" && (goarch == "amd64" || goarch == "arm64") {
+ if t.internalLinkPIE() {
t.tests = append(t.tests, distTest{
name: "pie_internal",
heading: "internal linking of -buildmode=pie",
return true
}
+func (t *tester) internalLinkPIE() bool {
+ return goos == "linux" && (goarch == "amd64" || goarch == "arm64")
+}
+
func (t *tester) supportedBuildmode(mode string) bool {
pair := goos + "-" + goarch
switch mode {
if t.supportedBuildmode("pie") {
t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie")
+ if t.internalLinkPIE() {
+ t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal")
+ }
t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-buildmode=pie")
t.addCmd(dt, "misc/cgo/nocgo", t.goTest(), "-buildmode=pie")
}