Merge pull request #1539 from nikkon-dev/nikkon-dev/old_glibc_fix

Fix build of older Glibc using GCC >=10
This commit is contained in:
Chris Packham 2021-06-28 19:35:04 +12:00 committed by GitHub
commit 94b98a4cc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -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,12 @@ 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
help
Starting from GCC 10, the default behavior is changed to -fno-common.
That leads to linking errors in GLibc versions older than 2.30.
endif # KERNEL_LINUX

View File

@ -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";;