public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Arsen Arsenović" <arsen@aarsen.me>
To: gdb-patches@sourceware.org, binutils@sourceware.org
Cc: Iain Sandoe <iain@sandoe.co.uk>
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	[thread overview]
Message-ID: <20230807111029.2320238-9-arsen@aarsen.me> (raw)
In-Reply-To: <20230807111029.2320238-1-arsen@aarsen.me>

From: Iain Sandoe <iain@sandoe.co.uk>

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 <iain@sandoe.co.uk>

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,
 
-- 
2.41.0


  parent reply	other threads:[~2023-08-07 11:19 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 11:07 [PATCH 00/45] Synchronize shared build infrastructure with GCC tree Arsen Arsenović
2023-08-07 11:07 ` [PATCH 01/45] *: Regenerate autoconf and aclocal files Arsen Arsenović
2023-08-09 13:43   ` Alan Modra
2023-08-10  9:13     ` Arsen Arsenović
2023-08-07 11:07 ` [PATCH 02/45] Libvtv: Add loongarch support Arsen Arsenović
2023-08-07 11:07 ` [PATCH 03/45] c++: source position of lambda captures [PR84471] Arsen Arsenović
2023-08-10 21:48   ` Jason Merrill
2023-08-07 11:07 ` [PATCH 04/45] Updated constants from <https://dwarfstd.org/Languages.php> Arsen Arsenović
2023-08-07 11:07 ` [PATCH 05/45] LoongArch: implement count_{leading,trailing}_zeros Arsen Arsenović
2023-08-07 11:07 ` [PATCH 06/45] Darwin : Update libtool and dependencies for Darwin20 [PR97865] Arsen Arsenović
2023-08-07 11:07 ` [PATCH 07/45] configure: Do not build the ununsed libffi shared library Arsen Arsenović
2023-08-09 13:44   ` Alan Modra
2023-08-10  9:21     ` Arsen Arsenović
2023-08-10 11:39       ` Alan Modra
2023-08-10 11:25     ` Arsen Arsenović
2023-08-07 11:07 ` Arsen Arsenović [this message]
2023-08-07 11:07 ` [PATCH 09/45] configure: Implement --enable-host-pie Arsen Arsenović
2023-08-07 11:07 ` [PATCH 10/45] configure: Only create serdep.tmp if needed Arsen Arsenović
2023-08-07 11:07 ` [PATCH 11/45] configure, Darwin: Ensure overrides to host-pie are passed to gcc configure Arsen Arsenović
2023-08-07 11:07 ` [PATCH 12/45] Remove support for Intel MIC offloading Arsen Arsenović
2023-08-07 11:07 ` [PATCH 13/45] configure: use OBJDUMP determined by libtool [PR95648] Arsen Arsenović
2023-08-07 11:07 ` [PATCH 14/45] configure: Account CXXFLAGS in gcc-plugin.m4 Arsen Arsenović
2023-08-07 11:07 ` [PATCH 15/45] Add TFLAGS to gcc's GCC_FOR_TARGET Arsen Arsenović
2023-08-07 11:07 ` [PATCH 16/45] Merge modula-2 front end onto gcc Arsen Arsenović
2023-08-07 11:07 ` [PATCH 17/45] sync toplevel with GCC: drop 32b PA-RISC on HPUX in GCC Arsen Arsenović
2023-08-07 11:07 ` [PATCH 18/45] Fix PR bootstrap/102389: --with-build-config=bootstrap-lto is broken Arsen Arsenović
2023-08-07 11:07 ` [PATCH 19/45] gcc: Add 'mcf' thread model support from mcfgthread Arsen Arsenović
2023-08-07 11:07 ` [PATCH 20/45] Darwin, config: Revise host config fragment Arsen Arsenović
2023-08-07 11:07 ` [PATCH 21/45] configure: Allow host fragments to react to --enable-host-shared Arsen Arsenović
2023-08-07 11:07 ` [PATCH 22/45] mh-mingw: Set __USE_MINGW_ACCESS in missed C++ flags variables Arsen Arsenović
2023-08-07 11:07 ` [PATCH 23/45] mh-mingw: drop unused BOOT_CXXFLAGS variable Arsen Arsenović
2023-08-07 11:07 ` [PATCH 24/45] config-ml.in: Suppress output from multi-do recipes Arsen Arsenović
2023-08-07 11:07 ` [PATCH 25/45] Add D front-end, libphobos library, and D2 testsuite Arsen Arsenović
2023-08-07 11:07 ` [PATCH 26/45] MSP430: Add -fno-exceptions multilib Arsen Arsenović
2023-08-07 11:07 ` [PATCH 27/45] gcc: xtensa: add XCHAL_HAVE_{CLAMPS,DEPBITS,EXCLUSIVE,XEA3} to dynconfig Arsen Arsenović
2023-08-07 11:07 ` [PATCH 28/45] gcc: xtensa: add data alignment properties " Arsen Arsenović
2023-08-07 11:07 ` [PATCH 29/45] toplevel: reconcile few divergences with GCC Arsen Arsenović
2023-08-07 11:07 ` [PATCH 30/45] Generic configury support for shared libs on VxWorks Arsen Arsenović
2023-08-07 11:07 ` [PATCH 31/45] Fix hppa64-hpux11 build to remove source paths from embedded path Arsen Arsenović
2023-08-07 11:07 ` [PATCH 32/45] libtool.m4: Sort output of 'find' to enable deterministic builds Arsen Arsenović
2023-08-07 11:07 ` [PATCH 33/45] [ARM/FDPIC v6 02/24] [ARM] FDPIC: Handle arm*-*-uclinuxfdpiceabi in configure scripts Arsen Arsenović
2023-08-07 11:07 ` [PATCH 34/45] Do not use HAVE_DOS_BASED_FILE_SYSTEM for Cygwin Arsen Arsenović
2023-08-07 11:07 ` [PATCH 35/45] Makefile.def: drop remnants of unused libelf Arsen Arsenović
2023-08-07 11:07 ` [PATCH 36/45] d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1) Arsen Arsenović
2023-08-07 11:07 ` [PATCH 37/45] Collect both user and kernel events for autofdo tests and autoprofiledbootstrap Arsen Arsenović
2023-08-07 11:07 ` [PATCH 38/45] Fix collection and processing of autoprofile data for target libs Arsen Arsenović
2023-08-07 11:07 ` [PATCH 39/45] Fix autoprofiledbootstrap build Arsen Arsenović
2023-08-07 11:07 ` [PATCH 40/45] Disable warnings as errors for STAGEautofeedback Arsen Arsenović
2023-08-07 11:07 ` [PATCH 41/45] Revert "Fix PR 67102: Add libstdc++ dependancy to libffi" [PR67102] Arsen Arsenović
2023-08-07 11:07 ` [PATCH 42/45] PR bootstrap/106472: Add libgo depends on libbacktrace to Makefile.def Arsen Arsenović
2023-08-07 11:07 ` [PATCH 43/45] gccrs: Add gcc-check-target check-rust Arsen Arsenović
2023-08-07 11:07 ` [PATCH 44/45] Use substituted GDCFLAGS Arsen Arsenović
2023-08-07 11:07 ` [PATCH 45/45] toplevel: Substitute GDCFLAGS instead of using CFLAGS Arsen Arsenović
2023-08-12  1:18 ` [PATCH 00/45] Synchronize shared build infrastructure with GCC tree Alan Modra
2023-08-12  9:55   ` Arsen Arsenović

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230807111029.2320238-9-arsen@aarsen.me \
    --to=arsen@aarsen.me \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=iain@sandoe.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).