14 Sep 2025 |
emily | that's how you can tell | 14:44:54 |
emily | GO_LDSO is, because it starts with a capital letter | 14:45:11 |
emily | but yeah exactly one use site, so it's fine to drop it in favour of exporting the default | 14:45:17 |
emily | all this implicit stuff drives me crazy | 14:45:53 |
emily | it'd be so easy to trace the logic if you could see where every imported definition came from | 14:46:04 |
emily | wait | 14:47:19 |
emily | why the hell does it condition on GO_LDSO != "" | 14:47:24 |
emily | if interpreter == "" && buildcfg.GOOS == runtime.GOOS && buildcfg.GOARCH == runtime.GOARCH && buildcfg.GO_LDSO != "" {
interpreter = buildcfg.GO_LDSO
}
| 14:47:29 |
emily | it's literally a nop if it is | 14:47:31 |
emily | wonderful codebase 10/10 | 14:47:50 |
aloisw | In reply to @emilazy:matrix.org teaching the internal linker to do the right thing does seem like a good idea if it's only a matter of helping it find the interpreter. I interpreted aloisw as saying there was more of an obstacle, but if there's not then that is probably a good path. I think we need to do it at runtime because it can depend on $NIX_CC but it might be easy enough Well that -I PR basically is trying to tell the internal linker to do the right thing. | 15:00:31 |
emily | there's an -I PR? | 15:00:56 |
emily | I have not seen any such PR | 15:00:59 |
emily | so that is probably the context I have been missing | 15:01:06 |
aloisw | The one I authored that passes -I via ldflags but doesn't bother passing ldflags via GOFLAGS . I'm not saying it's perfect, there are different obstacles compared to the current way. | 15:02:33 |
emily | ah, https://github.com/NixOS/nixpkgs/pull/421003? | 15:03:07 |
emily | yes I had never seen this before | 15:03:09 |
emily | I think that the GO_LDSO patch is probably the way to go | 15:03:23 |
emily | it will work for builds doing weird nested stuff and seems upstreamable | 15:03:33 |
Lun | What does changing around GO_LDSO → DefaultGO_LDSO achieve? I feel like I must have interpreted what you said wrong looking at the diff
https://gist.github.com/LunNova/3c77fc924f1f7343ff190d6af09334fc | 15:03:51 |
emily | and then the "DefaultPIE by default" patch is very lightweight and only not upstreamable because upstream presumably doesn't agree with our desires | 15:03:52 |
emily | when something can be used at both runtime and compile-time, they don't define GO_FOO but instead have functions doing things like envOr("GO_FOO", defaultGO_FOO) | 15:04:44 |
emily | so if we have a runtime GO_LDSO , having a variable called GO_LDSO that might not be the runtime one is misleading | 15:04:54 |
aloisw | In reply to @emilazy:matrix.org ah, https://github.com/NixOS/nixpkgs/pull/421003? I posted it some days back and you asked why GOFLAGS was not done. | 15:04:59 |
Lun | ah so that's with intent to upstream rather than minimizing a patch to carry | 15:05:11 |
emily | I missed the link. me talking about GOFLAGS wasn't in reaction to this PR | 15:05:18 |
Lun | * ah so that's with intent to upstream and follow conventions rather than minimizing a patch to carry | 15:05:19 |
emily | it was in reaction to looking at the existing ldflags stuff in the Go build machinery | 15:05:28 |
emily | sorry for missing the link :( | 15:05:33 |
emily | I would have been a lot less confused if I had seen it | 15:05:42 |