[PATCH 2/3] LoongArch: Mark .reloc *, R_LARCH_RELAX target frag
Project / Subsystem
binutils / loongarch
Date
2026-09-10
Proposer
mengqinggang <mengqinggang@loongson.cn>
Source type
public_inbox
Consensus
Proposed
Sentiment
—/10
Technical tradeoffs
- • Corrects invalid code generation for linker-relaxable fragments.
- • Ensures accurate DWARF debugging information.
- • Introduces new hook functions (`loongarch_md_finish`, `tc_frob_file_before_fix`) for managing relaxable states.
All attributes
- project
- binutils
- subsystem
- loongarch
- patch_id
- —
- discussion_id
- 20260910092253.526336-3-mengqinggang@loongson.cn
- source_type
- public_inbox
- title
- [PATCH 2/3] LoongArch: Mark .reloc *, R_LARCH_RELAX target frag
- headline
- LoongArch: Mark .reloc *, R_LARCH_RELAX as linker-relaxable
- tldr
- Ensures GAS correctly identifies fragments with R_LARCH_RELAX as linker-relaxable.
- proposer
- mengqinggang <mengqinggang@loongson.cn>
- consensus
- Proposed
- outcome
- proposed
- sentiment_score
- —
- technical_tradeoffs
-
- • Corrects invalid code generation for linker-relaxable fragments.
- • Ensures accurate DWARF debugging information.
- • Introduces new hook functions (`loongarch_md_finish`, `tc_frob_file_before_fix`) for managing relaxable states.
- series_id
- binutils:loongarch: mark .reloc *, r_larch_relax target frag
- series_role
- reply
- series_parts
- []
- tags
-
- • LoongArch
- • assembler
- • GAS
- • relocation
- • DWARF
- bugzilla_url
- —
- date
- 2026-09-10T00:00:00.000Z
[PATCH 2/3] LoongArch: Mark .reloc *, R_LARCH_RELAX target frag
This patch corrects how the LoongArch assembler (GAS) handles .reloc *, R_LARCH_RELAX directives. Previously, GAS marked such fragments as linker-relaxable but did not record this state in the containing frag and section. This led to incorrect assumptions about fixed distances between symbols, resulting in the conversion of same-frag symbol subtraction to PC-relative relocations and the use of special DWARF line table opcodes, both invalid after linker relaxation. The fix involves recording the relaxable state and adjusting relocation decisions and DWARF line table generation accordingly.