From patchwork Wed Apr 6 11:12:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 606945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qg33P3mMhz9t4T for ; Wed, 6 Apr 2016 21:12:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=XtgGG3QA; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=QwUu0lGb3ZVxOMfRIU9nB123c+7gx40sZndnd6CXxymI1R7j8N y5AcBO7f2JAFCTKogMZboz4rR5RQhhTrGpPJ2AZ/Ikj7/GR98LAY0Hjy+3yXYb2k mP07wbmMjrpa+pG5BEqGj9MARpKjGFIY5I0HDLjbBTJZy2T8Ii5FhiFwc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=fgy0RinEmZoTumH1ZRiyDUzB1KA=; b=XtgGG3QAMC0m7laGJZmd NsSUeas943BmN8CJcqpApMce+Wv3CBtljAao0hG9n4lgo0uS6M80M2f9rU3Yl9x8 B9FNENTai5fp9mb9+4qkIcBYmIJKQCgzCQPlh26dG4tD0xZGgs2TKdWLo0lXDOZl KWnBkNjBlK1DiRzJvosY/dU= Received: (qmail 101567 invoked by alias); 6 Apr 2016 11:12:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101552 invoked by uid 89); 6 Apr 2016 11:12:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=gotten, Makefileam, Makefile.am, UD:am X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Apr 2016 11:12:14 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 3AC5BB48; Wed, 6 Apr 2016 13:12:12 +0200 (CEST) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jNP6bqGty+rr; Wed, 6 Apr 2016 13:12:09 +0200 (CEST) Received: from fuego.CeBiTec.Uni-Bielefeld.DE (p5DCE082A.dip0.t-ipconnect.de [93.206.8.42]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id F1504B47; Wed, 6 Apr 2016 13:12:08 +0200 (CEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Ilya Verbin , Jakub Jelinek Subject: Compile libcilkrts with -funwind-tables (PR target/60290) Date: Wed, 06 Apr 2016 13:12:07 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes I've finally gotten around to analyzing this testsuite failure on 32-bit Solaris/x86: FAIL: g++.dg/cilk-plus/CK/catch_exc.cc -O1 -fcilkplus execution test FAIL: g++.dg/cilk-plus/CK/catch_exc.cc -O3 -fcilkplus execution test FAIL: g++.dg/cilk-plus/CK/catch_exc.cc -g -O2 -fcilkplus execution test FAIL: g++.dg/cilk-plus/CK/catch_exc.cc -g -fcilkplus execution test The testcase aborts like this: Thread 2 received signal SIGABRT, Aborted. [Switching to Thread 1 (LWP 1)] 0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1 (gdb) where #0 0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1 #1 0xfe3b2d4f in thr_kill () from /lib/libc.so.1 #2 0xfe2f64da in raise () from /lib/libc.so.1 #3 0xfe2c93ee in abort () from /lib/libc.so.1 #4 0xfe525b37 in _Unwind_Resume (exc=0x80a75a0) at /vol/gcc/src/hg/trunk/local/libgcc/unwind.inc:234 #5 0xfe783b85 in __cilkrts_gcc_rethrow (sf=0xfeffdb00) at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/except-gcc.cpp:589 #6 0xfe77f0ea in __cilkrts_rethrow (sf=0xfeffdb00) at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/cilk-abi.c:548 #7 0x080513a3 in my_test () at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:38 #8 0x080515bd in main () at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:62 The gcc_assert in _Unwind_Resume triggers since _Unwind_RaiseException_Phase2 returned _URC_FATAL_PHASE2_ERROR. I found that x86_fallback_frame_state had been invoked for this pc: 0xfe77218e <__cilkrts_rethrow+30>: add $0x10,%esp and returned _URC_END_OF_STACK, which is totally unexpected since _Unwind_Find_FDE should have found it. __cilkrts_rethrow is defined in libcilkrts/cilk-abi.o, but in the 32-bit case EH info is missing: 32-bit: ro@fuego 339 > elfdump -u .libs/libcilkrts.so|grep rethrow 0x18def 0x3558c __cilkrts_gcc_rethrow [0x11fc] initloc: 0x18def [ sdata4 pcrel ] __cilkrts_gcc_rethrow 64-bit: ro@fuego 341 > elfdump -u amd64/libcilkrts/.libs/libcilkrts.so|grep rethrow 0x1c639 0x2010 __cilkrts_rethrow 0x2388b 0x5510 __cilkrts_gcc_rethrow [0x488] initloc: 0x1c639 [ sdata4 pcrel ] __cilkrts_rethrow [0x3988] initloc: 0x2388b [ sdata4 pcrel ] __cilkrts_gcc_rethrow I traced this to -funwind-tables bein set on 32-bit Linux/x86, while it is unset on 32-bit Solaris/x86 due to i386/i386.c (ix86_option_override_internal): if (opts->x_flag_asynchronous_unwind_tables == 2) opts->x_flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER; where i386/sol2.h has #define USE_IX86_FRAME_POINTER 1 while the default is 0. As expected, compiling libcilkrts with -funwind-tables (which is a no-op on Linux/x86, Linux/x86_64, and Solaris/amd64) makes the failure go away. I'm uncertain if this is ok for mainline at this stage or has to wait for gcc-7. Once it goes into mainline, it's probably worth a backport to all active release branches. Thoughts? Rainer 2016-04-04 Rainer Orth PR target/60290 * Makefile.am (GENERAL_FLAGS): Add -funwind-tables. * Makefile.in: Regenerate. # HG changeset patch # Parent 5ffdfe8da23c38390b9520b92cb76f53dfc3da0b Compile libcilkrts with -funwind-tables (PR target/60290) diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am --- a/libcilkrts/Makefile.am +++ b/libcilkrts/Makefile.am @@ -43,6 +43,9 @@ GENERAL_FLAGS = -I$(top_srcdir)/include # Enable Intel Cilk Plus extension GENERAL_FLAGS += -fcilkplus +# Always generate unwind tables +GENERAL_FLAGS += -funwind-tables + AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99 AM_CPPFLAGS = $(GENERAL_FLAGS) AM_LDFLAGS = $(XLDFLAGS)