Skip to content

Commit 5737028

Browse files
author
Evgenii Shatokhin
committed
kpatch-build: fix gcc_version_check: both "GNU" and "GCC" are possible
This fix is an addition to 9fedd0d "kpatch-build: fix gcc_version_check". On some systems, the GCC version stored in vmlinux may have the following format: (GNU) 4.8.3 20140911 (Red Hat 4.8.3-9) while GCC returns (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9) As a result, binary patches cannot be built, although the compiler is the same. gcc_version_check() now takes this into account. Signed-off-by: Evgenii Shatokhin <eshatokhin@odin.com>
1 parent f152d00 commit 5737028

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kpatch-build/kpatch-build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ find_dirs() {
119119

120120
gcc_version_check() {
121121
# ensure gcc version matches that used to build the kernel
122-
local gccver=$(gcc --version |head -n1 |cut -d' ' -f2-)
123-
local kgccver=$(readelf -p .comment $VMLINUX |grep GCC: | tr -s ' ' | cut -d ' ' -f5-)
122+
local gccver=$(gcc --version | head -n1 | cut -d' ' -f2- | sed 's/GNU/GCC/g')
123+
local kgccver=$(readelf -p .comment $VMLINUX | grep GCC: | tr -s ' ' | cut -d ' ' -f5- | sed 's/GNU/GCC/g')
124124
if [[ "$gccver" != "$kgccver" ]]; then
125125
warn "gcc/kernel version mismatch"
126126
echo "gcc version: $gccver"

0 commit comments

Comments
 (0)