bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/28233] New: [gas, --gstabs] Generate stabs more similar to gcc


From: vries at gcc dot gnu.org
Subject: [Bug gas/28233] New: [gas, --gstabs] Generate stabs more similar to gcc
Date: Mon, 16 Aug 2021 07:20:44 +0000

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

            Bug ID: 28233
           Summary: [gas, --gstabs] Generate stabs more similar to gcc
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider test-case ./src/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c.

When compiled with gcc -gstabs:
...
$ gcc -gstabs -c -fno-PIE -no-pie -o dw2-ranges3.o
./src/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c
...
we have (using objdump -G, filtering out LSYM entries 2-26 for brevity):
...
Contents of .stab section:

Symnum n_type n_othr n_desc n_value  n_strx String

-1     HdrSym 0      31     00000000000003ab 1     
0      SO     0      2      0000000000000000 16    
./src/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c
1      OPT    0      0      0000000000000000 62     gcc2_compiled.
  ...
27     FUN    0      0      0000000000000000 925    main3:F(0,25)
28     SLINE  0      19     0000000000000000 0      
29     SLINE  0      20     0000000000000004 0      
30     SO     0      0      0000000000000000 0      
$
...

Now consider generating stabs using gas --gstabs instead:
...
$ gcc -c -fno-PIE -no-pie -o dw2-ranges3.o
./src/gdb/testsuite/gdb.dwarf2/dw2-ranges-3.c -Wa,--gstabs
...

Instead we have:
...
Contents of .stab section:

Symnum n_type n_othr n_desc n_value  n_strx String

-1     HdrSym 0      6      0000000000000021 1     
0      SO     0      0      0000000000000000 17     /tmp/ccO3O0w5.s
1      SLINE  0      8      0000000000000000 0      
2      SLINE  0      11     0000000000000000 0      
3      SLINE  0      13     0000000000000000 0      
4      SLINE  0      14     0000000000000000 0      
5      SLINE  0      16     0000000000000000 0      
...

There are two differences (not counting the OPT entry) in the generated
entries:
- no FUN entry
- no terminating SO entry

I don't know enough about stabs to say whether this is valid or not (and if
not, if it's caused by a problem with the input).

What I do know is that these two differences trigger two different problems in
gdb:
- the FUN entry is required to support stabs+PIE (PR12497)
- terminating SO entry is required to get a correct address table (PR28221)

I've submitted a patch for the first PR, but reaction was not positive.  So I
wonder, perhaps it's a good idea to make gas generate stabs more similar to
what gcc emits.

The missing FUN entry problem can be fixed by manually adding a .func
directive.  I've wondered whether we could get the same effect by interpreting
".type     main3, @function" which is present in the generated .s file.

I've found no similar workaround for the missing SO entry problem, so I wrote a
patch for this.

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