From patchwork Sun Oct 3 18:35:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 66601 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 50A7DB70AB for ; Mon, 4 Oct 2010 05:35:40 +1100 (EST) Received: (qmail 17511 invoked by alias); 3 Oct 2010 18:35:38 -0000 Received: (qmail 17297 invoked by uid 22791); 3 Oct 2010 18:35:37 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Sun, 03 Oct 2010 18:35:32 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id 06D4D400007; Sun, 3 Oct 2010 14:35:29 -0400 (EDT) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id o93IZSfM012028; Sun, 3 Oct 2010 14:35:28 -0400 Date: Sun, 3 Oct 2010 14:35:28 -0400 From: Jack Howarth To: gcc-patches@gcc.gnu.org Cc: mikestump@comcast.net, doko@ubuntu.com, iains@gcc.gnu.org Subject: [PATCH] Backport darwin plugin support fixes to gcc 4.5.2 Message-ID: <20101003183528.GA12026@bromo.med.uc.edu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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 Currently plugin support is not built for darwin in gcc-4_5-branch due to the absence of the changes from r158748 and r164113 which allow the export_sym_check test to pass on darwin by properly using -g in that case. Also the required use of "-undefined dynamic_lookup" on darwin in both gcc/configure.ac and testsuite/lib/plugin-support.exp added in r158748 has not been backported. The attached patch eliminates these omissions. Bootstrap and regression tested on x86_64-apple-darwin10. Okay for gcc 4.5.2? Jack 2010-10-02 Jack Howarth Backport from mainline 2010-04-26 Jack Howarth PR 43715 * gcc/configure.ac: Pass -g for export_sym_check on darwin. Use "-undefined dynamic_lookup" on darwin. * gcc/configure: Regenerate. 2010-10-02 Jack Howarth Backport from mainline 2010-04-26 Jack Howarth PR 43715 * testsuite/lib/plugin-support.exp: Use "-undefined dynamic_lookup" on darwin. Index: gcc/testsuite/lib/plugin-support.exp =================================================================== --- gcc/testsuite/lib/plugin-support.exp (revision 164915) +++ gcc/testsuite/lib/plugin-support.exp (working copy) @@ -88,6 +88,10 @@ set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared" + if { [ ishost *-*-darwin* ] } { + set optstr [concat $optstr "-undefined dynamic_lookup"] + } + # 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"] Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 164915) +++ gcc/configure.ac (working copy) @@ -4543,13 +4543,26 @@ pluginlibs= -if test x$build = x$host; then - export_sym_check="objdump${exeext} -T" -elif test x$host = x$target; then - export_sym_check="$gcc_cv_objdump -T" -else - export_sym_check= -fi +case "${host}" in + *-*-darwin*) + if test x$build = x$host; then + export_sym_check="nm${exeext} -g" + elif test x$host = x$target; then + export_sym_check="$gcc_cv_nm -g" + else + export_sym_check= + fi + ;; + *) + if test x$build = x$host; then + export_sym_check="objdump${exeext} -T" + elif test x$host = x$target; then + export_sym_check="$gcc_cv_objdump -T" + else + export_sym_check= + fi + ;; +esac if test x"$enable_plugin" = x"yes"; then @@ -4587,7 +4600,14 @@ # Check that we can build shared objects with -fPIC -shared saved_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared" + case "${host}" in + *-*-darwin*) + LDFLAGS="$LDFLAGS -fPIC -shared -undefined dynamic_lookup" + ;; + *) + LDFLAGS="$LDFLAGS -fPIC -shared" + ;; + esac AC_MSG_CHECKING([for -fPIC -shared]) AC_TRY_LINK( [extern int X;],[return X == 0;],