Skip to content

objdump Aborts When Disassembling ELF Files with Debug Sections (Fixed Post-2025.10) #47

@bigmagic123

Description

@bigmagic123

Summary
In both the 2025.02 and 2025.10 toolchain releases, executing objdump -D on ELF files containing debugging information may trigger an abrupt termination ("Aborted"). This issue stems from problematic handling of debug sections during disassembly, and was resolved upstream after the 2025.10 release.

Issue Details
Error Manifestation

<BASH>
$ riscv64-unknown-elf-objdump -D firmware.elf
Aborted (core dumped)

Root Cause

Debug Section Vulnerability: The objdump tool unconditionally attempted to disassemble .debug_* sections, including non-executable data sections.
RISC-V Specific Crash: Certain debug section formats (particularly compressed debug info) triggered memory corruption when interpreted as code.
Affected Versions

✔️ Confirmed in 2025.02 and 2025.10 releases
❌ Fixed in upstream post-2025.10 via patch series:
[PATCH v3 0/2] RISC-V: Fix abort when displaying data and add test
Workarounds
Exclude Debug Sections:

<BASH>
riscv64-unknown-elf-objdump -D -j .text -j .data firmware.elf
Strip Debug Info First:
<BASH>
riscv64-unknown-elf-strip --strip-debug firmware.elf
riscv64-unknown-elf-objdump -D firmware.elf
Use readelf for Inspection (for debug section analysis):
<BASH>
riscv64-unknown-elf-readelf -a firmware.elf

Technical Background
The upstream fix involved:

Section Type Checking: Skipping disassembly for non-code sections (.debug_*, .comment, etc.)
Enhanced Error Handling: Graceful fallback when encountering malformed debug data
Test Coverage: Added regression tests for mixed code/data ELFs
Expected Error-free Output (Post-fix):

<TEXT>
Disassembly of section .text:
00010000 <_start>:
   10000:	00000513          	li	a0,0
   10004:	00008067          	ret

Disassembly of section .debug_info: (skipped, not executable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P:2Low impact/importance bugbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions