Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

objtool/klp: Only enable --checksum when needed

With CONFIG_KLP_BUILD enabled, checksums are only needed during a
klp-build run. There's no need to enable them for normal kernel builds.

This also has the benefit of softening the xxhash dependency.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Link: https://patch.msgid.link/edbb1ca215e4926e02edb493b68b9d6d063e902f.1762990139.git.jpoimboe@kernel.org

authored by

Josh Poimboeuf and committed by
Peter Zijlstra
2092007a ee0b48fa

+5 -2
+1 -1
arch/x86/boot/startup/Makefile
··· 36 36 # relocations, even if other objtool actions are being deferred. 37 37 # 38 38 $(pi-objs): objtool-enabled = 1 39 - $(pi-objs): objtool-args = $(if $(delay-objtool),,$(objtool-args-y)) --noabs 39 + $(pi-objs): objtool-args = $(if $(delay-objtool),--dry-run,$(objtool-args-y)) --noabs 40 40 41 41 # 42 42 # Confine the startup code by prefixing all symbols with __pi_ (for position
-1
scripts/Makefile.lib
··· 173 173 174 174 objtool := $(objtree)/tools/objtool/objtool 175 175 176 - objtool-args-$(CONFIG_KLP_BUILD) += --checksum 177 176 objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label 178 177 objtool-args-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr 179 178 objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --hacks=skylake
+4
scripts/livepatch/klp-build
··· 489 489 490 490 build_kernel() { 491 491 local log="$TMP_DIR/build.log" 492 + local objtool_args=() 492 493 local cmd=() 494 + 495 + objtool_args=("--checksum") 493 496 494 497 cmd=("make") 495 498 ··· 516 513 cmd+=("$VERBOSE") 517 514 cmd+=("-j$JOBS") 518 515 cmd+=("KCFLAGS=-ffunction-sections -fdata-sections") 516 + cmd+=("OBJTOOL_ARGS=${objtool_args[*]}") 519 517 cmd+=("vmlinux") 520 518 cmd+=("modules") 521 519