public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4536] configure: When host-shared, pass --with-pic to in-tree lib configs.
@ 2022-12-07 11:17 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2022-12-07 11:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:05048fc29f0e36e814281270a19762c962c1d9d2

commit r13-4536-g05048fc29f0e36e814281270a19762c962c1d9d2
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Jun 25 13:07:43 2022 +0100

    configure: When host-shared, pass --with-pic to in-tree lib configs.
    
    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'.

Diff:
---
 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 83ae77586ad..25e48938dbf 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,18 +60,19 @@ 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= gold; bootstrap=true; };
 host_modules= { module= gprof; };
+// intl acts on 'host_shared' directly, and does not support --with-pic.
 host_modules= { module= intl; bootstrap=true; };
 host_modules= { module= tcl;
                 missing=mostlyclean; };
@@ -107,7 +108,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;
@@ -122,7 +123,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 e5bed1bea3a..c426b0607c4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -13118,7 +13118,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
 
@@ -13154,7 +13154,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
@@ -13188,7 +13188,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
@@ -13222,7 +13222,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
@@ -13256,7 +13256,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
@@ -13290,7 +13290,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
@@ -13324,7 +13324,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
@@ -13358,7 +13358,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
@@ -13392,7 +13392,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
@@ -13426,7 +13426,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
 
 
@@ -14255,7 +14255,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
 
@@ -14291,7 +14291,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
@@ -14325,7 +14325,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
@@ -14359,7 +14359,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
@@ -14393,7 +14393,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
@@ -14427,7 +14427,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
@@ -14461,7 +14461,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
@@ -14495,7 +14495,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
@@ -14529,7 +14529,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
@@ -14563,7 +14563,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
 
 
@@ -15392,7 +15392,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
 
@@ -15428,7 +15428,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
@@ -15462,7 +15462,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
@@ -15496,7 +15496,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
@@ -15530,7 +15530,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
@@ -15564,7 +15564,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
@@ -15598,7 +15598,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
@@ -15632,7 +15632,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
@@ -15666,7 +15666,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
@@ -15700,7 +15700,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
 
 
@@ -16529,7 +16529,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
 
@@ -16565,7 +16565,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
@@ -16599,7 +16599,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
@@ -16633,7 +16633,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
@@ -16667,7 +16667,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
@@ -16701,7 +16701,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
@@ -16735,7 +16735,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
@@ -16769,7 +16769,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
@@ -16803,7 +16803,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
@@ -16837,7 +16837,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
 
 
@@ -29635,7 +29635,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
 
@@ -29671,7 +29671,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
@@ -29705,7 +29705,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
@@ -29739,7 +29739,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
@@ -29773,7 +29773,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
@@ -29807,7 +29807,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
@@ -29841,7 +29841,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
@@ -29875,7 +29875,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
@@ -29909,7 +29909,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
@@ -29943,7 +29943,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
 
 
@@ -33007,7 +33007,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
 
@@ -33043,7 +33043,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
@@ -33077,7 +33077,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
@@ -33111,7 +33111,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
@@ -33145,7 +33145,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
@@ -33179,7 +33179,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
@@ -33213,7 +33213,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
@@ -33247,7 +33247,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
@@ -33281,7 +33281,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
@@ -33315,7 +33315,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 86942b24b62..6815216cf49 100755
--- a/configure
+++ b/configure
@@ -685,6 +685,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
@@ -8596,6 +8597,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 07f4cc8a261..83bbc4cd04d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1868,8 +1868,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,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-07 11:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 11:17 [gcc r13-4536] configure: When host-shared, pass --with-pic to in-tree lib configs Iain D Sandoe

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).