bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/29532] /usr/lib/debug/usr/lib/crti.o.debug: file format no


From: nickc at redhat dot com
Subject: [Bug binutils/29532] /usr/lib/debug/usr/lib/crti.o.debug: file format not recognized
Date: Mon, 05 Sep 2022 14:58:53 +0000

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

--- Comment #7 from Nick Clifton <nickc at redhat dot com> ---
Created attachment 14316
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14316&action=edit
Proposed Patch

Hi Alex,

  OK, so knowing that this is a problem for GDB as well makes a difference.

  I have uploaded a patch which presents one way of fixing the problem.  It
  changes objcopy --only-keep-debug behaviour so that it preserves the contents
  of group sections.  With this done, the debug info file now looks like a
  normal ELF file to the BFD library (and by extension GDB and objdump):

    % objcopy --only-keep-debug crti.o crti.o.deb
    % objdump -f crti.o.deb
    crti.o.deb:     file format elf32-i386
    architecture: i386, flags 0x00000010:
    HAS_SYMS
    start address 0x00000000

    % objcopy --add-gnu-debuglink=crti.o.deb --strip-debug crti.o
crti.o.stripped
    % gdb crti.o.stripped
    [...]
    Reading symbols from crti.o.stripped...
    Reading symbols from
/home/nickc/work/builds/binutils/current/x86_64-pc-linux-gnu/tests/crti.o.deb...
    (No debugging symbols found in
/home/nickc/work/builds/binutils/current/x86_64-pc-linux-gnu/tests/crti.o.deb)
    (gdb)

The problem with this approach is that debug info files that contain
section groups will have to be recreated in order to take advantage of
the fix.  Ie the BFD library is still going to complain about the original
version of crti.o.debug.  So the patch *also* changes the BFD library.  The
library will still issue the warning messages about the group section being
empty, but it will now allow the processing to continue.  This means that
"objdump -f crti.o.debug" will now work.  So will gdb, providing that it has
been rebuilt with the fixed BFD library.

Please give this patch a try and let me know what you think.

Cheers
  Nick

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]