mirror of
https://github.com/dynup/kpatch
synced 2024-12-21 12:50:01 +00:00
4c40c3ff4b
After changing the gcc name in a linux tree to gcc72, kpatch-build failed to produce hotpatches with the error message "ERROR: no changed objects found." This is due to a wrapper script called kpatch-gcc, called while kpatch-build builds the kernel, which checks if the compiler name matches exactly gcc, failing the check when comparing to gcc72, and thus not producing the expected file changed_objs containing the list of changed objects. This commit fixes this issue by loosening the check on the gcc name. Signed-off-by: Bruno Loreto <loretob@amazon.com> Reviewed-by: Bjoern Doebel <doebel@amazon.com> Reviewed-by: Amit Shah <aams@amazon.com> Reviewed-by: Pawel Wieczorkiewicz <wipawel@amazon.com>
88 lines
1.8 KiB
Bash
Executable File
88 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ ${KPATCH_GCC_DEBUG:-0} -ne 0 ]]; then
|
|
set -o xtrace
|
|
fi
|
|
|
|
TOOLCHAINCMD="$1"
|
|
shift
|
|
|
|
if [[ -z "$KPATCH_GCC_TEMPDIR" ]]; then
|
|
exec "$TOOLCHAINCMD" "$@"
|
|
fi
|
|
|
|
declare -a args=("$@")
|
|
|
|
if [[ "$TOOLCHAINCMD" =~ "gcc" ]] ; then
|
|
while [ "$#" -gt 0 ]; do
|
|
if [ "$1" = "-o" ]; then
|
|
obj="$2"
|
|
|
|
# skip copying the temporary .o files created by
|
|
# recordmcount.pl
|
|
[[ "$obj" = */.tmp_mc_*.o ]] && break;
|
|
|
|
[[ "$obj" = */.tmp_*.o ]] && obj="${obj/.tmp_/}"
|
|
relobj=${obj//$KPATCH_GCC_SRCDIR\//}
|
|
case "$relobj" in
|
|
*.mod.o|\
|
|
*built-in.o|\
|
|
*built-in.a|\
|
|
vmlinux.o|\
|
|
.tmp_kallsyms1.o|\
|
|
.tmp_kallsyms2.o|\
|
|
init/version.o|\
|
|
arch/x86/boot/version.o|\
|
|
arch/x86/boot/compressed/eboot.o|\
|
|
arch/x86/boot/header.o|\
|
|
arch/x86/boot/compressed/efi_stub_64.o|\
|
|
arch/x86/boot/compressed/piggy.o|\
|
|
kernel/system_certificates.o|\
|
|
arch/x86/vdso/*|\
|
|
arch/x86/entry/vdso/*|\
|
|
drivers/firmware/efi/libstub/*|\
|
|
arch/powerpc/kernel/prom_init.o|\
|
|
lib/*|\
|
|
.*.o|\
|
|
*/.lib_exports.o)
|
|
break
|
|
;;
|
|
*.o)
|
|
mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")"
|
|
[[ -e "$obj" ]] && cp -f "$obj" "$KPATCH_GCC_TEMPDIR/orig/$relobj"
|
|
echo "$relobj" >> "$KPATCH_GCC_TEMPDIR/changed_objs"
|
|
break
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
fi
|
|
shift
|
|
done
|
|
elif [[ "$TOOLCHAINCMD" = "ld" ]] ; then
|
|
while [ "$#" -gt 0 ]; do
|
|
if [ "$1" = "-o" ]; then
|
|
obj="$2"
|
|
relobj=${obj//$KPATCH_GCC_SRCDIR\//}
|
|
case "$obj" in
|
|
*.ko)
|
|
mkdir -p "$KPATCH_GCC_TEMPDIR/module/$(dirname "$relobj")"
|
|
cp -f "$obj" "$KPATCH_GCC_TEMPDIR/module/$relobj"
|
|
break
|
|
;;
|
|
.tmp_vmlinux*|vmlinux)
|
|
args+=(--warn-unresolved-symbols)
|
|
break
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
fi
|
|
shift
|
|
done
|
|
fi
|
|
|
|
exec "$TOOLCHAINCMD" "${args[@]}"
|