binutils Newspaper
NOVEMBER 30, 2026
opcodes — Proposed

opcodes: microblaze: disassemble the word 0

Modifies MicroBlaze disassembler to correctly handle zero words, allowing disassembly to continue past padding.

This patch addresses an issue where objdump stops disassembling at the first zero word encountered, often due to padding. The read_insn_microblaze function is updated to return a boolean indicating success and pass the instruction word via a pointer. This change allows the disassembler to distinguish between a failed memory read and the valid instruction ‘add r0, r0, r0’ (word 0), ensuring continuous disassembly.

In the Thread 1 participant
  1. Samuel Price proposer

    Introduces a change to the MicroBlaze disassembler to correctly handle zero words, improving disassembly continuity.

    “objdump stops disassembling a section at the first zero word, such as the padding " .align 3 " leaves after a single instruction. read_insn_microblaze returns the instruction word, or 0 when the read fails, so its two callers cannot tell a failed read from the word 0 and return -1 for both.”

In Details

This patch modifies the MicroBlaze disassembler (opcodes/microblaze-dis.c) to correctly handle instruction words that are zero. Previously, read_insn_microblaze returned 0 for both a valid 'add r0, r0, r0' instruction and a failed memory read, causing disassembly to halt. The function is refactored to return a boolean success status and pass the instruction word via an output parameter. This allows objdump and other tools to differentiate a zero instruction from a read error, preventing premature termination of disassembly, especially after padding.

For Context
objdump
A standard utility in the GNU Binutils package used to display information from object files, including disassembly of machine code.
disassembler
A program that translates machine code into assembly language.
padding
Unused space inserted into a data structure or code section, often for alignment purposes. In disassembly, it can appear as zero bytes.
MicroBlaze
A soft processor core from Xilinx, designed to be implemented in FPGAs. It has a RISC-like architecture.
UG984
A specific user guide or technical reference manual for the MicroBlaze processor.
Filed Under: microblazedisassemblerobjdumpbug fix