Fix aarch64 assembler error with %dtprel relocations
Fixes an assembler internal error in aarch64 when handling %dtprel relocations, particularly with TLS DWARF debug info.
The aarch64 assembler in Binutils no longer encounters an internal error when processing %dtprel relocations. This error occurred because the fixup for DTPREL was created before reserving storage for the corresponding .xword. This issue was exposed by GCC’s %dtprel support for TLS Debug info, which places the fixup at a fragment boundary. The fix ensures storage is reserved before the fixup is created.
In Details
The assembler's handling of DTPREL relocations on aarch64, specifically when generated by GCC for TLS-related DWARF debug information, could lead to an internal error. This error stemmed from creating the DTPREL fixup at a fragment boundary before the associated storage (.xword) was allocated. This commit corrects the order by reserving the storage first, then creating the fixup, resolving the race condition.
- aarch64
- The 64-bit Arm architecture.
- %dtprel
- A relocation specifier related to Thread-Local Storage (TLS) Data Structure Pointer Relative addressing. It's used in DWARF debug information.
- relocation
- A process during linking where symbolic addresses in object files are resolved to actual memory addresses. Relocation entries specify how to modify code or data to reference other symbols.
- TLS
- Thread-Local Storage, a mechanism that provides each thread in a multithreaded program with its own copy of variables.
- DWARF
- A debugging data format used by many compilers and debuggers to represent information about variables, types, and program structure.
- assembler
- A program that converts assembly language code into machine code.
- fragment
- In the context of assemblers like gas, a fragment represents a chunk of output code or data. Relocations can occur at fragment boundaries.