binutils Newspaper
OCTOBER 6, 2026
microblaze — Ready to Land

microblaze: add BFD_RELOC_8 and BFD_RELOC_16 cases

Adds support for 8-bit and 16-bit relocations in MicroBlaze's `md_apply_fix` function.

This patch addresses an issue in the MicroBlaze backend where the md_apply_fix function lacked cases for BFD_RELOC_8 and BFD_RELOC_16. Without these cases, byte or halfword values known only at fixup time were being assembled as zero, and the subsequent relocation resolution would turn them into BFD_RELOC_NONE, preventing the linker from correcting them. The fix adds these cases, replicating the logic for BFD_RELOC_32 but for smaller data sizes, thereby fixing the gas/all/simple-forward testcase and un-xfailing gas/all/forward.

In the Thread 1 participant
  1. Michael Eager <eager@eagerm.com> maintainer

    Notes that the patch has been applied.

    “On 9/21/26 6:29 PM, Sam Price wrote: > From: Samuel Price <thesamprice@gmail.com> > > md_apply_fix has cases for BFD_RELOC_32, BFD_RELOC_64 and for the > MicroBlaze-specific relocations, but none for BFD_RELOC_8 or BFD_RELOC_16. > Those fall through to the default and nothing is written, so a byte or > halfword datum whose value is only known at fixup time assembles to zero. > The fixup is then…”

In Details

This patch adds handling for BFD_RELOC_8 and BFD_RELOC_16 to MicroBlaze's md_apply_fix in gas/config/tc-microblaze.c. Previously, these relocation types fell through to a default case, resulting in zero-valued fixups that were not corrected by the linker. The change ensures that these smaller relocations are correctly processed, resolving issues in the gas/all/simple-forward and gas/all/forward test cases.

For Context
BFD_RELOC_8
A relocation type representing an 8-bit data element.
BFD_RELOC_16
A relocation type representing a 16-bit data element.
md_apply_fix
A function within the BFD (Binary File Descriptor) library that applies fixups to relocatable data during the assembly process.
Fixup
A placeholder in assembled code that needs to be resolved by the linker to a final address or value. In this context, if a fixup is not properly handled, it can lead to incorrect code.
BFD_RELOC_NONE
A relocation type indicating that no relocation is necessary or that a relocation has been resolved and no longer needs further processing.
Filed Under: microblazegasrelocationfixup