public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
@ 2010-09-27 11:10 amodra at gmail dot com
2010-09-27 14:02 ` [Bug target/45807] " amodra at gmail dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: amodra at gmail dot com @ 2010-09-27 11:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
Summary: Lying eh_frame r2 save info causes crashes with static
libgcc_eh and libstdc++
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: amodra@gmail.com
Created attachment 21893
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=21893
testcase from Allan Pratt <akpratt@netflix.com>
In the eh_frame description for _Unwind_Resume_or_Rethrow, I see
000012a0 0000007c 000012a4 FDE cie=00000000 pc=100712c0..100714f8
DW_CFA_advance_loc: 4 to 100712c4
DW_CFA_def_cfa_offset: 3216
DW_CFA_advance_loc: 164 to 10071368
DW_CFA_offset_extended_sf: r2 at cfa+40
[snip]
but, r2 is not saved by this function, at least, not before
_Unwind_RaiseException is called. So the lie that r2 is saved at
cfa+40 once we are past 10071368 can cause the unwinder to return a bad
value for r2 when unwinding through _Unwind_Resume_or_Rethrow from
_Unwind_RaiseException. r2 won't be saved if _Unwind_Resume_of_Rethrow is
called statically from the same toc group, but this bug is often covered by the
fact that a previous call into exception handling functions has written the
correct r2 value to the stack.
00000000100712c0 <._Unwind_Resume_or_Rethrow>:
100712c0: f8 21 f3 71 stdu r1,-3216(r1)
100712c4: 7d 80 00 26 mfcr r12
100712c8: 7c 08 02 a6 mflr r0
100712cc: d9 c1 0c 00 stfd f14,3072(r1)
100712d0: d9 e1 0c 08 stfd f15,3080(r1)
100712d4: f8 01 0c a0 std r0,3232(r1)
100712d8: da 01 0c 10 stfd f16,3088(r1)
100712dc: da 21 0c 18 stfd f17,3096(r1)
100712e0: da 41 0c 20 stfd f18,3104(r1)
100712e4: da 61 0c 28 stfd f19,3112(r1)
100712e8: da 81 0c 30 stfd f20,3120(r1)
100712ec: da a1 0c 38 stfd f21,3128(r1)
100712f0: da c1 0c 40 stfd f22,3136(r1)
100712f4: da e1 0c 48 stfd f23,3144(r1)
100712f8: db 01 0c 50 stfd f24,3152(r1)
100712fc: db 21 0c 58 stfd f25,3160(r1)
10071300: db 41 0c 60 stfd f26,3168(r1)
10071304: db 61 0c 68 stfd f27,3176(r1)
10071308: db 81 0c 70 stfd f28,3184(r1)
1007130c: db a1 0c 78 stfd f29,3192(r1)
10071310: db c1 0c 80 stfd f30,3200(r1)
10071314: db e1 0c 88 stfd f31,3208(r1)
10071318: f9 c1 0b 70 std r14,2928(r1)
1007131c: f9 e1 0b 78 std r15,2936(r1)
10071320: fa 01 0b 80 std r16,2944(r1)
10071324: fa 21 0b 88 std r17,2952(r1)
10071328: fa 41 0b 90 std r18,2960(r1)
1007132c: fa 61 0b 98 std r19,2968(r1)
10071330: fa 81 0b a0 std r20,2976(r1)
10071334: fa a1 0b a8 std r21,2984(r1)
10071338: fa c1 0b b0 std r22,2992(r1)
1007133c: fa e1 0b b8 std r23,3000(r1)
10071340: fb 01 0b c0 std r24,3008(r1)
10071344: fb 21 0b c8 std r25,3016(r1)
10071348: fb 41 0b d0 std r26,3024(r1)
1007134c: fb 61 0b d8 std r27,3032(r1)
10071350: fb 81 0b e0 std r28,3040(r1)
10071354: fb a1 0b e8 std r29,3048(r1)
10071358: fb c1 0b f0 std r30,3056(r1)
1007135c: fb e1 0b f8 std r31,3064(r1)
10071360: e8 03 00 10 ld r0,16(r3)
10071364: 7c 7f 1b 78 mr r31,r3
10071368: 2f a0 00 00 cmpdi cr7,r0,0
1007136c: f8 61 0b 50 std r3,2896(r1)
10071370: f8 81 0b 58 std r4,2904(r1)
10071374: f8 a1 0b 60 std r5,2912(r1)
10071378: f8 c1 0b 68 std r6,2920(r1)
1007137c: 91 81 0c 98 stw r12,3224(r1)
10071380: 40 9e 00 e0 bne- cr7,10071460
<._Unwind_Resume_or_Rethrow+0x1a0>
10071384: 4b ff f8 0d bl 10070b90 <._Unwind_RaiseException>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/45807] Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
@ 2010-09-27 14:02 ` amodra at gmail dot com
2010-09-28 17:14 ` amodra at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: amodra at gmail dot com @ 2010-09-27 14:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2010.09.27 10:27:49
date| |
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/45807] Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
2010-09-27 14:02 ` [Bug target/45807] " amodra at gmail dot com
@ 2010-09-28 17:14 ` amodra at gcc dot gnu.org
2010-09-30 21:21 ` meissner at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: amodra at gcc dot gnu.org @ 2010-09-28 17:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
--- Comment #2 from Alan Modra <amodra at gcc dot gnu.org> 2010-09-28 15:25:08 UTC ---
Author: amodra
Date: Tue Sep 28 15:25:03 2010
New Revision: 164685
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164685
Log:
PR target/45807
* config/rs6000/aix.h (SETUP_FRAME_ADDRESSES): Delete.
* config/rs6000/linux64.h (SETUP_FRAME_ADDRESSES): Delete.
* config/rs6000/rs6000-protos.h (rs6000_aix_emit_builtin_unwind_init):
Delete.
* config/rs6000/rs6000.c (rs6000_aix_emit_builtin_unwind_init): Delete.
(rs6000_emit_prologue): Don't just create frame save info for r2,
actually save r2.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/aix.h
trunk/gcc/config/rs6000/linux64.h
trunk/gcc/config/rs6000/rs6000-protos.h
trunk/gcc/config/rs6000/rs6000.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/45807] Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
2010-09-27 14:02 ` [Bug target/45807] " amodra at gmail dot com
2010-09-28 17:14 ` amodra at gcc dot gnu.org
@ 2010-09-30 21:21 ` meissner at gcc dot gnu.org
2010-10-01 1:52 ` meissner at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2010-09-30 21:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
Michael Meissner <meissner at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |meissner at gcc dot gnu.org
--- Comment #3 from Michael Meissner <meissner at gcc dot gnu.org> 2010-09-30 19:04:09 UTC ---
This breaks builds where the default is 64-bit, i.e. --with-cpu=default64
With --with-cpu=default64, it fails in building libgcc.a:
/home/meissner/fsf-install-ppc64/binutils-current/bin/ranlib libgcc.a
/home/meissner/fsf-build-ppc64/trunk/./gcc/xgcc
-B/home/meissner/fsf-build-ppc64/trunk/./gcc/
-B/home/meissner/fsf-install-ppc64/trunk/powerpc64-linux/bin/
-B/home/meissner/fsf-install-ppc64/trunk/powerpc64-linux/lib/ -isystem
/home/meissner/fsf-install-ppc64/trunk/powerpc64-linux/include -isystem
/home/meissner/fsf-install-ppc64/trunk/powerpc64-linux/sys-include -g -O2
-O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC
-mno-minimal-toc -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-mlong-double-128 -I. -I. -I../.././gcc -I/home/meissner/fsf-src/trunk/libgcc
-I/home/meissner/fsf-src/trunk/libgcc/.
-I/home/meissner/fsf-src/trunk/libgcc/../gcc
-I/home/meissner/fsf-src/trunk/libgcc/../include
-I/home/meissner/fsf-src/trunk/libgcc/../libdecnumber/dpd
-I/home/meissner/fsf-src/trunk/libgcc/../libdecnumber -DHAVE_CC_TLS -o
unwind-dw2.o -MT unwind-dw2.o -MD -MP -MF unwind-dw2.dep -fexceptions -c
/home/meissner/fsf-src/trunk/libgcc/../gcc/unwind-dw2.c -fvisibility=hidden
-DHIDE_EXPORTS
In file included from
/home/meissner/fsf-src/trunk/libgcc/../gcc/unwind-dw2.c:1582:0:
/home/meissner/fsf-src/trunk/libgcc/../gcc/unwind.inc: In function
‘_Unwind_RaiseException’:
/home/meissner/fsf-src/trunk/libgcc/../gcc/unwind.inc:136:1: error: insn does
not satisfy its constraints:
(insn 217 216 218 2 (set (reg:SI 11 11)
(xor:SI (reg:SI 11 11)
(const_int 3896573952 [0xe8410000])))
/home/meissner/fsf-src/trunk/libgcc/../gcc/unwind.inc:83 158
{*boolsi3_internal1}
(nil))
/home/meissner/fsf-src/trunk/libgcc/../gcc/unwind.inc:136:1: internal compiler
error: in copyprop_hardreg_forward_1, at regcprop.c:768
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [unwind-dw2.o] Error 1
make[2]: Leaving directory
`/home/meissner/fsf-build-ppc64/trunk/powerpc64-linux/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/meissner/fsf-build-ppc64/trunk'
make: *** [all] Error 2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/45807] Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
` (2 preceding siblings ...)
2010-09-30 21:21 ` meissner at gcc dot gnu.org
@ 2010-10-01 1:52 ` meissner at gcc dot gnu.org
2010-10-01 3:24 ` amodra at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2010-10-01 1:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
--- Comment #5 from Michael Meissner <meissner at gcc dot gnu.org> 2010-10-01 01:51:43 UTC ---
This patch fixes the problem with linux ppc64 builds when the compiler is
defaulting to 64-bit cpus.
This patch is ok to check in.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/45807] Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
` (3 preceding siblings ...)
2010-10-01 1:52 ` meissner at gcc dot gnu.org
@ 2010-10-01 3:24 ` amodra at gcc dot gnu.org
2010-11-17 6:15 ` amodra at gcc dot gnu.org
2011-11-07 8:07 ` amodra at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: amodra at gcc dot gnu.org @ 2010-10-01 3:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
--- Comment #6 from Alan Modra <amodra at gcc dot gnu.org> 2010-10-01 03:23:50 UTC ---
Author: amodra
Date: Fri Oct 1 03:23:46 2010
New Revision: 164825
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164825
Log:
PR target/45807
* config/rs6000/rs6000.c (rs6000_emit_prologue): Properly sign
extend toc_restore_insn.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/45807] Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
` (4 preceding siblings ...)
2010-10-01 3:24 ` amodra at gcc dot gnu.org
@ 2010-11-17 6:15 ` amodra at gcc dot gnu.org
2011-11-07 8:07 ` amodra at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: amodra at gcc dot gnu.org @ 2010-11-17 6:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
--- Comment #7 from Alan Modra <amodra at gcc dot gnu.org> 2010-11-17 06:09:58 UTC ---
Author: amodra
Date: Wed Nov 17 06:09:53 2010
New Revision: 166857
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166857
Log:
PR target/45807
Backport r164685,r164825,r165101
* config/rs6000/aix.h (SETUP_FRAME_ADDRESSES): Delete.
* config/rs6000/linux64.h (SETUP_FRAME_ADDRESSES): Delete.
* config/rs6000/rs6000-protos.h (rs6000_aix_emit_builtin_unwind_init):
Delete.
* config/rs6000/rs6000.c (rs6000_aix_emit_builtin_unwind_init): Delete.
(rs6000_emit_prologue): Don't just create frame save info for r2,
actually save r2.
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/config/rs6000/aix.h
branches/gcc-4_5-branch/gcc/config/rs6000/linux64.h
branches/gcc-4_5-branch/gcc/config/rs6000/rs6000-protos.h
branches/gcc-4_5-branch/gcc/config/rs6000/rs6000.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/45807] Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
` (5 preceding siblings ...)
2010-11-17 6:15 ` amodra at gcc dot gnu.org
@ 2011-11-07 8:07 ` amodra at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: amodra at gmail dot com @ 2011-11-07 8:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45807
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from Alan Modra <amodra at gmail dot com> 2011-11-07 08:07:10 UTC ---
fixed
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-11-07 8:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-27 11:10 [Bug target/45807] New: Lying eh_frame r2 save info causes crashes with static libgcc_eh and libstdc++ amodra at gmail dot com
2010-09-27 14:02 ` [Bug target/45807] " amodra at gmail dot com
2010-09-28 17:14 ` amodra at gcc dot gnu.org
2010-09-30 21:21 ` meissner at gcc dot gnu.org
2010-10-01 1:52 ` meissner at gcc dot gnu.org
2010-10-01 3:24 ` amodra at gcc dot gnu.org
2010-11-17 6:15 ` amodra at gcc dot gnu.org
2011-11-07 8:07 ` amodra at gmail dot com
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).