kpatch-build: check if gcc supports -gz=none

The flag -gz[=type] was added in GCC 5. To support older GCC versions
check if the flag is supported before adding it to KCFLAGS.

Fixes: #1012

Signed-off-by: Stefan Strogin <steils@gentoo.org>
This commit is contained in:
Stefan Strogin 2019-07-31 10:58:06 +03:00
parent ea0e6f0144
commit 14b094484e
No known key found for this signature in database
GPG Key ID: C9BA45A74454054D

View File

@ -50,6 +50,7 @@ DEBUG=0
SKIPCLEANUP=0
SKIPGCCCHECK=0
ARCH_KCFLAGS=""
DEBUG_KCFLAGS=""
declare -a PATCH_LIST
APPLIED_PATCHES=0
OOT_MODULE=
@ -205,7 +206,6 @@ gcc_version_check() {
else
kgccver="$(gcc_version_from_file "$VMLINUX")"
fi
rm -f "$c" "$o"
if [[ -n "$out" ]]; then
warn "gcc >= 4.8 required for -pg -ffunction-settings"
@ -213,6 +213,12 @@ gcc_version_check() {
return 1
fi
out="$(gcc -c -gz=none -o "$o" "$c" 2>&1)"
if [[ -z "$out" ]]; then
DEBUG_KCFLAGS="-gz=none"
fi
rm -f "$c" "$o"
# ensure gcc version matches that used to build the kernel
if [[ "$gccver" != "$kgccver" ]]; then
warn "gcc/kernel version mismatch"
@ -748,7 +754,8 @@ if [[ "$ARCH" = "ppc64le" ]]; then
ARCH_KCFLAGS="-mcmodel=large -fplugin=$PLUGINDIR/ppc64le-plugin.so"
fi
export KCFLAGS="-I$DATADIR/patch -ffunction-sections -fdata-sections -gz=none $ARCH_KCFLAGS"
export KCFLAGS="-I$DATADIR/patch -ffunction-sections -fdata-sections \
$ARCH_KCFLAGS $DEBUG_KCFLAGS"
echo "Reading special section data"
find_special_section_data