[PATCH 3/3] LoongArch: Fix md_pcrel_from

Project / Subsystem

binutils / loongarch

Date

2026-08-13

Proposer

mengqinggang <mengqinggang@loongson.cn>

Source type

public_inbox

Consensus

Proposed

Sentiment

—/10

Technical tradeoffs

  • • Correctly calculates PC-relative offsets, ensuring accurate code generation.
  • • Fixes a bug that could lead to incorrect program behavior or link-time errors.

All attributes

project
binutils
subsystem
loongarch
patch_id
—
discussion_id
20260813170736.1880481-4-mengqinggang@loongson.cn
source_type
public_inbox
title
[PATCH 3/3] LoongArch: Fix md_pcrel_from
headline
LoongArch: Fix md_pcrel_from
tldr
Correctly calculates PC-relative offsets for LoongArch instructions.
proposer
mengqinggang <mengqinggang@loongson.cn>
consensus
Proposed
outcome
proposed
sentiment_score
—
technical_tradeoffs
  • • Correctly calculates PC-relative offsets, ensuring accurate code generation.
  • • Fixes a bug that could lead to incorrect program behavior or link-time errors.
series_id
binutils:loongarch: fix md_pcrel_from
series_role
reply
series_parts
[]
tags
  • • loongarch
  • • assembler
  • • relocations
  • • pc-relative
bugzilla_url
—
date
2026-08-13T00:00:00.000Z

[PATCH 3/3] LoongArch: Fix md_pcrel_from

This patch corrects the md_pcrel_from function for the LoongArch architecture. Previously, it incorrectly returned 0, which is not the correct base address for PC-relative calculations. The function is updated to return fixP->fx_frag->fr_address + fixP->fx_where, which accurately represents the start of the current instruction, ensuring correct PC-relative offset computation.