binutils Newspaper
NOVEMBER 30, 2026
loongarch — Proposed

LoongArch: Reject GOT/PLT relocations in non-allocatable sections

Patch rejects GOT/PLT relocations in non-allocatable sections for LoongArch to prevent errors.

This patch prevents errors in the LoongArch linker by rejecting GOT, TLS GOT, and branch relocations when they occur in non-allocatable sections. Relocation scanning normally skips these sections, meaning GOT or PLT entries are not allocated for them. Processing these relocations later can lead to access misses, assertions, or invalid memory accesses. Debugging sections are still allowed.

In the Thread 1 participant
  1. zhaozhou <zhaozhou@loongson.cn> proposer

    Submits a patch to reject specific relocations in non-allocatable sections for the LoongArch architecture to prevent runtime errors.

In Details

The LoongArch ELF backend in binutils is being updated to reject certain relocations (GOT, TLS GOT, branch) when they are applied to sections marked as non-allocatable (SEC_ALLOC). The linker's relocation scanning process typically ignores these sections, thus not reserving space in the Global Offset Table (GOT) or Procedure Linkage Table (PLT). Attempting to resolve such relocations later can lead to invalid memory accesses or assertion failures. The patch adds checks to detect and reject these cases during the final linking phase, while exempting debug sections (SEC_DEBUGGING).

For Context
LoongArch
A RISC-ISA (Instruction Set Architecture) developed in China.
GOT
Global Offset Table. A table used by position-independent code to store addresses of global variables and functions.
PLT
Procedure Linkage Table. A table used in ELF executables to handle calls to dynamically linked external functions.
relocation
A symbol or pointer in an object file that needs to be resolved by the linker before the program can be executed. Relocations contain information about how to modify addresses or other data.
non-allocatable sections
Sections in an object file that are not intended to be loaded into memory at runtime, such as those containing debugging information or linker-specific metadata.
linker
A program that combines various object files and libraries into a single executable file or library.
ELF
Executable and Linkable Format. A common standard file format for object files, executables, and shared libraries on Unix-like systems.
Filed Under: binutilsLoongArchlinkerrelocationsecurity