Nix Cross Compiling | 582 Members | |
| 127 Servers |
| Sender | Message | Time |
|---|---|---|
| 21 Apr 2025 | ||
| 15:18:56 | ||
I have a job that runs my builds against latest unstable each weekend, and this weekend the bump from GCC 14.2.1 20241116 to GCC 14.2.1 20250322 has changed something with relocations as I now get a bunch of dangerous relocation: unsupported relocation. Mainly because relocations are not supported on the target I used (arm-embedded, armv6-m), but I pass in hardeningDisable = [ "all" ];. I expected something to break due to the bump based upon that issue about GCC breakage, but not this. Anyone have any ideas what may have changed? | 16:42:03 | |
In reply to @rosssmyth:matrix.orgWhat derivation broke? | 17:17:44 | |
| Do you have an easy reproducer? | 17:17:58 | |
| So far I have not been able to make one. All of the unsupported relocations are from libc.a. So functions like memset, memcpy, and such. So they all look something like this
I'll mess around some more this afternoon to see if I can get a minimal reproducer. | 18:02:38 | |
| * So far I have not been able to make one. All of the unsupported relocations are from libc.a. So functions like memset, memcpy, and such. So they all look something like this
I'll mess around some more this afternoon to see if I can get a minimal reproducer. | 18:02:51 | |
ltrans suggests these are LTO builds. | 21:30:03 | |
Do you have a reproducer? Chances are ld did not have a correct linker plugin present. | 21:30:23 | |
* Chances are ld did not have a correct linker plugin present. | 21:30:46 | |
| Disabling LTO results in less errors. But the build also fails earlier in the build process.
| 21:41:58 | |
| * Disabling LTO results in less errors. But the build also fails earlier in the build process.
| 21:46:00 | |
| * Disabling LTO removes the references to ltrans, but the same errors result.
| 21:46:47 | |
| 22 Apr 2025 | ||
Aha. Can you have a look what relocation is that? arm-none-eabi-objdump -dr should have an entry around .text.main+0x4e | 04:56:34 | |
| 13:20:19 | |
| Redacted or Malformed Event | 13:20:54 | |
*
| 13:22:31 | |
i think i figured out a possible cause. your code might be defining memset in assembly, but did not specify the symbol type as a function. therefore, the linker is refusing to emit a call to it because some paranoia about mixing arm and thumb functions. | 13:51:19 | |
if that's the case, you need to use .type memset, %function in your assembly code, and possibly all other functions as well | 13:51:42 | |
| this is a new check added in binutils 2.44 https://github.com/bminor/binutils-gdb/commit/31ed3a9d691493486f6e32357d89a55229dbdc0a#diff-9db1c8e03c72939d28438bba610afca27de21c37dda3d09639a8b531a5610902R10508 | 13:55:20 | |
| this should reproduce the "issue"
| 13:58:21 | |
| mostly unrelatedly, but the worst part about trying to debug this issue is element defaulted to not line wrapping code | 14:04:10 | |
| That's interesting. I do not define them in asm, I just use the newlib(-nano) provided ones. I just checked and it seems they do use the correct type for their asm defined functions. | 14:17:37 | |
In reply to @rosssmyth:matrix.orgare you using pkgsCross.arm-embedded? in that case the nanolib is compiled for arm and would not work for armv6-m | 14:28:08 | |
| you might need to write your own `crossSystem` while importing nixpkgs | 14:36:35 | |
| I tried that well earlier and it did not work with the same error | 20:52:34 | |
| * I tried that as well earlier and it did not work with the same error | 20:52:40 | |
I believe I have found the issue. While narrowing down to a minimal reproducer, it seems that passing -mthumb -mcpu=cortex-m0 -march=armv6-m with the cross-file, which should just be redundant with the armv6m toolchain, somehow messes up linking. Removing the cross file results in it compiling with the armv6m toolchain. But if the arm-embedded toolchain isn't thumb compatible, then what needs to be done to get multilib working? | 22:38:59 | |
| Cause an embedded toolchain that only works for a specific architecture is kind of silly | 22:39:40 | |
| Especially if it doesn't support thumb. And I would prefer not to spend 30 minutes building GCC in github actions every time CI runs | 22:40:15 | |
| For anyone curious, here's a reproducer https://github.com/RossSmyth/armRepro | 22:50:34 | |