14 Sep 2025 |
emily | right. or at least intent to tell ourselves we could upstream it 😅 | 15:05:57 |
aloisw | Ah I just assumed it because you started talking about GOFLAGS right after I mentioned rhe PR. | 15:06:17 |
aloisw | But yes maybe I should close it, it was an experiment and I think you have better ideas. | 15:07:43 |
emily | a.diff looks good to me. there's a little evil Rob Pike inside me wondering if this might be more Tao of Go
if interpreter == "" {
interpreter = os.Getenv("GO_LDSO")
}
if interpreter == "" && buildcfg.GOOS == runtime.GOOS && buildcfg.GOARCH == runtime.GOARCH {
interpreter = buildcfg.DefaultGO_LDSO
}
| 15:08:10 |
emily | (because it's worse) | 15:08:15 |
emily | I appreciate the vote of confidence given my roughly zero knowledge of the Go toolchain 🫠| 15:08:49 |
emily | but yeah this plus
if [[ -e $NIX_CC/nix-support/dynamic-linker ]]; then
export GO_LDSO=$(< "$NIX_CC/nix-support/dynamic-linker")
fi
seems good
| 15:10:07 |
emily | ideally we wouldn't duplicate that across two versions of Go and the builder function but idk if it's avoidable | 15:10:25 |
aloisw | In reply to @emilazy:matrix.org I appreciate the vote of confidence given my roughly zero knowledge of the Go toolchain 🫠That's not less knowledge than me there. | 15:11:29 |
emily | and then
func DefaultPIE(goos, goarch string, isRace bool) bool {
switch goos {
case "windows":
if isRace {
// PIE is not supported with -race on windows;
// see https://go.dev/cl/416174.
return false
}
}
return true
}
| 15:12:03 |
emily | or even just return false → return true if you want the smallest possible diff… | 15:12:15 |
Lun | Yeah have it working just setting up a passthru.test for buildmode=internal | 15:12:15 |
Lun | * Yeah have it working for syncthing, just setting up a passthru.test for buildmode=internal | 15:12:23 |
emily | this ended up a lot more elegant than I was expecting | 15:12:52 |
aloisw | One possible problem with the GO_LDSO approach could be packages trying to do cross compilation with GOARCH on GOOS , but from a cursory glance most usages of that seems to be either redundantly for native, or wasm. | 15:12:56 |
emily | if upstream don't like GO_LDSO then it'll be annoying and we might have to argue with them about how to get -I passed down etc. | 15:13:04 |
emily | but they already do GO_EXTLINK_ENABLED | 15:13:09 |
emily | and read that directly in the linker | 15:13:13 |
emily | so my hope is that it's an easy enough sell | 15:13:18 |
emily | oh hmm yeah I guess maybe that's why the conditional is there | 15:13:46 |
emily | the cross one I mean | 15:13:50 |
emily | in which case maybe Getgoldso() is the right approach | 15:13:59 |
emily | it's just | 15:14:04 |
emily | all that logic seems kinda busted anyway | 15:14:10 |
emily | like GO_EXTLINK_ENABLED should also be platform-specific etc. | 15:14:17 |
emily | and our Go package is not targetPlatform -agnostic, which is quite evil but anyway | 15:14:29 |
emily | my thinking was like | 15:14:51 |
emily | you can do GO_LDSO=… GOARCH=… to at least make cross work | 15:15:01 |
emily | so it's nominally better to have the override | 15:15:07 |
emily | I suppose we'll have to see what upstream thinks | 15:15:22 |