From patchwork Wed Nov 3 11:47:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 69980 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 CC250B70D4 for ; Wed, 3 Nov 2010 22:47:32 +1100 (EST) Received: (qmail 22233 invoked by alias); 3 Nov 2010 11:47:31 -0000 Received: (qmail 22221 invoked by uid 22791); 3 Nov 2010 11:47:29 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from c2beaomr09.btconnect.com (HELO mail.btconnect.com) (213.123.26.187) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Nov 2010 11:47:16 +0000 Received: from host81-138-1-83.in-addr.btopenworld.com (EHLO thor.office) ([81.138.1.83]) by c2beaomr09.btconnect.com with ESMTP id AON56989; Wed, 03 Nov 2010 11:47:11 +0000 (GMT) Message-Id: From: IainS To: GCC Patches Mime-Version: 1.0 (Apple Message framework v936) Subject: [Patch, Darwin] enable mdynamic-no-pic bootstrap for x86-darwin. Date: Wed, 3 Nov 2010 11:47:09 +0000 Cc: Paolo Bonzini , Mike Stump X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0302.4CD14BBE.0072, actions=tag X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0205.4CD14BC2.007B, ss=1, fgs=0, ip=0.0.0.0, so=2010-07-22 22:03:31, dmn=2009-09-10 00:05:08, mode=single engine 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 Hello, Most of this patch is already approved (or pre-approved) in [1] However, I took Paolo's observation that the plugin-supports .exp could be used as the place to deal with filtering the flag - it seems a more natural place to handle the issue. (So that change, the last hunk below, needs review, thanks) OK for trunk? Iain P.S. The change to gcc/configure will also enable plugins on powerpc- darwin (which already bootstraps with -mdynamic-no-pic) [1] http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02701.html and follow- ups. $optstr -o $plugin_lib"] set status [lindex $status 0] set_ld_library_path_env_vars ==== : * configure.ac (*-*-darwin*): Use mh-darwin for all Darwin variants. * configure: Regenerate. * config/mh-ppc-darwin: Rename to mh-darwin. gcc: * gcc/configure.ac: Filter -mdynamic-no-pic from CFLAGS when testing for plugin capabilities. * gcc/configure: Regenerate. gcc/testsuite: * lib/plugin-support.exp (plugin-test-execute): Filter -mdynamic-no- pic from plugin build flags on Darwin targets. Index: configure.ac =================================================================== --- configure.ac (revision 166233) +++ configure.ac (working copy) @@ -1157,8 +1157,8 @@ case "${host}" in tentative_cc="/usr/cygnus/progressive/bin/gcc" host_makefile_frag="config/mh-lynxrs6k" ;; - powerpc-*-darwin*) - host_makefile_frag="config/mh-ppc-darwin" + *-*-darwin*) + host_makefile_frag="config/mh-darwin" ;; powerpc-*-aix*) host_makefile_frag="config/mh-ppc-aix" Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 166233) +++ gcc/configure.ac (working copy) @@ -4694,11 +4694,15 @@ if test x"$enable_plugin" = x"yes"; then # Check that we can build shared objects with -fPIC -shared saved_LDFLAGS="$LDFLAGS" + saved_CFLAGS="$CFLAGS" case "${host}" in *-*-darwin*) - LDFLAGS="$LDFLAGS -fPIC -shared -undefined dynamic_lookup" + CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g` + CFLAGS="$CFLAGS -fPIC" + LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup" ;; *) + CFLAGS="$CFLAGS -fPIC" LDFLAGS="$LDFLAGS -fPIC -shared" ;; esac @@ -4712,6 +4716,7 @@ if test x"$enable_plugin" = x"yes"; then enable_plugin=no fi LDFLAGS="$saved_LDFLAGS" + CFLAGS="$saved_CFLAGS" # If plugin support had been requested but not available, fail. if test x"$enable_plugin" = x"no" ; then Index: gcc/testsuite/lib/plugin-support.exp =================================================================== --- gcc/testsuite/lib/plugin-support.exp (revision 166233) +++ gcc/testsuite/lib/plugin-support.exp (working copy) @@ -86,15 +86,29 @@ proc plugin-test-execute { plugin_src plugin_tests -I${gcc_srcdir}/include -I${gcc_srcdir}/libcpp/ include \ $GMPINC -I${gcc_objdir}/intl" - set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared" - if { [ ishost *-*-darwin* ] } { - set optstr [concat $optstr "-undefined dynamic_lookup"] + # -mdynamic-no-pic is incompatible with -fPIC. + set plug_cflags "" + foreach op $PLUGINCFLAGS { + if { [string compare "-mdynamic-no-pic" $op] } { + set plug_cflags [concat $plug_cflags " $op"] + } + } + set optstr "$includes" + foreach op $extra_flags { + if { [string compare "-mdynamic-no-pic" $op] } { + set optstr [concat $optstr " $op"] + } + } + set optstr [concat $optstr "-DIN_GCC -fPIC -shared -undefined dynamic_lookup"] + } else { + set plug_cflags $PLUGINCFLAGS + set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared" } # Temporarily switch to the environment for the plugin compiler. restore_ld_library_path_env_vars - set status [remote_exec build "$PLUGINCC $PLUGINCFLAGS $plugin_src $optstr -o $plugin_lib"] + set status [remote_exec build "$PLUGINCC $plug_cflags $plugin_src