[Bug debugedit/33789] debugedit corrupts RISC-V object files

mark at klomp dot org sourceware-bugzilla@sourceware.org
Fri Mar 6 15:36:01 GMT 2026


https://sourceware.org/bugzilla/show_bug.cgi?id=33789

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #15 from Mark Wielaard <mark at klomp dot org> ---
Finally pushed this to main:

commit 25dddd8e479b3bb54d50f55de6de45b8473bf8dc
Author: Mark Wielaard <mark@klomp.org>
Date:   Wed Jan 21 13:16:45 2026 +0100

    debugedit: Update relocation addend or symbol value for debug strings

    RISC-V (ET_REL) object files don't use STT_SECTION symbols to relocate
    against sections containing string pools, but creates local symbols to
    each string with a relocation addend of zero. Detect this and update
    the symbol st_value instead of the r_addend in that case.

            * tools/debugedit.c (setup_relbuf): Check symbol is either
            STT_SECTION with st_value zero or not STT_SECTION with
            r_addend zero. Use r_addend in the first case, st_value in
            the second.
            (update_rela_data): Update either r_added if relocation
            symbol is STT_SECTION, or st_value if the symbol is not.

    https://sourceware.org/bugzilla/show_bug.cgi?id=33789

Thanks for all the testing.

The find-debuginfo --check-elf idea was moved to its own bug (and patch):
https://sourceware.org/bugzilla/show_bug.cgi?id=33827
That also allows us to have a good testcase for this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Debugedit mailing list