From patchwork Mon Aug 7 11:07:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Arsen_Arsenovi=C4=87?= X-Patchwork-Id: 131830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1384849vqr; Mon, 7 Aug 2023 04:39:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwTc96DpnztWzovlUO7N33VhUS+Hj8EODVu4ZueIhyE5tDZkgyLr8DoyMjjveYr38sabMG X-Received: by 2002:ac2:4a72:0:b0:4f9:5a87:1028 with SMTP id q18-20020ac24a72000000b004f95a871028mr5083355lfp.30.1691408358873; Mon, 07 Aug 2023 04:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691408358; cv=none; d=google.com; s=arc-20160816; b=nxLNaEgEvPLEbfMHBm1BSqrAwZwTLyHFONkszQAa3HMeunKfzH4ZbN40aysv6Tu7Z/ zaOt445sIu1lgpERqunrZlbEx/rzIL1FjuGWWY1apVGqi/wRjXj8bE9Ntd4/nfFppbhe mJ9quVIASjfTbsjZKmXFLk6ZrHgs0xWkK9UzQHNS9pwONDanPlNwnaM2E/U1oPAdBguJ ZGOpx0F+Mlwk3d67EfgjitULr/v1EX9DwTUUNkhaKBR6F3joScKX52EHHRqdrCAtLZlH t90wxK6UzMGFc1bnhuO7S4g6yWCyovz7gFIr30++gKnqL9010zDaPTsEvtxlsX6bJO4j AgJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=rZAI4zWtclvN1UygdanPsSGUu3nyS0miWXimYjqWtM0=; fh=5m/Ou5nb9mSX4jgWjeSrLy5XL/K/fwRPXiU1Ypr6h+w=; b=ycUXRHftbtlRj+x/SQJbqY8+FVic+jjWuKcjYHqR4Xj3QHuFkcME7OyTF7/CimsD9I 70hb/gtfdwZisfYsGcahJf3IS/RwEDBb5QWsT89u+6y7hSD0oQ1RujcKPbZ7SYSBdFsd r03k5mTIS44IK7RIlmxxsXQMwzFiRDzH95pmsloIqV8p55H6iXO5GptGsWoIhc47B2JJ a/SYqd3SLNodl1UkiOuwG4E5lXEU8WB3DdANoejSiLcCp8rJe6UeIYXPcshbVeMveG0k Du5ghnz5odviC3lLlEhEyvSH2wTidXw2oOn3zdwqPYVcbHQ9OyuOkqXquGIgxM4ASRN1 gziQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ln5dsYfL; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x23-20020aa7d397000000b005230d2bec19si5665028edq.178.2023.08.07.04.39.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:39:18 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ln5dsYfL; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 42DFC3AA900B for ; Mon, 7 Aug 2023 11:28:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 42DFC3AA900B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691407680; bh=rZAI4zWtclvN1UygdanPsSGUu3nyS0miWXimYjqWtM0=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ln5dsYfLq+fXhy+adna1ZXD42cI1tgcHRLUcPgS1/8NAn0mBp9OurobL8wc5MV3MC pu4CkQAMaVyXET3W8Mm6U7x5nTewyF4JQQEb5zJiEd5DfyKE09vZuyBUpU01kDcwdd BtfMyX14X7AawiP2ogeA/vs/6PPDfSIfQHmgkToA= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050:0:465::202]) by sourceware.org (Postfix) with ESMTPS id 6294138582A3; Mon, 7 Aug 2023 11:19:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6294138582A3 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4RKDNj6HzCz9sZW; Mon, 7 Aug 2023 13:19:17 +0200 (CEST) To: gdb-patches@sourceware.org, binutils@sourceware.org Cc: Iain Sandoe Subject: [PATCH 08/45] configure: When host-shared, pass --with-pic to in-tree lib configs. Date: Mon, 7 Aug 2023 13:07:11 +0200 Message-ID: <20230807111029.2320238-9-arsen@aarsen.me> In-Reply-To: <20230807111029.2320238-1-arsen@aarsen.me> References: <20230807111029.2320238-1-arsen@aarsen.me> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4RKDNj6HzCz9sZW X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Arsen_Arsenovi=C4=87_via_Binutils?= From: =?utf-8?q?Arsen_Arsenovi=C4=87?= Reply-To: =?utf-8?q?Arsen_Arsenovi=C4=87?= Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773570210843419228 X-GMAIL-MSGID: 1773570210843419228 From: Iain Sandoe If we are building PIC/PIE host executables, and we are building dependent libs (e.g. GMP) in-tree those libs need to be configured to generate PIC code. Signed-off-by: Iain Sandoe ChangeLog: * Makefile.def: Pass host_libs_picflag to host dependent library configures. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac (host_libs_picflag): New configure variable set to '--with-pic' when building 'host_shared'. --- Makefile.def | 13 +++--- Makefile.in | 120 +++++++++++++++++++++++++-------------------------- configure | 11 +++++ configure.ac | 10 +++++ 4 files changed, 88 insertions(+), 66 deletions(-) diff --git a/Makefile.def b/Makefile.def index 8f5a5bb1c9e..1ed80c4f651 100644 --- a/Makefile.def +++ b/Makefile.def @@ -50,7 +50,7 @@ host_modules= { module= gcc; bootstrap=true; extra_make_flags="$(EXTRA_GCC_FLAGS)"; }; host_modules= { module= gmp; lib_path=.libs; bootstrap=true; // Work around in-tree gmp configure bug with missing flex. - extra_configure_flags='--disable-shared LEX="touch lex.yy.c"'; + extra_configure_flags='--disable-shared LEX="touch lex.yy.c" @host_libs_picflag@'; extra_make_flags='AM_CFLAGS="-DNO_ASM"'; no_install= true; // none-*-* disables asm optimizations, bootstrap-testing @@ -60,14 +60,14 @@ host_modules= { module= gmp; lib_path=.libs; bootstrap=true; // different from host for target. target="none-${host_vendor}-${host_os}"; }; host_modules= { module= mpfr; lib_path=src/.libs; bootstrap=true; - extra_configure_flags='--disable-shared @extra_mpfr_configure_flags@'; + extra_configure_flags='--disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@'; extra_make_flags='AM_CFLAGS="-DNO_ASM"'; no_install= true; }; host_modules= { module= mpc; lib_path=src/.libs; bootstrap=true; - extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode'; + extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode'; no_install= true; }; host_modules= { module= isl; lib_path=.libs; bootstrap=true; - extra_configure_flags='--disable-shared @extra_isl_gmp_configure_flags@'; + extra_configure_flags='--disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@'; extra_make_flags='V=1'; no_install= true; }; host_modules= { module= libelf; lib_path=.libs; bootstrap=true; @@ -76,6 +76,7 @@ host_modules= { module= libelf; lib_path=.libs; bootstrap=true; host_modules= { module= gold; bootstrap=true; }; host_modules= { module= gprof; }; host_modules= { module= gprofng; }; +// intl acts on 'host_shared' directly, and does not support --with-pic. host_modules= { module= intl; bootstrap=true; }; host_modules= { module= tcl; missing=mostlyclean; }; @@ -111,7 +112,7 @@ host_modules= { module= libiberty-linker-plugin; bootstrap=true; // We abuse missing to avoid installing anything for libiconv. host_modules= { module= libiconv; bootstrap=true; - extra_configure_flags='--disable-shared'; + extra_configure_flags='--disable-shared @host_libs_picflag@'; no_install= true; missing= pdf; missing= html; @@ -126,7 +127,7 @@ host_modules= { module= sim; }; host_modules= { module= texinfo; no_install= true; }; host_modules= { module= zlib; no_install=true; no_check=true; bootstrap=true; - extra_configure_flags='@extra_host_zlib_configure_flags@';}; + extra_configure_flags='@extra_host_zlib_configure_flags@ @host_libs_picflag@';}; host_modules= { module= gnulib; }; host_modules= { module= gdbsupport; }; host_modules= { module= gdbserver; }; diff --git a/Makefile.in b/Makefile.in index eb973eea024..599e6061cff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13162,7 +13162,7 @@ configure-gmp: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=none-${host_vendor}-${host_os} \ - --target=none-${host_vendor}-${host_os} --disable-shared LEX="touch lex.yy.c" \ + --target=none-${host_vendor}-${host_os} --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ \ || exit 1 @endif gmp @@ -13198,7 +13198,7 @@ configure-stage1-gmp: --target=none-${host_vendor}-${host_os} \ \ $(STAGE1_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stage2-gmp maybe-configure-stage2-gmp @@ -13232,7 +13232,7 @@ configure-stage2-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stage3-gmp maybe-configure-stage3-gmp @@ -13266,7 +13266,7 @@ configure-stage3-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stage4-gmp maybe-configure-stage4-gmp @@ -13300,7 +13300,7 @@ configure-stage4-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stageprofile-gmp maybe-configure-stageprofile-gmp @@ -13334,7 +13334,7 @@ configure-stageprofile-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stagetrain-gmp maybe-configure-stagetrain-gmp @@ -13368,7 +13368,7 @@ configure-stagetrain-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEtrain_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stagefeedback-gmp maybe-configure-stagefeedback-gmp @@ -13402,7 +13402,7 @@ configure-stagefeedback-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stageautoprofile-gmp maybe-configure-stageautoprofile-gmp @@ -13436,7 +13436,7 @@ configure-stageautoprofile-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautoprofile_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap .PHONY: configure-stageautofeedback-gmp maybe-configure-stageautofeedback-gmp @@ -13470,7 +13470,7 @@ configure-stageautofeedback-gmp: --target=none-${host_vendor}-${host_os} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautofeedback_CONFIGURE_FLAGS) \ - --disable-shared LEX="touch lex.yy.c" + --disable-shared LEX="touch lex.yy.c" @host_libs_picflag@ @endif gmp-bootstrap @@ -14299,7 +14299,7 @@ configure-mpfr: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} --disable-shared @extra_mpfr_configure_flags@ \ + --target=${target_alias} --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ \ || exit 1 @endif mpfr @@ -14335,7 +14335,7 @@ configure-stage1-mpfr: --target=${target_alias} \ \ $(STAGE1_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stage2-mpfr maybe-configure-stage2-mpfr @@ -14369,7 +14369,7 @@ configure-stage2-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stage3-mpfr maybe-configure-stage3-mpfr @@ -14403,7 +14403,7 @@ configure-stage3-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stage4-mpfr maybe-configure-stage4-mpfr @@ -14437,7 +14437,7 @@ configure-stage4-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stageprofile-mpfr maybe-configure-stageprofile-mpfr @@ -14471,7 +14471,7 @@ configure-stageprofile-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stagetrain-mpfr maybe-configure-stagetrain-mpfr @@ -14505,7 +14505,7 @@ configure-stagetrain-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEtrain_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stagefeedback-mpfr maybe-configure-stagefeedback-mpfr @@ -14539,7 +14539,7 @@ configure-stagefeedback-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stageautoprofile-mpfr maybe-configure-stageautoprofile-mpfr @@ -14573,7 +14573,7 @@ configure-stageautoprofile-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautoprofile_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap .PHONY: configure-stageautofeedback-mpfr maybe-configure-stageautofeedback-mpfr @@ -14607,7 +14607,7 @@ configure-stageautofeedback-mpfr: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautofeedback_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpfr_configure_flags@ + --disable-shared @extra_mpfr_configure_flags@ @host_libs_picflag@ @endif mpfr-bootstrap @@ -15436,7 +15436,7 @@ configure-mpc: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode \ + --target=${target_alias} --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode \ || exit 1 @endif mpc @@ -15472,7 +15472,7 @@ configure-stage1-mpc: --target=${target_alias} \ \ $(STAGE1_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stage2-mpc maybe-configure-stage2-mpc @@ -15506,7 +15506,7 @@ configure-stage2-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stage3-mpc maybe-configure-stage3-mpc @@ -15540,7 +15540,7 @@ configure-stage3-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stage4-mpc maybe-configure-stage4-mpc @@ -15574,7 +15574,7 @@ configure-stage4-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stageprofile-mpc maybe-configure-stageprofile-mpc @@ -15608,7 +15608,7 @@ configure-stageprofile-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stagetrain-mpc maybe-configure-stagetrain-mpc @@ -15642,7 +15642,7 @@ configure-stagetrain-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEtrain_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stagefeedback-mpc maybe-configure-stagefeedback-mpc @@ -15676,7 +15676,7 @@ configure-stagefeedback-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stageautoprofile-mpc maybe-configure-stageautoprofile-mpc @@ -15710,7 +15710,7 @@ configure-stageautoprofile-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautoprofile_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap .PHONY: configure-stageautofeedback-mpc maybe-configure-stageautofeedback-mpc @@ -15744,7 +15744,7 @@ configure-stageautofeedback-mpc: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautofeedback_CONFIGURE_FLAGS) \ - --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode + --disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ @host_libs_picflag@ --disable-maintainer-mode @endif mpc-bootstrap @@ -16573,7 +16573,7 @@ configure-isl: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} --disable-shared @extra_isl_gmp_configure_flags@ \ + --target=${target_alias} --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ \ || exit 1 @endif isl @@ -16609,7 +16609,7 @@ configure-stage1-isl: --target=${target_alias} \ \ $(STAGE1_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stage2-isl maybe-configure-stage2-isl @@ -16643,7 +16643,7 @@ configure-stage2-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stage3-isl maybe-configure-stage3-isl @@ -16677,7 +16677,7 @@ configure-stage3-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stage4-isl maybe-configure-stage4-isl @@ -16711,7 +16711,7 @@ configure-stage4-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stageprofile-isl maybe-configure-stageprofile-isl @@ -16745,7 +16745,7 @@ configure-stageprofile-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stagetrain-isl maybe-configure-stagetrain-isl @@ -16779,7 +16779,7 @@ configure-stagetrain-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEtrain_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stagefeedback-isl maybe-configure-stagefeedback-isl @@ -16813,7 +16813,7 @@ configure-stagefeedback-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stageautoprofile-isl maybe-configure-stageautoprofile-isl @@ -16847,7 +16847,7 @@ configure-stageautoprofile-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautoprofile_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap .PHONY: configure-stageautofeedback-isl maybe-configure-stageautofeedback-isl @@ -16881,7 +16881,7 @@ configure-stageautofeedback-isl: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautofeedback_CONFIGURE_FLAGS) \ - --disable-shared @extra_isl_gmp_configure_flags@ + --disable-shared @extra_isl_gmp_configure_flags@ @host_libs_picflag@ @endif isl-bootstrap @@ -31284,7 +31284,7 @@ configure-libiconv: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} --disable-shared \ + --target=${target_alias} --disable-shared @host_libs_picflag@ \ || exit 1 @endif libiconv @@ -31320,7 +31320,7 @@ configure-stage1-libiconv: --target=${target_alias} \ \ $(STAGE1_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stage2-libiconv maybe-configure-stage2-libiconv @@ -31354,7 +31354,7 @@ configure-stage2-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stage3-libiconv maybe-configure-stage3-libiconv @@ -31388,7 +31388,7 @@ configure-stage3-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stage4-libiconv maybe-configure-stage4-libiconv @@ -31422,7 +31422,7 @@ configure-stage4-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stageprofile-libiconv maybe-configure-stageprofile-libiconv @@ -31456,7 +31456,7 @@ configure-stageprofile-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stagetrain-libiconv maybe-configure-stagetrain-libiconv @@ -31490,7 +31490,7 @@ configure-stagetrain-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEtrain_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stagefeedback-libiconv maybe-configure-stagefeedback-libiconv @@ -31524,7 +31524,7 @@ configure-stagefeedback-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stageautoprofile-libiconv maybe-configure-stageautoprofile-libiconv @@ -31558,7 +31558,7 @@ configure-stageautoprofile-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautoprofile_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap .PHONY: configure-stageautofeedback-libiconv maybe-configure-stageautofeedback-libiconv @@ -31592,7 +31592,7 @@ configure-stageautofeedback-libiconv: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautofeedback_CONFIGURE_FLAGS) \ - --disable-shared + --disable-shared @host_libs_picflag@ @endif libiconv-bootstrap @@ -34656,7 +34656,7 @@ configure-zlib: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} @extra_host_zlib_configure_flags@ \ + --target=${target_alias} @extra_host_zlib_configure_flags@ @host_libs_picflag@ \ || exit 1 @endif zlib @@ -34692,7 +34692,7 @@ configure-stage1-zlib: --target=${target_alias} \ \ $(STAGE1_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stage2-zlib maybe-configure-stage2-zlib @@ -34726,7 +34726,7 @@ configure-stage2-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stage3-zlib maybe-configure-stage3-zlib @@ -34760,7 +34760,7 @@ configure-stage3-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stage4-zlib maybe-configure-stage4-zlib @@ -34794,7 +34794,7 @@ configure-stage4-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stageprofile-zlib maybe-configure-stageprofile-zlib @@ -34828,7 +34828,7 @@ configure-stageprofile-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stagetrain-zlib maybe-configure-stagetrain-zlib @@ -34862,7 +34862,7 @@ configure-stagetrain-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEtrain_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stagefeedback-zlib maybe-configure-stagefeedback-zlib @@ -34896,7 +34896,7 @@ configure-stagefeedback-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stageautoprofile-zlib maybe-configure-stageautoprofile-zlib @@ -34930,7 +34930,7 @@ configure-stageautoprofile-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautoprofile_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap .PHONY: configure-stageautofeedback-zlib maybe-configure-stageautofeedback-zlib @@ -34964,7 +34964,7 @@ configure-stageautofeedback-zlib: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEautofeedback_CONFIGURE_FLAGS) \ - @extra_host_zlib_configure_flags@ + @extra_host_zlib_configure_flags@ @host_libs_picflag@ @endif zlib-bootstrap diff --git a/configure b/configure index 9cb953a197e..4b3d8ed02c5 100755 --- a/configure +++ b/configure @@ -688,6 +688,7 @@ get_gcc_base_ver extra_host_zlib_configure_flags extra_host_libiberty_configure_flags stage1_languages +host_libs_picflag host_shared extra_linker_plugin_flags extra_linker_plugin_configure_flags @@ -8787,6 +8788,16 @@ fi + +# If we are building PIC/PIE host executables, and we are building dependent +# libs (e.g. GMP) in-tree those libs need to be configured to generate PIC +# code. +host_libs_picflag= +if test "$host_shared" = "yes";then +host_libs_picflag='--with-pic' +fi + + # By default, C and C++ are the only stage 1 languages. stage1_languages=,c, diff --git a/configure.ac b/configure.ac index e95a9ed116e..86d10a6af8e 100644 --- a/configure.ac +++ b/configure.ac @@ -2006,8 +2006,18 @@ AC_ARG_ENABLE(host-shared, x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;; *) host_shared=no ;; esac]) + AC_SUBST(host_shared) +# If we are building PIC/PIE host executables, and we are building dependent +# libs (e.g. GMP) in-tree those libs need to be configured to generate PIC +# code. +host_libs_picflag= +if test "$host_shared" = "yes";then +host_libs_picflag='--with-pic' +fi +AC_SUBST(host_libs_picflag) + # By default, C and C++ are the only stage 1 languages. stage1_languages=,c,