[RFC PATCH] LoongArch: Use local anchors for relocatable section symbols

Project / Subsystem

binutils / loongarch

Date

2026-09-19

Proposer

mengqinggang <mengqinggang@loongson.cn>

Source type

public_inbox

Consensus

Proposed

Sentiment

—/10

Technical tradeoffs

  • • Introduces local anchors to manage section offsets, potentially increasing symbol table size.
  • • Ensures compatibility with LoongArch's relaxation constraints that prevent standard section symbol + offset optimizations.

All attributes

project
binutils
subsystem
loongarch
patch_id
—
discussion_id
20260919085650.2568760-1-mengqinggang@loongson.cn
source_type
public_inbox
title
[RFC PATCH] LoongArch: Use local anchors for relocatable section symbols
headline
LoongArch: Use local anchors for relocatable section symbols
tldr
RFC patch to use local anchors for relocatable section symbols in LoongArch to handle linker's folding of output_offset into RELA addends.
proposer
mengqinggang <mengqinggang@loongson.cn>
consensus
Proposed
outcome
proposed
sentiment_score
—
technical_tradeoffs
  • • Introduces local anchors to manage section offsets, potentially increasing symbol table size.
  • • Ensures compatibility with LoongArch's relaxation constraints that prevent standard section symbol + offset optimizations.
series_id
—
series_role
standalone
series_parts
[]
tags
  • • linker
  • • loongarch
  • • relocation
  • • optimization
  • • rfc
bugzilla_url
—
date
2026-09-19T00:00:00.000Z

[RFC PATCH] LoongArch: Use local anchors for relocatable section symbols

This RFC patch addresses an issue in LoongArch where the linker, when performing a partial link (ld -r), folds the output section offset into the RELA addend for STT_SECTION symbols. LoongArch’s relaxation mechanism does not support optimizing symbols into a section symbol plus offset form, necessitating the use of local STT_NOTYPE anchors. These anchors will store the input section’s output offset, allowing subsequent relaxation or section movement to update the anchor without modifying relocation addends.