bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/27155] New: objcopy --only-keep-debug should strip .debug_


From: mliska at suse dot cz
Subject: [Bug binutils/27155] New: objcopy --only-keep-debug should strip .debug_info symbols
Date: Thu, 07 Jan 2021 15:30:15 +0000

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

            Bug ID: 27155
           Summary: objcopy --only-keep-debug should strip .debug_info
                    symbols
           Product: binutils
           Version: 2.35.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: mliska at suse dot cz
                CC: mark at klomp dot org
  Target Milestone: ---

Let's consider the following example:

$ cat foo.c
int foo(void)
{
  return 123;
}

$ gcc foo.c -O2 -g -flto -shared -o libfoo.so

Note that LTO uses artificial debug info symbols for early LTO debug info.

$ readelf -s --wide libfoo.so | grep foo.c
    60: 0000000000000067     0 NOTYPE  LOCAL  DEFAULT   25 foo.c.cf7807ca

as seen the symbol lives in .debug_info section:

$ readelf -S --wide libfoo.so | grep 25
  [25] .debug_info       PROGBITS        0000000000000000 003130 0000ba 00     
0   0  1

Now let's create a separated debug info and strip the original library:

$ objcopy --only-keep-debug  libfoo.so debug.so
$ strip --strip-debug libfoo.so

$ readelf -s --wide debug.so | grep foo.c
    60: 0000000000000067     0 NOTYPE  LOCAL  DEFAULT   25 foo.c.cf7807ca

and now we have problem as the original libfoo.so section index 25 points to
something different:

$ readelf -S --wide libfoo.so | grep '\[25\]'
  [25] .strtab           STRTAB          0000000000000000 003498 000154 00     
0   0  1

My suggestion would be to strip such symbols. Perf is unhappy about such
symbols as one can easily get out of sections
in the original ELF file.

Original bug report:
https://bugzilla.suse.com/show_bug.cgi?id=1180610

@Mark: Can you please help me with that?

-- 
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]