From patchwork Tue May 3 21:47:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Demetriou X-Patchwork-Id: 93905 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 F16F0B6EED for ; Wed, 4 May 2011 07:48:13 +1000 (EST) Received: (qmail 18090 invoked by alias); 3 May 2011 21:48:08 -0000 Received: (qmail 18068 invoked by uid 22791); 3 May 2011 21:48:07 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 21:47:51 +0000 Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id p43LloOe029689 for ; Tue, 3 May 2011 14:47:50 -0700 Received: from vxb37 (vxb37.prod.google.com [10.241.33.101]) by wpaz29.hot.corp.google.com with ESMTP id p43Lln4O026898 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 3 May 2011 14:47:49 -0700 Received: by vxb37 with SMTP id 37so630378vxb.18 for ; Tue, 03 May 2011 14:47:49 -0700 (PDT) Received: by 10.220.122.5 with SMTP id j5mr97461vcr.119.1304459269106; Tue, 03 May 2011 14:47:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.7.146 with HTTP; Tue, 3 May 2011 14:47:28 -0700 (PDT) From: Chris Demetriou Date: Tue, 3 May 2011 14:47:28 -0700 Message-ID: Subject: [trunk][RFA] Add __i686.get_pc_thunk.bx to libgcc i386 morestack.S To: gcc-patches@gcc.gnu.org, Ian Lance Taylor X-System-Of-Record: true 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 After I submitted http://gcc.gnu.org/ml/gcc-patches/2011-04/msg02422.html, Rong Xu noted that the resulting sources, if configured --with-pic, would not actually build properly due to missing __i686.get_pc_thunk.bx (due to my renaming that to __x86...). While that issue was exposed by my change, in that configuration, in summary my change exposed a latent issue in morestack.S. (Callers of __i686.get_pc_thunk.bx (etc.) are also supposed to define those functions -- because who knows whether the other objects they're linked against will provide them.) So, I've added the __i686.get_pc_thunk.bx function (as generated by current GCC) to libgcc/config/i386/morestack.S. (I also added __ELF__ #ifdefs and a .size directive for the function, following the apparent conventions in the file.) bootstrapped (C only) on Ubuntu Lucid x86-64, and ran -m32/-m64 tests for compilers configured as normal, and also --with-pic. No regressions before/after. Ian, OK for trunk? chris ---- [libgcc/ChangeLog] 2011-05-03 Chris Demetriou * libgcc/config/i386/morestack.S (__i686.get_pc_thunk.bx): New. [libgcc/ChangeLog] 2011-05-03 Chris Demetriou * libgcc/config/i386/morestack.S (__i686.get_pc_thunk.bx): New. Index: libgcc/config/i386/morestack.S =================================================================== --- libgcc/config/i386/morestack.S (revision 173287) +++ libgcc/config/i386/morestack.S (working copy) @@ -449,6 +449,24 @@ .size __morestack, . - __morestack #endif +#if !defined(__x86_64__) && defined(__PIC__) +# Output the thunk to get PC into bx, since we use it above. +# (__i686 was already undef'd above; don't need to worry about it here.) + .section .text.__i686.get_pc_thunk.bx,"axG",@progbits,__i686.get_pc_thunk.bx,comdat + .globl __i686.get_pc_thunk.bx + .hidden __i686.get_pc_thunk.bx +#ifdef __ELF__ + .type __i686.get_pc_thunk.bx, @function +#endif +__i686.get_pc_thunk.bx: + .cfi_startproc + movl (%esp), %ebx + ret + .cfi_endproc +#ifdef __ELF__ + .size __i686.get_pc_thunk.bx, . - __i686.get_pc_thunk.bx +#endif +#endif # The exception table. This tells the personality routine to execute # the exception handler.