[PATCH v3 2/4] microblaze: use md_number_to_chars in md_apply_fix

Project / Subsystem

binutils / microblaze

Date

2026-09-24

Proposer

Sam Price <thesamprice@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

—/10

Technical tradeoffs

  • • Replaces architecture-specific byte manipulation with a generic BFD function for improved portability and maintainability.
  • • Introduces a new macro to handle instruction immediate offsets, maintaining functional correctness.
  • • No functional change, but improves code structure and consistency.

All attributes

project
binutils
subsystem
microblaze
patch_id
—
discussion_id
20260924015023.36799-1-thesamprice@gmail.com
source_type
public_inbox
title
[PATCH v3 2/4] microblaze: use md_number_to_chars in md_apply_fix
headline
microblaze: use md_number_to_chars in md_apply_fix
tldr
Refactors MicroBlaze's `md_apply_fix` to use `md_number_to_chars` for more consistent and cleaner relocation handling.
proposer
Sam Price <thesamprice@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
—
technical_tradeoffs
  • • Replaces architecture-specific byte manipulation with a generic BFD function for improved portability and maintainability.
  • • Introduces a new macro to handle instruction immediate offsets, maintaining functional correctness.
  • • No functional change, but improves code structure and consistency.
series_id
binutils:microblaze: use md_number_to_chars in md_apply_fix
series_role
reply
series_parts
[]
tags
  • • microblaze
  • • gas
  • • refactoring
  • • relocation
bugzilla_url
—
date
2026-09-24T00:00:00.000Z

[PATCH v3 2/4] microblaze: use md_number_to_chars in md_apply_fix

This patch refactors the md_apply_fix function in the MicroBlaze backend to utilize the generic md_number_to_chars function for writing relocation data. This approach is consistent with how other backends like AArch64, MIPS, and SPARC handle relocations. For data relocations, this simplifies the code by removing endianness-specific branches. For instruction relocations, a new macro INST_IMM_OFFSET is introduced to handle the immediate field’s offset within the instruction word, as md_number_to_chars only addresses byte ordering. The change aims to have no functional impact and has been validated by the test suite, showing no unexpected failures on either MicroBlaze endianness.