14 Sep 2025 |
emily | wait no | 14:24:56 |
emily | https://github.com/golang/go/blob/ac803b5949f6dbc5bfa559afe506d35f9e1b3195/src/cmd/link/internal/ld/config.go#L192 | 14:24:58 |
emily | we're good | 14:24:59 |
emily | Lun: ok here's my proposal: drop GO_LDSO from src/internal/buildcfg/cfg.go , add func Getgoldso() string that returns envOr("GO_LDSO", defaultGO_LDSO) . adjust src/cmd/link/internal/ld/elf.go appropriately | 14:27:07 |
emily | although I am not sure if the buildcfg.GOOS == runtime.GOOS && buildcfg.GOARCH == runtime.GOARCH makes sense there if the environment variable is set | 14:27:29 |
emily | let me check if any other thing uses that | 14:27:38 |
emily | ok, nothing else uses that | 14:27:42 |
emily | revised proposal: drop GO_LDSO , but don't introduce the function, instead change the conditional to like | 14:27:55 |
emily | (I wish I knew where interperter was defined) | 14:28:26 |
Lun | var block in src/cmd/link/internal/ld/lib.go? | 14:28:49 |
emily | how did you do that… | 14:29:01 |
emily | okay, so it has an -I argument for specifying the interpreter anyway. so I have to… find where Go is calling into this | 14:30:19 |
emily | I don't suppose your magic Go code tracing powers are strong enough for that | 14:30:54 |
emily | oh I found it I think | 14:31:25 |
emily | if err := BuildToolchain.ld(b, a, a.Target, importcfg, a.Deps[0].built); err != nil {
| 14:36:43 |
emily | what do you mean b, a | 14:36:46 |
emily | ok screw it | 14:38:12 |
emily | Lun: my idea is drop GO_LDSO from src/internal/buildcfg/cfg.go , export defaultGO_LDSO in… wherever it's defined, and then in src/internal/buildcfg/cfg.go , do if interpreter == "" { if getenv GO_LDSO { use it } else if buildcfg.GOOS == runtime.GOOS && buildcfg.GOARCH == runtime.GOARCH && DefaultGO_LDSO != "" { use it } } | 14:39:48 |
emily | and then export GO_LDSO=$(cat $NIX_CC/nix-support/dynamic-linker) iff that exists (it won't on e.g. Darwin) in both the Go build itself and in whatever Bash we run for all Go builds | 14:40:26 |
emily | does that sound sensible? I think it's at least close to an upstreamable shape | 14:40:32 |
emily | and then the only non-upstream patch we need is ^, DefaultPIE always true except for explicit carve-outs for Linux/PPC64 and Windows + race checker | 14:41:00 |
emily | and then -linkmode=internal should work | 14:41:16 |
emily | static PIE would still need the "force external linking" thing figured out, but that's out of scope for current work | 14:41:27 |
emily | (I do want static PIEs though) | 14:41:32 |
emily | (but it's a whole nother yak shave) | 14:41:41 |
Lun |
export defaultGO_LDSO in… wherever it's defined, isn't that a mass rename?
| 14:42:53 |
Lun | *
export defaultGO_LDSO in… wherever it's defined,
isn't that a mass rename?
| 14:42:57 |
Lun | no it's only in 2 places | 14:43:34 |
emily | it's not exported anyway | 14:44:48 |
emily | because it starts with a lowercase letter | 14:44:51 |