!UNVBThoJtlIiVwiDjU:nixos.org

Staging

286 Members
Staging merges | Running staging cycles: https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+head%3Astaging-next+head%3Astaging-next-25.05 | Review Reports: https://malob.github.io/nix-review-tools-reports/99 Servers

Load older messages


SenderMessageTime
13 Sep 2025
@emilazy:matrix.orgemily (we probably also want to involve BuildModeSupported from just above to avoid defaulting to PIE on weird cross platforms I guess) 19:30:17
@emilazy:matrix.orgemilywe would definitely need to test though19:30:54
@emilazy:matrix.orgemilybut I am reassured by the fact that it already has platforms that can do PIE but don't always do PIE19:31:02
@emilazy:matrix.orgemily for instance, Android is not in the list in ld/config.go 19:31:20
@emilazy:matrix.orgemily it's just that aarch64-darwin doesn't support non-PIE at all 19:31:32
@emilazy:matrix.orgemily https://github.com/search?q=repo%3Agolang%2Fgo%20DefaultPIE&type=code you can see the call sites of DefaultPIE here 19:32:46
@emilazy:matrix.orgemilymost relevantly https://github.com/golang/go/blob/ac803b5949f6dbc5bfa559afe506d35f9e1b3195/src/cmd/go/internal/work/init.go#L260-L267 which does tweak linking settings19:33:14
@emilazy:matrix.orgemily so I believe this is exactly the knob we want 19:33:58
@emilazy:matrix.orgemily because it's handled in the higher-level go 19:34:47
@emilazy:matrix.orgemilybut I offer zero warranty for any of this, it definitely requires testing 😅19:35:01
@lt1379:matrix.orgLun
diff --git a/src/internal/platform/supported.go b/src/internal/platform/supported.go
index f9706a6988..af301c7324 100644
--- a/src/internal/platform/supported.go
+++ b/src/internal/platform/supported.go
@@ -225,7 +225,6 @@ func InternalLinkPIESupported(goos, goarch string) bool {
 	switch goos + "/" + goarch {
 	case "android/arm64",
 		"darwin/amd64", "darwin/arm64",
-		"linux/amd64", "linux/arm64", "linux/loong64", "linux/ppc64le",
 		"windows/386", "windows/amd64", "windows/arm", "windows/arm64":
 		return true
 	}
@@ -239,6 +238,8 @@ func DefaultPIE(goos, goarch string, isRace bool) bool {
 	switch goos {
 	case "android", "ios":
 		return true
+	case "linux":
+		return goarch != "ppc64"
 	case "windows":
 		if isRace {
 			// PIE is not supported with -race on windows;

Swapping the patch to this gets me default PIE binary requires external (cgo) linking, but cgo is not enabled in the go 1.25 build despite GO_EXTLINK_ENABLED=1 being set.

19:39:11
@emilazy:matrix.orgemilyinteresting19:39:51
@emilazy:matrix.orgemilyis there anything around it in the log?19:39:56
@lt1379:matrix.orgLunhttps://gist.github.com/LunNova/3c5e30929e8f914f7866d736966f00bc19:40:22
@emilazy:matrix.orgemilya bootstrap problem I suppose…19:40:48
@emilazy:matrix.orgemilyhttps://github.com/golang/go/blob/ac803b5949f6dbc5bfa559afe506d35f9e1b3195/src/cmd/go/internal/load/pkg.go#L2643 19:41:32
@emilazy:matrix.orgemily there are, uh, no mentions of toolchain2 in the current Git? 19:42:38
@emilazy:matrix.orgemily my guess is it can't find runtime/cgo in our bootstrap toolchain 19:43:08
@emilazy:matrix.orgemilyI wonder if perhaps the bootstrap toolchains need updating19:43:29
@emilazy:matrix.orgemily or maybe it can't handle the share/go in our bootstrap packages 19:44:23
@emilazy:matrix.orgemilyvery much on the verge of being nerd-sniped here but trying to resist19:45:21
@lt1379:matrix.orgLunyour prior idea that you think is wrong now seemed to somewhat work and make pie binaries eg syncthing19:47:18
@emilazy:matrix.orgemily

I think yeah because

  1. it wouldn't affect the bootstrap, only the built compiler, it seems like it bootstraps with the new go command but the bootstrap toolchain (?)
  2. it forces the issue (there is no opt out) and just makes -linkmode=internal silently produce FHS stuff
19:49:57
@emilazy:matrix.orgemilye.g. I wonder if the Go toolchain itself was a PIE for the old idea19:50:08
@emilazy:matrix.orgemilyI am quite confident the old idea is wrong now though19:50:13
@emilazy:matrix.orgemily Lun: I think you may need to adjust src/cmd/dist/build.go too 19:52:44
@emilazy:matrix.orgemily
// mustLinkExternal is a copy of internal/platform.MustLinkExternal,
// duplicated here to avoid version skew in the MustLinkExternal function
// during bootstrapping.
19:52:51
@emilazy:matrix.orgemilykind of a mess19:53:00
@emilazy:matrix.orgemilyin particular19:53:04
@emilazy:matrix.orgemily
	if !mustLinkExternal(goos, goarch, false) {
		// Unless the platform requires external linking,
		// we disable cgo to get static binaries for cmd/go and cmd/pprof,
		// so that they work on systems without the same dynamic libraries
		// as the original build system.
		env = append(env, "CGO_ENABLED=0")
	}
19:53:05

Show newer messages


Back to Room ListRoom Version: 6