[PATCH v0 4/4] LoongArch: Emit alignment relocations after relaxed instructions

Project / Subsystem

binutils / loongarch

Date

2026-07-07

Proposer

mengqinggang <mengqinggang@loongson.cn>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Delaying alignment relocations improves the accuracy of their placement relative to relaxed instructions, potentially simplifying linker logic.
  • The change requires careful management of section flags to correctly track the presence of relaxed instructions.

All attributes

project
binutils
subsystem
loongarch
patch_id
discussion_id
20260707174719.1883721-5-mengqinggang@loongson.cn
source_type
public_inbox
title
[PATCH v0 4/4] LoongArch: Emit alignment relocations after relaxed instructions
headline
LoongArch: Emit alignment relocations after relaxed instructions
tldr
Ensures LoongArch alignment relocations are emitted only after relaxed instructions, mimicking LLVM behavior.
proposer
mengqinggang <mengqinggang@loongson.cn>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Delaying alignment relocations improves the accuracy of their placement relative to relaxed instructions, potentially simplifying linker logic.
  • The change requires careful management of section flags to correctly track the presence of relaxed instructions.
series_id
binutils:loongarch: emit alignment relocations after relaxed instructions
series_role
reply
series_parts
[]
tags
  • loongarch
  • binutils
  • assembler
  • linker
  • optimization
bugzilla_url
date
2026-07-07T00:00:00.000Z

[PATCH v0 4/4] LoongArch: Emit alignment relocations after relaxed instructions

This patch modifies the LoongArch gas configuration to ensure alignment relocations are emitted only after relaxed instructions. It prevents the creation of alignment fragments if the current section does not already contain relaxed instructions, aligning the behavior with LLVM’s approach to similar issues.