diff options
author | Nik Konyuchenko <spaun2002mobile@gmail.com> | 2021-06-24 00:51:21 -0700 |
---|---|---|
committer | Nik Konyuchenko <spaun2002mobile@gmail.com> | 2021-06-24 00:58:32 -0700 |
commit | 05c67589851c70df19a94d5a00b6634681f08bcd (patch) | |
tree | b7fe363792f97356f5ff6c02bcf26e1a52c93d15 | |
parent | c7996054b5f7520b94839427f3f1f19acea409b0 (diff) | |
download | crosstool-ng-05c67589851c70df19a94d5a00b6634681f08bcd.tar.gz crosstool-ng-05c67589851c70df19a94d5a00b6634681f08bcd.tar.bz2 crosstool-ng-05c67589851c70df19a94d5a00b6634681f08bcd.zip |
Fix build of older Glibc using GCC >=10
Issue #1535
GCC 10 changed the default to -fno-common, which leads to a linking error in GLibc older than 2.30.
This change adds -fcommon cflag for the target GLibc versions <=2.29 and GCC >=10.
This change also adds additional cflags for the target GLibc to disable
new GCC11 checks that lead to compilation errors.
Signed-off-by: Nik Konyuchenko <spaun2002mobile@gmail.com>
-rw-r--r-- | config/libc/glibc.in | 7 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/config/libc/glibc.in b/config/libc/glibc.in index 5a3b1b8c..b2cf0dae 100644 --- a/config/libc/glibc.in +++ b/config/libc/glibc.in @@ -181,6 +181,7 @@ config GLIBC_CONFIGPARMS config GLIBC_EXTRA_CFLAGS string prompt "extra target CFLAGS" + default "-Wno-missing-attributes -Wno-array-bounds -Wno-array-parameter -Wno-stringop-overflow -Wno-maybe-uninitialized" if GLIBC_2_29_or_older && GCC_11_or_later default "" help Extra target CFLAGS to use when building. @@ -416,4 +417,10 @@ config GLIBC_ENABLE_WERROR endif +config GLIBC_ENABLE_COMMON_FLAG + bool "Enable -fcommon flag for older version of glibc when using GCC >=10" + default y if GLIBC_2_29_or_older && GCC_10_or_later + default n if GLIBC_2_30_or_later || GCC_9_or_older + + endif # KERNEL_LINUX diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index ba6e5482..0db7c1c0 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -201,6 +201,10 @@ glibc_backend_once() # glibc can't be built without -O2 (reference needed!) glibc_cflags+=" -g -O2" + if [ "${CT_GLIBC_ENABLE_COMMON_FLAG}" = "y" ]; then + glibc_cflags+=" -fcommon" + fi + case "${CT_GLIBC_ENABLE_FORTIFIED_BUILD}" in y) ;; *) glibc_cflags+=" -U_FORTIFY_SOURCE";; |