From patchwork Tue Nov 16 19:49:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 47786 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 08E63385781A for ; Tue, 16 Nov 2021 19:50:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08E63385781A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1637092212; bh=0OeViamrzdMWTHt8TNlcjuUIhzyK0+jn3sHaFANEZxg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=jaNylQ7BuGWgdJazbiwTCtjUO+6CnzIwcnAt7jMwUO4f8p0KqsxCy0evA7TJJgqsR rCUGd0N49EEvOmTEwzvSVCWw47b+kZxr5d/i0uLHfJyaW/5TdyIfEccChIJbFM/UNa P5iv5kOEOk1dwYet9d6oe5itmdWMoq8OFykFa1uw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 7DF81385781A for ; Tue, 16 Nov 2021 19:49:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7DF81385781A Received: by mail-wm1-x32b.google.com with SMTP id 67-20020a1c1946000000b0030d4c90fa87so328015wmz.2 for ; Tue, 16 Nov 2021 11:49:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:reply-to :mime-version:content-transfer-encoding; bh=0OeViamrzdMWTHt8TNlcjuUIhzyK0+jn3sHaFANEZxg=; b=MgJK+Qv/RwHbugibetrF+uYB4U9V5vSJ9TJKNuqwrFoZZIMIr+5/2muaedpQQ+BYi2 PHApoOWjUB3NdO5hibQ5geIZEHKbbdIXWU3Vv96pZipyqxycZplrorINEnel6RYi8Yxc MI8Pd5TfHgXdrV229k+vJULsLYQ0Wlwzv5t97E9ajhaCHchozjhJATdc7gp9chD/vAmQ yB1qDwgH1KIxwpiNR8N0Ae1ohpEvKXxwfm3ZuV/l4XebaJUvOY9CI7ExHETwwpB1kO6P SXMADXQSLnRDet+mYjdHKWbN1mBaw7kiVr25d1lSx3R7kijO2Lg1xMne4vAdSWty4tO7 jfPg== X-Gm-Message-State: AOAM532Wab9hMrUPwCEJfns6O3NYkGRD07hKGqMSOeJgT2dt2xfmXoK+ cz3pkFUbXePEcxrguJXq2nZcUdc8w0k= X-Google-Smtp-Source: ABdhPJxAQLdRAzPGzQ0Qk/mk7h2bmAqP2bYAdvLB4nLnrdkZ2iiZs15A0wMNh9HUN7LXw8EfggKPPg== X-Received: by 2002:a05:600c:3ba3:: with SMTP id n35mr11101750wms.88.1637092179524; Tue, 16 Nov 2021 11:49:39 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id d15sm25692722wri.50.2021.11.16.11.49.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Nov 2021 11:49:39 -0800 (PST) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [pushed] configure, Darwin: Set appropriate defaults for host-shared. Date: Tue, 16 Nov 2021 19:49:32 +0000 Message-Id: <20211116194932.76952-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Darwin x86_64 and aarch64 platforms are PIC (shared) by default, and user-space code must be built in this mode. The patch ensures that this is set correctly and applies a default when --enable-host-shared is not set. tested on *-darwin*, x86_64,powerpc64le-linux-gnu, pushed to master, thanks Iain Signed-off-by: Iain Sandoe ChangeLog: * configure: Regenerate. * configure.ac: Ensure that PIC (shared) defaults are set correctly for Darwin. --- configure | 16 +++++++++++++++- configure.ac | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 58979d6e3b1..3062495da31 100755 --- a/configure +++ b/configure @@ -8447,8 +8447,20 @@ fi # Check whether --enable-host-shared was given. if test "${enable_host_shared+set}" = set; then : enableval=$enable_host_shared; host_shared=$enableval + case $target in + x86_64-*-darwin* | aarch64-*-darwin*) + if test x$host_shared != xyes ; then + # PIC is the default, and actually cannot be switched off. + echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 + host_shared=yes + fi ;; + *) ;; + esac else - host_shared=no + case $target in + x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;; + *) host_shared=no ;; + esac fi @@ -10083,6 +10095,8 @@ done + + # Generate default definitions for YACC, M4, LEX and other programs that run # on the build machine. These are used if the Makefile can't locate these # programs in objdir. diff --git a/configure.ac b/configure.ac index 550e6993b59..bed60bcaf72 100644 --- a/configure.ac +++ b/configure.ac @@ -1859,7 +1859,20 @@ AC_SUBST(extra_linker_plugin_flags) AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], [build host code as shared libraries])], -[host_shared=$enableval], [host_shared=no]) +[host_shared=$enableval + case $target in + x86_64-*-darwin* | aarch64-*-darwin*) + if test x$host_shared != xyes ; then + # PIC is the default, and actually cannot be switched off. + echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 + host_shared=yes + fi ;; + *) ;; + esac], +[case $target in + x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;; + *) host_shared=no ;; + esac]) AC_SUBST(host_shared) # By default, C and C++ are the only stage 1 languages.