public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything
@ 2010-03-23 18:42 lat at cern dot ch
2010-03-23 18:48 ` [Bug c++/43498] " jakub at gcc dot gnu dot org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: lat at cern dot ch @ 2010-03-23 18:42 UTC (permalink / raw)
To: gcc-bugs
I have compiled various C and C++ source files in attempt to generate async
unwind tables for better stack trace accuracy with asynchronous signals, adding
-fasynchronous-unwind-tables to compile options. I have so far been completely
unable to come up with any example where the option would produce any
difference in the generated binaries, and unwind tables (.eh_frame)
specifically.
For example please compile the following source file foo.cc:
struct A1 { virtual ~A1(); virtual double foo(void); };
struct A2 { virtual ~A2(); virtual double bar(void); };
struct B : A1, A2 { ~B(); virtual double foo(void); };
A1::~A1() {}
double A1::foo() { return 3.14; }
A2::~A2() {}
double A2::bar() { return 2.17; }
B::~B() {}
double B::foo() { return A1::foo() + A2::bar(); }
with and without -fasynchronous-unwind-tables:
c++ -fasynchronous-unwind-tables -O2 -fPIC -W -Wall -shared -o libfooa.so
foo.cc
c++ -O2 -fPIC -W -Wall -shared -o libfoob.so foo.cc
then compare unwind information:
for x in a b; do
objdump -w -x -d libfoo$x.so > foo$x-disasm.txt
readelf -Wa --debug=frames libfoo$x.so > foo$x-info.txt
done
diff -u foo{a,b}-disasm.txt
--- fooa-disasm.txt 2010-03-23 18:28:46.000000000 +0100
+++ foob-disasm.txt 2010-03-23 18:28:46.000000000 +0100
@@ -1,6 +1,6 @@
-libfooa.so: file format elf64-x86-64
-libfooa.so
+libfoob.so: file format elf64-x86-64
+libfoob.so
architecture: i386:x86-64, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x0000000000000c90
diff -u foo{a,b}-info.txt
(no output)
note that there is basically no difference at all, and there is
no unwind info for the thunks, disassembly has:
0000000000000df0 <_ZN1B3fooEv>:
df0: 53 push %rbx
df1: 48 89 fb mov %rdi,%rbx
df4: 48 83 c3 08 add $0x8,%rbx
df8: 48 83 ec 10 sub $0x10,%rsp
dfc: e8 7f fe ff ff callq c80 <_ZN2A13fooEv@plt>
e01: 48 89 df mov %rbx,%rdi
e04: f2 0f 11 44 24 08 movsd %xmm0,0x8(%rsp)
e0a: e8 41 fe ff ff callq c50 <_ZN2A23barEv@plt>
e0f: f2 0f 58 44 24 08 addsd 0x8(%rsp),%xmm0
e15: f2 0f 11 44 24 08 movsd %xmm0,0x8(%rsp)
e1b: 48 83 c4 10 add $0x10,%rsp
e1f: 5b pop %rbx
e20: c3 retq
e21: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 nopw
%cs:0x0(%rax,%rax,1)
0000000000000e30 <_ZThn8_N1BD1Ev>:
e30: 48 83 c7 f8 add $0xfffffffffffffff8,%rdi
e34: eb 0a jmp e40 <_ZN1BD1Ev>
e36: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0(%rax,%rax,1)
0000000000000e40 <_ZN1BD1Ev>:
e40: 48 89 6c 24 f8 mov %rbp,-0x8(%rsp)
e45: 48 89 5c 24 f0 mov %rbx,-0x10(%rsp)
e4a: 48 83 ec 18 sub $0x18,%rsp
[snip]
and unwind info has a gap at 0xe30, the thunk, and does not describe
the epilogue at address 0xe1b:
000000b0 0000001c 000000b4 FDE cie=00000000 pc=00000df0..00000e21
Augmentation data: 00 00 00 00
DW_CFA_advance_loc: 1 to 00000df1
DW_CFA_def_cfa_offset: 16
DW_CFA_offset: r3 (rbx) at cfa-16
DW_CFA_advance_loc: 11 to 00000dfc
DW_CFA_def_cfa_offset: 32
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
000000d0 0000001c 000000d4 FDE cie=00000000 pc=00000e40..00000e99
Augmentation data: 83 00 00 00
DW_CFA_advance_loc: 14 to 00000e4e
DW_CFA_def_cfa_offset: 32
DW_CFA_offset: r3 (rbx) at cfa-24
DW_CFA_offset: r6 (rbp) at cfa-16
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
I believe the part about missing unwind info for epilogues is a known problem
and patches have been committed to the head. Similarly lack of unwind
information for global ctors and dtors seems to be known. But how about the
missing unwind information for the thunks?
More exactly where should I expect the -fasynchronous-unwind-tables option to
make a difference? Any example code / output available?
The compiler is GCC 4.3.4 with binutils 2.19.1 on RHEL5-derived system.
$ c++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure
--prefix=/build/3jm/slc5_amd64_gcc434/external/gcc/4.3.4
--enable-languages=c,c++,fortran
--with-gmp=/build/3jm/slc5_amd64_gcc434/external/gcc/4.3.4/tmp/gmp
--with-mpfr=/build/3jm/slc5_amd64_gcc434/external/gcc/4.3.4/tmp/mpfr
--enable-shared
Thread model: posix
gcc version 4.3.4 (GCC)
$ as -v /dev/null
GNU assembler version 2.19.1 (x86_64-unknown-linux-gnu) using BFD version (GNU
Binutils) 2.19.1
$ ld -v
GNU ld (GNU Binutils) 2.19.1
--
Summary: -fasynchronous-unwind-tables does not seem to do
anything
Product: gcc
Version: 4.3.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lat at cern dot ch
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/43498] -fasynchronous-unwind-tables does not seem to do anything
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
@ 2010-03-23 18:48 ` jakub at gcc dot gnu dot org
2010-03-23 18:52 ` lat at cern dot ch
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-23 18:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2010-03-23 18:47 -------
-fasynchronous-unwind-tables is the default on x86_64.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/43498] -fasynchronous-unwind-tables does not seem to do anything
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
2010-03-23 18:48 ` [Bug c++/43498] " jakub at gcc dot gnu dot org
@ 2010-03-23 18:52 ` lat at cern dot ch
2010-03-23 18:54 ` lat at cern dot ch
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lat at cern dot ch @ 2010-03-23 18:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from lat at cern dot ch 2010-03-23 18:52 -------
Created an attachment (id=20174)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20174&action=view)
Random C source file for testing
Random C source file for additional testing. Compile on Linux with and without
-fasynchronous-unwind-tables, with normal compile "gcc -g -std=gnu99 -W -Wall
-O2 islocal.c -o islocal". No difference in "readelf --debug=frames" output.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/43498] -fasynchronous-unwind-tables does not seem to do anything
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
2010-03-23 18:48 ` [Bug c++/43498] " jakub at gcc dot gnu dot org
2010-03-23 18:52 ` lat at cern dot ch
@ 2010-03-23 18:54 ` lat at cern dot ch
2010-03-23 18:56 ` [Bug middle-end/43498] " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lat at cern dot ch @ 2010-03-23 18:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from lat at cern dot ch 2010-03-23 18:54 -------
Ah, that would explain it. Does it mean that all omissions and inaccuracies in
unwind information are bugs? Like the lack of unwind info for thunks?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/43498] -fasynchronous-unwind-tables does not seem to do anything
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (2 preceding siblings ...)
2010-03-23 18:54 ` lat at cern dot ch
@ 2010-03-23 18:56 ` pinskia at gcc dot gnu dot org
2010-03-23 18:58 ` lat at cern dot ch
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-23 18:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2010-03-23 18:56 -------
(In reply to comment #3)
> Ah, that would explain it. Does it mean that all omissions and inaccuracies in
> unwind information are bugs? Like the lack of unwind info for thunks?
yes thunks should have unwind tables also.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |middle-end
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/43498] -fasynchronous-unwind-tables does not seem to do anything
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (3 preceding siblings ...)
2010-03-23 18:56 ` [Bug middle-end/43498] " pinskia at gcc dot gnu dot org
@ 2010-03-23 18:58 ` lat at cern dot ch
2010-03-23 19:04 ` [Bug middle-end/43498] No unwind info for thunks even with -fasynchronous-unwind-tables lat at cern dot ch
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lat at cern dot ch @ 2010-03-23 18:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from lat at cern dot ch 2010-03-23 18:58 -------
OK, reopening bug then.
--
lat at cern dot ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (4 preceding siblings ...)
2010-03-23 18:58 ` lat at cern dot ch
@ 2010-03-23 19:04 ` lat at cern dot ch
2010-03-23 19:13 ` [Bug target/43498] " pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lat at cern dot ch @ 2010-03-23 19:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from lat at cern dot ch 2010-03-23 19:04 -------
Changing subject to be more descriptive of the actual bug.
--
lat at cern dot ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|-fasynchronous-unwind-tables|No unwind info for thunks
|does not seem to do anything|even with -fasynchronous-
| |unwind-tables
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (5 preceding siblings ...)
2010-03-23 19:04 ` [Bug middle-end/43498] No unwind info for thunks even with -fasynchronous-unwind-tables lat at cern dot ch
@ 2010-03-23 19:13 ` pinskia at gcc dot gnu dot org
2010-03-23 22:10 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-23 19:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2010-03-23 19:13 -------
The x86-64 target writes directly out asm rather than going through some RTL
code which causes unwind tables not to be written out for the thunks.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|middle-end |target
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-03-23 19:13:40
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (6 preceding siblings ...)
2010-03-23 19:13 ` [Bug target/43498] " pinskia at gcc dot gnu dot org
@ 2010-03-23 22:10 ` jakub at gcc dot gnu dot org
2010-03-24 10:15 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-23 22:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jakub at gcc dot gnu dot org 2010-03-23 22:10 -------
At least when using CFI asm this is solvable easily, see how I've changed i386
PIC setup generation. Without CFI asm it would be much harder though.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (7 preceding siblings ...)
2010-03-23 22:10 ` jakub at gcc dot gnu dot org
@ 2010-03-24 10:15 ` rguenth at gcc dot gnu dot org
2010-03-24 12:00 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-24 10:15 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (8 preceding siblings ...)
2010-03-24 10:15 ` rguenth at gcc dot gnu dot org
@ 2010-03-24 12:00 ` jakub at gcc dot gnu dot org
2010-03-24 12:06 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-24 12:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2010-03-24 11:59 -------
Actually, as the thunks are emitted before .eh_frame, it is much easier.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2010-03-23 19:13:40 |2010-03-24 11:59:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (9 preceding siblings ...)
2010-03-24 12:00 ` jakub at gcc dot gnu dot org
@ 2010-03-24 12:06 ` jakub at gcc dot gnu dot org
2010-03-24 20:31 ` jakub at gcc dot gnu dot org
2010-03-24 20:53 ` jakub at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-24 12:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jakub at gcc dot gnu dot org 2010-03-24 12:06 -------
Created an attachment (id=20182)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20182&action=view)
gcc45-pr43498.patch
Patch to emit unwind info for thunks on x86, x86-64 and s390{,x}.
ppc/ppc64, sparc/sparc64 and ia64 (from arches that I care at least a little
bit about) should be outputting unwind info already before this change.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (10 preceding siblings ...)
2010-03-24 12:06 ` jakub at gcc dot gnu dot org
@ 2010-03-24 20:31 ` jakub at gcc dot gnu dot org
2010-03-24 20:53 ` jakub at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-24 20:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jakub at gcc dot gnu dot org 2010-03-24 20:31 -------
Subject: Bug 43498
Author: jakub
Date: Wed Mar 24 20:31:09 2010
New Revision: 157706
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157706
Log:
PR target/43498
* config/i386/i386.c (x86_output_mi_thunk): Call final_start_function
at the beginning and final_end_function at the end.
* config/s390/s390.c (s390_output_mi_thunk): Likewise.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/config/s390/s390.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/43498] No unwind info for thunks even with -fasynchronous-unwind-tables
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
` (11 preceding siblings ...)
2010-03-24 20:31 ` jakub at gcc dot gnu dot org
@ 2010-03-24 20:53 ` jakub at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-24 20:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jakub at gcc dot gnu dot org 2010-03-24 20:52 -------
Should be fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43498
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-03-24 20:53 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-23 18:42 [Bug c++/43498] New: -fasynchronous-unwind-tables does not seem to do anything lat at cern dot ch
2010-03-23 18:48 ` [Bug c++/43498] " jakub at gcc dot gnu dot org
2010-03-23 18:52 ` lat at cern dot ch
2010-03-23 18:54 ` lat at cern dot ch
2010-03-23 18:56 ` [Bug middle-end/43498] " pinskia at gcc dot gnu dot org
2010-03-23 18:58 ` lat at cern dot ch
2010-03-23 19:04 ` [Bug middle-end/43498] No unwind info for thunks even with -fasynchronous-unwind-tables lat at cern dot ch
2010-03-23 19:13 ` [Bug target/43498] " pinskia at gcc dot gnu dot org
2010-03-23 22:10 ` jakub at gcc dot gnu dot org
2010-03-24 10:15 ` rguenth at gcc dot gnu dot org
2010-03-24 12:00 ` jakub at gcc dot gnu dot org
2010-03-24 12:06 ` jakub at gcc dot gnu dot org
2010-03-24 20:31 ` jakub at gcc dot gnu dot org
2010-03-24 20:53 ` jakub at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).