go: only enable PIE by default when building for GOARCH matching target
We rely on teaching go to use the correct ELF interpreter for PIE in a way that can't work for packages that go off and do their own GOARCH=something cross builds without touching nixpkgs cross machinery, so update the default pie patch to bake targetPlatform's GOARCH and only activate for it. tailscale works as a testcase for this as it cross compiles many arches in tstest/archtest/qemu_test.go
This commit is contained in:
@@ -65,7 +65,9 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
./remove-tools-1.11.patch
|
./remove-tools-1.11.patch
|
||||||
./go_no_vendor_checks-1.23.patch
|
./go_no_vendor_checks-1.23.patch
|
||||||
./go-env-go_ldso.patch
|
./go-env-go_ldso.patch
|
||||||
./go-default-pie.patch
|
(replaceVars ./go-default-pie.patch {
|
||||||
|
inherit (stdenv.targetPlatform.go) GOARCH;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
inherit (stdenv.targetPlatform.go) GOOS GOARCH GOARM;
|
inherit (stdenv.targetPlatform.go) GOOS GOARCH GOARM;
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
./remove-tools-1.11.patch
|
./remove-tools-1.11.patch
|
||||||
./go_no_vendor_checks-1.23.patch
|
./go_no_vendor_checks-1.23.patch
|
||||||
./go-env-go_ldso.patch
|
./go-env-go_ldso.patch
|
||||||
./go-default-pie.patch
|
(replaceVars ./go-default-pie.patch {
|
||||||
|
inherit (stdenv.targetPlatform.go) GOARCH;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
inherit (stdenv.targetPlatform.go) GOOS GOARCH GOARM;
|
inherit (stdenv.targetPlatform.go) GOOS GOARCH GOARM;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ index f9706a6988..abac42d550 100644
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
- return false
|
- return false
|
||||||
+ return BuildModeSupported("gc", "pie", goos, goarch)
|
+ return goarch == "@GOARCH@" && BuildModeSupported("gc", "pie", goos, goarch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecutableHasDWARF reports whether the linked executable includes DWARF
|
// ExecutableHasDWARF reports whether the linked executable includes DWARF
|
||||||
|
|||||||
Reference in New Issue
Block a user