binutils Newspaper
NOVEMBER 30, 2026
loongarch — Proposed

LoongArch: Detect relocations out of section range

LoongArch relocation error message will include relocation name in a future revision.

Following a suggestion to include the relocation name in error messages, Harshit Kumar agrees to add this detail in a future revision of the patch series. This change addresses the detection of relocations that fall outside the valid range of a section for the LoongArch architecture. The original patch maintained consistency with existing error messages from i386 and x86-64.

In the Thread 2 participants
  1. Harshit Kumar <harshit7kr@gmail.com> proposer

    Agrees to add the relocation name to the error message in a future revision, acknowledging its usefulness.

    “Thanks. Naming the relocation makes sense. The message is currently the one i386 and x86-64 already print, so I kept the wording the same; I'll add the name in the next revision of the series.”
  2. mengqinggang <mengqinggang@loongson.cn> contributor

    Thanks Harshit and suggests adding the relocation name to the error message.

    “Thanks — please use the existing patch and ignore mine. By the way, how about adding the relocation name to the error message?”

Technical Tradeoffs

  • Improved error messages aid debugging.
  • Adding relocation names requires minor code changes.

In Details

This discussion concerns error handling in the LoongArch linker (ld) within binutils. Specifically, it addresses situations where a relocation entry's offset points outside the bounds of its associated section. The patch aims to improve diagnostics by making these errors more informative, with a follow-up suggestion to include the name of the relocation for easier identification.

For Context
LoongArch
A 64-bit CPU architecture developed by Loongson Technology.
relocation
Information in an object file that describes how to modify certain values, typically code or data, after linking to allow them to be placed at an absolute address.
section
A segment of an object file or executable that contains related data, such as code (.text), initialized data (.data), or uninitialized data (.bss).
linker
A program that combines various pieces of code and data (from object files and libraries) and resolves references between them to create a single executable file or library.
Filed Under: binutilsloongarchlinkererror handling