binutils Newspaper
JULY 29, 2026
loongarch Proposed

LoongArch: Support R_LARCH_TLS_DTPREL32/64 used in debug section

Simplify LoongArch TLS relocations in debug sections for better compatibility.

This patch simplifies the processing of R_LARCH_TLS_DTPREL32/64 relocations within the debug sections on LoongArch systems. It aims to return the correct offset to the TLS block for symbols and sets partial_inplace to false, acknowledging that LoongArch uses RELA relocations. The changes are an iteration from previous versions, with adjustments to the dtprel.d file to remove addend values and improve clarity.

In Details

This patch modifies bfd/elfnn-loongarch.c and related test files to correctly handle Thread-Local Storage (TLS) relocations, specifically R_LARCH_TLS_DTPREL32/64, when they appear within debug sections. The change simplifies the relocation processing logic and ensures the correct offset to the TLS block is returned. By setting partial_inplace to false, it aligns with LoongArch's use of RELA relocations, avoiding potential incompatibilities seen in previous compiler outputs where redundant addends were generated.

Filed Under: tlsrelocationloongarchdebuggingbinutils