[Bug libdw/27805] libdwfl: Unable to extract source line information for RISC-V binary

wilson at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Wed May 5 15:42:45 GMT 2021


--- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> ---
My first thought was linkonce/comdat, but that is used by C++ and would have
shown up before.  So that leaves -gc-sections.  I can reproduce with a simple

rohan:2010$ cat tmp.c
extern int sub1 (int);
extern int sub2 (int);
extern int sub3 (int);
extern int sub4 (int);
int main (void) { return sub2 (sub4 (0)); }
rohan:2011$ cat tmp2.c
int sub1 (int i) {return i + 10; }
int sub2 (int i) {return i + 20; }
int sub3 (int i) {return i - 10; }
int sub4 (int i) {return i - 20; }
rohan:2012$ riscv32-unknown-elf-gcc -O2 tmp.c tmp2.c -ffunction-sections
-Wl,-gc-sections -g
rohan:2013$ readelf -wr a.out
Contents of the .debug_aranges section:

  Length:                   28
  Version:                  2
  Offset into .debug_info:  0x0
  Pointer Size:             4
  Segment Size:             0

    Address    Length
    00010074 0000000e 
    00000000 00000000 
  Length:                   52
  Version:                  2
  Offset into .debug_info:  0x7c
  Pointer Size:             4
  Segment Size:             0

    Address    Length
    00000000 00000000 
    00010114 00000004 
    00000000 00000000 
    00010118 00000004 
    00000000 00000000 


I get the same result with an x86_64-linux compiler.  And I get the same result
with -gdwarf-5.

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

More information about the Elfutils-devel mailing list