From patchwork Fri Nov 26 18:45:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 73221 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]) by ozlabs.org (Postfix) with SMTP id CF68FB70A5 for ; Sat, 27 Nov 2010 05:45:36 +1100 (EST) Received: (qmail 9959 invoked by alias); 26 Nov 2010 18:45:26 -0000 Received: (qmail 9940 invoked by uid 22791); 26 Nov 2010 18:45:24 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_BF, TW_IB, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Nov 2010 18:45:20 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 4C7482A7; Fri, 26 Nov 2010 19:45:18 +0100 (CET) Received: from smtp-relay.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 Qi+ib3RmOPfx; Fri, 26 Nov 2010 19:45:15 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 9D4542A6; Fri, 26 Nov 2010 19:45:15 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id oAQIjF0e011382; Fri, 26 Nov 2010 19:45:15 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: java-patches@gcc.gnu.org, Anthony Green , Jakub Jelinek Subject: [libffi] Use datarel encoding in libffi .eh_frame on Solaris 2/x86 Date: Fri, 26 Nov 2010 19:45:15 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 While trying to make the libgcc unwinder use dl_iterate_phdr on Solaris 11, I ran into a gld bug (PR ld/12253) that broke libffi unwind tests and all libjava execution tests: while Solaris 2/x86 uses DW_EH_PE_datarel encoding for .eh_frame in 32-bit PIC code, src/x86/sysv.S uses DW_EH_PE_pcrel. Due to the above bug, .eh_frame_hdr isn't sorted correctly with gld before 2.22. To work around this issue for older gld versions, I'd like to use the following workaround to avoid the issue, namely also use datarel encoding on Solaris 2/x86. Bootstrapped on i386-pc-solaris2.11 with CVS gas and gld (before the fix) and i386-pc-solaris2.10 with Sun as and ld. It fixes all the testsuite regressions with gld and works without issues with Sun ld. Ok for mainline? Rainer 2010-01-18 Rainer Orth * src/x86/sysv.S (.eh_frame) [__PIC__ && __sun__ && __svr4__]: Use datarel encoding. (.LASFDE1) [__PIC__ && __sun__ && __svr4__]: Use @GOTOFF for FDE initial location. (.LASFDE2, LASFDE3): Likewise. diff -r 36d43c8e1be5 libffi/src/x86/sysv.S --- a/libffi/src/x86/sysv.S Sat Nov 20 22:10:07 2010 +0100 +++ b/libffi/src/x86/sysv.S Sat Nov 20 22:10:57 2010 +0100 @@ -354,8 +354,15 @@ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ +#ifdef __sun__ && __svr4__ + /* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld + doesn't correctly sort .eh_frame_hdr with mixed encodings, so + match this. */ + .byte 0x30 /* FDE Encoding (datarel) */ +#else .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif +#endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x4 /* .uleb128 0x4 */ @@ -367,10 +374,14 @@ .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB1-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB1@rel +#ifdef __PIC__ +#if defined __sun__ && defined __svr4__ + .long .LFB1@GOTOFF /* FDE initial location */ +#elif defined HAVE_AS_X86_PCREL + .long .LFB1-. /* FDE initial location */ +#else + .long .LFB1@rel /* FDE initial location */ +#endif #else .long .LFB1 #endif @@ -394,10 +405,14 @@ .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB2-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB2@rel +#ifdef __PIC__ +#if defined __sun__ && defined __svr4__ + .long .LFB2@GOTOFF /* FDE initial location */ +#elif defined HAVE_AS_X86_PCREL + .long .LFB2-. /* FDE initial location */ +#else + .long .LFB2@rel /* FDE initial location */ +#endif #else .long .LFB2 #endif @@ -430,10 +445,14 @@ .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB3-. /* FDE initial location */ -#elif defined __PIC__ - .long .LFB3@rel +#ifdef __PIC__ +#if defined __sun__ && defined __svr4__ + .long .LFB3@GOTOFF /* FDE initial location */ +#elif defined HAVE_AS_X86_PCREL + .long .LFB3-. /* FDE initial location */ +#else + .long .LFB3@rel /* FDE initial location */ +#endif #else .long .LFB3 #endif