From 05c67589851c70df19a94d5a00b6634681f08bcd Mon Sep 17 00:00:00 2001 From: Nik Konyuchenko Date: Thu, 24 Jun 2021 00:51:21 -0700 Subject: 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 --- scripts/build/libc/glibc.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts/build/libc/glibc.sh') 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";; -- cgit v1.2.3