Skip to content

Commit 57841c8

Browse files
rockdrillaAnsuel
authored andcommitted
toolchain: gcc: make config consistent with glibc/musl
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 <[email protected]> Link: openwrt/openwrt#18646 Signed-off-by: Christian Marangi <[email protected]>
1 parent 89ee79b commit 57841c8

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

toolchain/gcc/common.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ else
8989
GRAPHITE_CONFIGURE:= --without-isl --without-cloog
9090
endif
9191

92+
## sane and common defaults for different libc implementations
93+
export lt_cv_prog_compiler_static_works=yes
94+
export lt_cv_prog_compiler_static_works_CXX=yes
95+
export lt_cv_sys_max_cmd_len=1572864
96+
97+
GCC_CONFIGURE_VARS :=
98+
9299
GCC_CONFIGURE:= \
93100
SHELL="$(BASH)" \
94101
$(HOST_SOURCE_DIR)/configure \
@@ -222,6 +229,7 @@ endif
222229

223230
define Host/Configure
224231
(cd $(GCC_BUILD_DIR) && rm -f config.cache; \
232+
$(if $(strip $(GCC_CONFIGURE_VARS)),export $(GCC_CONFIGURE_VARS)); \
225233
$(GCC_CONFIGURE) \
226234
);
227235
endef

toolchain/gcc/final/Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ifndef CONFIG_USE_GLIBC
1717
endif
1818

1919
ifdef CONFIG_USE_MUSL
20-
GCC_MAKE += gcc_cv_libc_provides_ssp=yes
20+
GCC_CONFIGURE_VARS += gcc_cv_libc_provides_ssp=yes
2121
endif
2222

2323
ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
@@ -39,6 +39,7 @@ define Host/Configure
3939
$(CleanupToolchain)
4040
mkdir -p $(GCC_BUILD_DIR)
4141
(cd $(GCC_BUILD_DIR) && rm -f config.cache; \
42+
$(if $(strip $(GCC_CONFIGURE_VARS)),export $(GCC_CONFIGURE_VARS)); \
4243
$(GCC_CONFIGURE) \
4344
);
4445
endef
@@ -53,7 +54,10 @@ endif
5354

5455
define Host/Compile
5556
$(FixGogccCrt)
56-
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all
57+
58+
$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
59+
$(GCC_CONFIGURE_VARS) \
60+
all
5761
endef
5862

5963
define SetupExtraArch
@@ -71,7 +75,11 @@ endef
7175

7276
define Host/Install
7377
$(CleanupToolchain)
74-
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) install
78+
79+
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
80+
$(GCC_CONFIGURE_VARS) \
81+
install
82+
7583
# Set up the symlinks to enable lying about target name.
7684
set -e; \
7785
(cd $(TOOLCHAIN_DIR); \

toolchain/gcc/initial/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ GCC_CONFIGURE += \
1212

1313
define Host/Compile
1414
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
15+
$(GCC_CONFIGURE_VARS) \
1516
all-build-libiberty \
1617
all-gcc \
1718
all-target-libgcc
1819
endef
1920

2021
define Host/Install
2122
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
23+
$(GCC_CONFIGURE_VARS) \
2224
install-gcc \
2325
install-target-libgcc
2426

toolchain/gcc/minimal/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ GCC_CONFIGURE += \
1313
--disable-threads
1414

1515
define Host/Compile
16-
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all-gcc all-target-libgcc
16+
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
17+
$(GCC_CONFIGURE_VARS) \
18+
all-gcc \
19+
all-target-libgcc
1720
endef
1821

1922
define Host/Install
20-
$(GCC_MAKE) -C $(GCC_BUILD_DIR) install-gcc install-target-libgcc
23+
$(GCC_MAKE) -C $(GCC_BUILD_DIR) \
24+
$(GCC_CONFIGURE_VARS) \
25+
install-gcc \
26+
install-target-libgcc
2127
endef
2228

2329
define Host/Clean

0 commit comments

Comments
 (0)