From patchwork Wed Aug 18 18:50:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1518104 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqcS63kvWz9sXk for ; Thu, 19 Aug 2021 04:51:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7CAE4398581A for ; Wed, 18 Aug 2021 18:51:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp002.apm-internet.net (smtp002.apm-internet.net [85.119.248.221]) by sourceware.org (Postfix) with ESMTPS id 40F103853822 for ; Wed, 18 Aug 2021 18:50:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 40F103853822 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=sandoe.co.uk Received: (qmail 26013 invoked from network); 18 Aug 2021 18:50:51 -0000 X-APM-Out-ID: 16293126512601 X-APM-Authkey: 257869/1(257869/1) 7 Received: from unknown (HELO ?192.168.1.214?) (81.138.1.83) by smtp002.apm-internet.net with SMTP; 18 Aug 2021 18:50:51 -0000 From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: [pushed] configure: Allow host fragments to react to --enable-host-shared. Message-Id: Date: Wed, 18 Aug 2021 19:50:51 +0100 To: GCC Patches X-Mailer: Apple Mail (2.3445.104.21) X-Spam-Status: No, score=-15.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_COUK, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, It is possible that a host makefile fragment might need to adapt to the setting of —enable-host-shared. This makes the host_shared value available to host makefile fragments. It uses this to adjust Darwin's mdynamic-no-pic in the case that shared host resources are required. tested on i686, x86_64-darwin, x86_64,powerpc64-linux, pushed to master (the non-darwin-specific change is trivial). thanks Iain Signed-off-by: Iain Sandoe ChangeLog: * Makefile.in: Regenerate. * Makefile.tpl: Make the state of the configured host shared flag available to makefile fragements. config/ChangeLog: * mh-darwin: Require a non-shared host configuration to enable mdynamic-no-pic where that is supported. --- Makefile.in | 3 +++ Makefile.tpl | 3 +++ config/mh-darwin | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/Makefile.tpl b/Makefile.tpl index bffd85bd68e..9adf4f94728 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -112,6 +112,9 @@ RPATH_ENVVAR = @RPATH_ENVVAR@ # executables in PATH. GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@ +# If the build should make suitable code for shared host resources. +host_shared = @host_shared@ + # Build programs are put under this directory. BUILD_SUBDIR = @build_subdir@ # This is set by the configure script to the arguments to use when configuring diff --git a/config/mh-darwin b/config/mh-darwin index fb2bb5ad1d9..b72835ae953 100644 --- a/config/mh-darwin +++ b/config/mh-darwin @@ -11,9 +11,15 @@ # non-bootstrapped compiler), later stages will be built by GCC which supports # the required flags. +# We cannot use mdynamic-no-pic when building shared host resources. + +ifeq (${host_shared},no) BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := $(shell \ $(CC) -S -xc /dev/null -o /dev/null -Werror -mno-dynamic-no-pic 2>/dev/null \ && echo true) +else +BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC := false +endif @if gcc-bootstrap ifeq (${BOOTSTRAP_TOOL_CAN_USE_MDYNAMIC_NO_PIC},true) @@ -21,8 +27,10 @@ STAGE1_CFLAGS += -mdynamic-no-pic else STAGE1_CFLAGS += -fPIC endif +ifeq (${host_shared},no) # Add -mdynamic-no-pic to later stages when we know it is built with GCC. BOOT_CFLAGS += -mdynamic-no-pic +endif @endif gcc-bootstrap @unless gcc-bootstrap