kpatch/kpatch-build/kpatch-gcc
Kamalesh Babulal c14e6e9118 kpatch-build: Add PPC64le livepatch support
This patch adds support for livepatch hook based module
creation for PPC64le. It introduces PPC64le architecture
bits:
- Add relocation type of R_PPC64_ADDR64 while parsing powerpc ELF.
- Introduce .toc sections mainpulation.
- Skip kpatch specific details for livepatch hook.

Also remove the definition of rela_insn() for powerpc. The only
call site is been guarded by #ifdef x86.

Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
2017-07-26 14:40:37 +05:30

79 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 original .o files, when .tmp_mc_*.o
# is passed from 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)
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[@]}"