binutils Newspaper
OCTOBER 6, 2026
loongarch — Proposed

LoongArch: Restore pointer_equality_needed for GOT data relocations

Developer questions the rationale for restoring `pointer_equality_needed` for GOT data relocations, arguing it's irrelevant for data symbols.

Xi Ruoyao expresses skepticism regarding a proposed patch to restore pointer_equality_needed for LoongArch GOT data relocations. He argues that this flag is relevant only for function symbols to ensure pointer equality between PLT stubs and actual functions, and has no bearing on data symbols, suggesting the observed breakage for data symbols implies a more widespread issue than the patch addresses.

In the Thread 1 participant
  1. Xi Ruoyao <xry111@xry111.site> proposer

    Questions the reasoning behind restoring `pointer_equality_needed` for GOT data relocations, stating it's unrelated to data symbols and suggests the problem might be more systemic.

    “This does not make sense to me. Global data symbols are accessed via R_LARCH_GOT_PC_HI20 everywhere, not only the CRT startup code. Thus if accessing data symbols with R_LARCH_GOT_PC_HI20 is broken we'd have a much more wide-spreading breakage. Pointer equality matters because if you end up comparing the address of the PLT stub and the address of the real function you'd break pointer equality.…”

In Details

This discussion revolves around a disagreement concerning the handling of pointer_equality_needed for LoongArch GOT relocations in binutils. A previous commit removed this flag for GOT relocations to fix PR 29655 (function pointer equality in PIE). However, this caused issues with data symbols accessed via GOT relocations in static executables. The poster argues that pointer_equality_needed is irrelevant for data symbols and questions the proposed fix of selectively re-enabling it.

For Context
pointer_equality_needed
A flag used in relocation processing that indicates whether comparing addresses of PLT stubs and actual function symbols could lead to incorrect results, particularly in PIE executables.
GOT
Global Offset Table, a table used in position-independent code to store addresses of global variables and functions, allowing them to be accessed indirectly.
relocations
Information in an object file that describes how to modify parts of the code or data when linking, such as resolving symbol addresses.
PIE
Position-Independent Executable, an executable that can be loaded at any memory address.
PLT stub
A small piece of code in the Procedure Linkage Table that acts as an intermediary to resolve and jump to a dynamically linked function.
Filed Under: binutilsloongarchrelocationsgotlinker