]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
toolchain: gcc: make config consistent with glibc/musl 18646/head
authorKonstantin Demin <rockdrilla@gmail.com>
Fri, 2 May 2025 10:42:42 +0000 (13:42 +0300)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 2 May 2025 15:27:33 +0000 (17:27 +0200)
I've observed configuration drift for GCC between musl and glibc
(especially it's final stage):

  # musl
  lt_cv_prog_compiler_static_works=yes
  lt_cv_prog_compiler_static_works_CXX=yes
  lt_cv_sys_max_cmd_len=1572864

  # glibc
  lt_cv_prog_compiler_static_works=no
  lt_cv_prog_compiler_static_works_CXX=no
  lt_cv_sys_max_cmd_len=512

These changes should prevent this issue in future:

  export lt_cv_prog_compiler_static_works=yes
  export lt_cv_prog_compiler_static_works_CXX=yes
  export lt_cv_sys_max_cmd_len=1572864

Also:

- provide custom autotools/libtool variables via properly named
  variable ("GCC_CONFIGURE_VARS"),
- move variables from "GCC_MAKE" to "GCC_CONFIGURE_VARS"
  (at this moment only "gcc_cv_libc_provides_ssp=yes" for musl),
- propagate it's usage for both "./configure" and "make".

Signed-off-by: Konstantin Demin <rockdrilla@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/18646
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
toolchain/gcc/common.mk
toolchain/gcc/final/Makefile
toolchain/gcc/initial/Makefile
toolchain/gcc/minimal/Makefile

index 0ccf55bd313ca20d1f4dc7e1fb507e85f69e3f4e..a5837493c25a6d470261edca0d30cea2990560cf 100644 (file)
@@ -89,6 +89,13 @@ else
   GRAPHITE_CONFIGURE:= --without-isl --without-cloog
 endif
 
+## sane and common defaults for different libc implementations
+export lt_cv_prog_compiler_static_works=yes
+export lt_cv_prog_compiler_static_works_CXX=yes
+export lt_cv_sys_max_cmd_len=1572864
+
+GCC_CONFIGURE_VARS :=
+
 GCC_CONFIGURE:= \
        SHELL="$(BASH)" \
        $(HOST_SOURCE_DIR)/configure \
@@ -222,6 +229,7 @@ endif
 
 define Host/Configure
        (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
+               $(if $(strip $(GCC_CONFIGURE_VARS)),export $(GCC_CONFIGURE_VARS)); \
                $(GCC_CONFIGURE) \
        );
 endef
index 78a5576bffb3b82659c8ad53584bdc69a76a8d53..6a190a14d7dc9c1a65c14279af302e6cee8481d4 100644 (file)
@@ -17,7 +17,7 @@ ifndef CONFIG_USE_GLIBC
 endif
 
 ifdef CONFIG_USE_MUSL
-  GCC_MAKE += gcc_cv_libc_provides_ssp=yes
+  GCC_CONFIGURE_VARS += gcc_cv_libc_provides_ssp=yes
 endif
 
 ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
@@ -39,6 +39,7 @@ define Host/Configure
        $(CleanupToolchain)
        mkdir -p $(GCC_BUILD_DIR)
        (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
+               $(if $(strip $(GCC_CONFIGURE_VARS)),export $(GCC_CONFIGURE_VARS)); \
                $(GCC_CONFIGURE) \
        );
 endef
@@ -53,7 +54,10 @@ endif
 
 define Host/Compile
        $(FixGogccCrt)
-       +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all
+
+       $(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
+               $(GCC_CONFIGURE_VARS) \
+               all
 endef
 
 define SetupExtraArch
@@ -71,7 +75,11 @@ endef
 
 define Host/Install
        $(CleanupToolchain)
-       +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) install
+
+       +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
+               $(GCC_CONFIGURE_VARS) \
+               install
+
        # Set up the symlinks to enable lying about target name.
        set -e; \
        (cd $(TOOLCHAIN_DIR); \
index 7cb4a73dbce0f7813ff956178e3b942ec738b1d4..6b8a66798bbeefcb508eecc60422bac8df1fd868 100644 (file)
@@ -12,6 +12,7 @@ GCC_CONFIGURE += \
 
 define Host/Compile
        +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
+               $(GCC_CONFIGURE_VARS) \
                all-build-libiberty \
                all-gcc \
                all-target-libgcc
@@ -19,6 +20,7 @@ endef
 
 define Host/Install
        +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
+               $(GCC_CONFIGURE_VARS) \
                install-gcc \
                install-target-libgcc
 
index 31d6f675abe134e1b2e3ffe1bc5a681c09d2ad95..83c17c8823bd36ab97eeba9b4a6e4701eed9d96c 100644 (file)
@@ -13,11 +13,17 @@ GCC_CONFIGURE += \
        --disable-threads
 
 define Host/Compile
-       +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all-gcc all-target-libgcc
+       +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
+               $(GCC_CONFIGURE_VARS) \
+               all-gcc \
+               all-target-libgcc
 endef
 
 define Host/Install
-       $(GCC_MAKE) -C $(GCC_BUILD_DIR) install-gcc install-target-libgcc
+       $(GCC_MAKE) -C $(GCC_BUILD_DIR) \
+               $(GCC_CONFIGURE_VARS) \
+               install-gcc \
+               install-target-libgcc
 endef
 
 define Host/Clean