mirror of
https://github.com/dynup/kpatch
synced 2025-01-04 20:19:36 +00:00
ec98604f80
When there is a ".." in the source object path, kpatch-gcc can't handle
it correctly. kpatch-gcc is called for objects which were recompiled
and writes the changed objects to "changed_objs". But if the path of the
input obj is something like:
arch/x86/kvm/../../../virt/kvm/.tmp_kvm_main.o
then it will fall into the "*.*.o" branch of the kpatch-gcc case
statement and kpatch-build will report "ERROR: no changed objects
found."
Use Joe's suggestion to revert d526805619
("kpatch-gcc: update
ignorelist to avoid foo/.lib_exports.o files") and instead add a
"*/.lib_exports.o" pattern.
Fixes #735.
[ cleaned up changelog - jpoimboe@redhat.com ]
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: chen xiaoguang <xiaoggchen@tencent.com>
82 lines
1.6 KiB
Bash
Executable File
82 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
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_/}
|
|
case "$obj" in
|
|
*.mod.o|\
|
|
*built-in.o|\
|
|
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|\
|
|
.*.o|\
|
|
*/.lib_exports.o)
|
|
break
|
|
;;
|
|
*.o)
|
|
mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname $obj)"
|
|
[[ -e $obj ]] && cp -f "$obj" "$KPATCH_GCC_TEMPDIR/orig/$obj"
|
|
echo "$obj" >> "$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
|
|
case "$obj" in
|
|
*.ko)
|
|
mkdir -p "$KPATCH_GCC_TEMPDIR/module/$(dirname $obj)"
|
|
cp -f "$obj" "$KPATCH_GCC_TEMPDIR/module/$obj"
|
|
break
|
|
;;
|
|
.tmp_vmlinux*|vmlinux)
|
|
args+=(--warn-unresolved-symbols)
|
|
break
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
fi
|
|
shift
|
|
done
|
|
fi
|
|
|
|
exec "$TOOLCHAINCMD" "${args[@]}"
|