Building glibc with -mapxf currently fails. GCC generates instructions like: addq __libc_h_errno@gottpoff(%rip), %r10, %r9 addq __libc_errno@gottpoff(%rip), %r10, %r8 But GAS cannot assemble them: /tmp/ccv8k23B.s: Assembler messages: /tmp/ccv8k23B.s:8886: Error: TLS relocation cannot be used with `add' /tmp/ccv8k23B.s:8887: Error: TLS relocation cannot be used with `add' binutils-2.41-34.fc40.x86_64 gcc-14.0.1-0.13.fc40.x86_64 Reproducible: Always
Created attachment 2025140 [details] getaddrinfo.i Reproducer. Compile with: gcc -O2 -fgnu89-inline -mapxf getaddrinfo.i
I wonder if this just isn't a GCC bug instead. Because https://akkadia.org/drepper/tls.pdf certainly doesn't document the APX addq for the TLS sequences, and IE->LE transition aren't defined for those, normally it is: movq %fs:0,%rax addq x@gottpoff(%rip),%rax to movq %fs:0,%rax leaq x@tpoff(%rax),%rax but in case of 3 operand addq, we'd need need some prefixed leaq instead. So, either GCC (perhaps temporarily) should ensure it is using just 2 operands with UNSPEC_GOTTPOFF (what about other TLS models?), or we need to decide what to use for the transitions, ask Uli to document in tls.pdf, update assemblers and all the 4 linkers to handle those transitions etc.
There has been a psABI update for APX and TLS relocations: APX: Add R_X86_64_CODE_(5|6)_(GOTPCRELX|GOTTPOFF|GOTPC32_TLSDESC) <https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/ea58f2579c3d9ac27d44267580b73ea17879b5b3> The issue does not occur with: binutils-2.41-35.el10.x86_64 gcc-14.0.1-0.6.el10.x86_64
Rebuilding RHEL 10 binutils for Fedora (resulting in binutils-2.41-36.fc40.x86_64) did not resolve the issue. H.J., any ideas?
The following commits are needed: 5bc71c2a6b8 x86-64: Add R_X86_64_CODE_6_GOTTPOFF eed38d8a02b Fix x86-64: Add R_X86_64_CODE_4_GOTPCRELX 00a17c6ad06 Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF a533c8df598 x86-64: Add R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_4_GOTPC32_TLSDESC 4a54cb06585 gold: Handle R_X86_64_CODE_4_GOTPCRELX 3d5a60de525 x86-64: Add R_X86_64_CODE_4_GOTPCRELX
Thanks H.J. As it turns out we already have but one those commits in the F40 binutils. I have now created binutils-2.41-35.fc40 which contains the missing commit (5bc71c2a6b8 x86-64: Add R_X86_64_CODE_6_GOTTPOFF).
This message is a reminder that Fedora Linux 40 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 40 on 2025-05-13. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '40'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see it. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 40 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed.
Fedora Linux 40 entered end-of-life (EOL) status on 2025-05-13. Fedora Linux 40 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora Linux please feel free to reopen this bug against that version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see the version field. If you are unable to reopen this bug, please file a new report against an active release. Thank you for reporting this bug and we are sorry it could not be fixed.