binutils Newspaper
NOVEMBER 30, 2026
loongarch — Needs Revision

LoongArch: Relocation out-of-section detection acknowledged

The submitter acknowledges feedback on the LoongArch relocation detection patch and will post revisions soon.

Mengqinggang acknowledges feedback on the v2 patch for detecting LoongArch relocations that extend beyond their section boundaries. The feedback, provided by Harshit Kumar, included positive results from cross-checks against other architectures and noted three potential issues still present on the master branch. Revisions to address these points will be posted shortly.

In the Thread 2 participants
  1. mengqinggang proposer

    Acknowledges feedback and plans to submit revised patches.

    “Thanks a lot for the feedback. I'll post some new patches to address these issues soon.”
  2. Harshit Kumar reviewer

    Provided feedback on the v2 patch, confirming its correctness for several tests but highlighting three remaining issues.

    “Thanks for picking this up again. I ran v2 through the checks I used for the AArch64 and ARM versions, on a loongarch64-linux-gnu cross of master ba2f46b2e4: - check-ld: only the new test changes (943 -> 944 expected passes, no failures). - An ASan run over every LoongArch relocation type (ELF32 and ELF64; a field crossing the end, starting at the end, or far away; static,…”

In Details

This discussion concerns a patch aimed at improving the robustness of the LoongArch linker implementation within binutils. The patch introduces checks to ensure that relocation entries do not extend beyond the bounds of their respective sections. Feedback indicates the patch functions correctly for its intended purpose and passes various test cases, but three additional issues related to ULEB128 termination, relaxation logic, and shared object linking with non-PIC code have been identified for future work.

For Context
LoongArch
A RISC-based instruction set architecture developed in China, used in processors manufactured by Loongson.
relocation
The process by which the linker or loader adjusts memory addresses in code or data to reflect the final location of program segments.
section
A distinct part of an object file or executable, such as the .text section for code, .data section for initialized data, or .bss section for uninitialized data.
ULEB128
Unsigned Little Endian Base 128, a variable-length encoding format for integers, often used in DWARF debugging information and other compiler-generated data.
ASan
AddressSanitizer, a memory error detector for C/C++ that finds bugs like use-after-free or buffer overflows.
Filed Under: binutilsloongarchlinkerrelocationtesting