13 Sep 2025 |
emily | my one point of hesitation here is, does this break static, and I think the answer is maybe | 18:22:31 |
Lun | oh dear, this is going to involve qemu testing of unusual arches again | 18:22:32 |
emily | meh I don't think so | 18:22:42 |
emily | it's just a nice way to avoid injecting janky flags | 18:22:50 |
Lun | adding a patch that sets a ppc64 exclusive condition without testing for ppc64? | 18:23:35 |
emily | the other thing we'd want is an upstreamable GO_PIE_ENABLED or something I suppose | 18:23:42 |
emily | yes, because we know for a fact we can't do PIE on ppc64, because https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/config.go#L221-L225 | 18:24:04 |
emily | the conditional would keep the existing behaviour on ppc64 | 18:24:08 |
emily | it is just to avoid breaking Puna | 18:24:19 |
emily | (and anyway I'm sure we can get Puna to run builds rather than doing QEMU suffering) | 18:24:30 |
emily | FWIW, cases where people would be overriding us: https://github.com/search?q=-linkmode%3Dinternal&type=code | 18:25:11 |
Puna | i can only run the same builds that you can, because my hardware cannot execute golang/go | 18:25:44 |
emily | anyway I think this is viable modulo figuring out if it busts static (because it will do PIE and then not link as a static PIE) | 18:25:55 |
emily | right, forgot about that 🫠| 18:26:03 |
emily | do we need to get you a Raptor or something | 18:26:10 |
emily | (I think best-effort is fine here anyway) | 18:26:32 |
Puna | willing to accept donations | 18:26:42 |
emily | aloisw: looks like externally linked static builds are "fun" https://github.com/golang/go/issues/26492 | 18:27:45 |
emily | but seems doable | 18:27:52 |
emily | so I was worried our Go build would be multi-target and we had to handle this natively | 18:28:25 |
emily | but lol no it's not | 18:28:28 |
emily | so actually Lun, you can just skip the conditional inside the PIE patch, and only skip applying it for ppc64 | 18:28:42 |
emily | and also skip it on stdenv.targetPlatform.isStatic | 18:28:58 |
aloisw | That will just give a position-dependent executable right? | 18:29:04 |
emily | that and setting GO_EXTLINK_ENABLED at Go compile time should make everything just workâ„¢ | 18:29:06 |
Puna | (Debian has also given up on golang/go on powerpc64 though, and switched to gccgo for their default. so iunno how much sense it makes to test that target) | 18:29:08 |
emily | I guess? supposedly hardeningEnable = [ "pie" ]; breaks pkgsStatic . | 18:29:18 |
aloisw | Not great but better than nothing. | 18:29:18 |
emily | oh, I guess because it links with -pie ? | 18:29:23 |
emily | but Go wouldn't link with PIE. | 18:29:29 |