Commit 6804c1af authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar
Browse files

kbuild/objtool: Add objtool-vmlinux.o pass



Now that objtool is capable of processing vmlinux.o and actually has
something useful to do there, (conditionally) add it to the final link
pass.

This will increase build time by a few seconds.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
Reviewed-by: default avatarAlexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200416115119.287494491@infradead.org


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 87ecb582
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -369,6 +369,11 @@ config STACK_VALIDATION
	  For more information, see
	  tools/objtool/Documentation/stack-validation.txt.

config VMLINUX_VALIDATION
	bool
	depends on STACK_VALIDATION && DEBUG_ENTRY && !PARAVIRT
	default y

config DEBUG_FORCE_WEAK_PER_CPU
	bool "Force weak per-cpu definitions"
	depends on DEBUG_KERNEL
+24 −0
Original line number Diff line number Diff line
@@ -55,6 +55,29 @@ modpost_link()
	${LD} ${KBUILD_LDFLAGS} -r -o ${1} ${objects}
}

objtool_link()
{
	local objtoolopt;

	if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then
		objtoolopt="check"
		if [ -z "${CONFIG_FRAME_POINTER}" ]; then
			objtoolopt="${objtoolopt} --no-fp"
		fi
		if [ -n "${CONFIG_GCOV_KERNEL}" ]; then
			objtoolopt="${objtoolopt} --no-unreachable"
		fi
		if [ -n "${CONFIG_RETPOLINE}" ]; then
			objtoolopt="${objtoolopt} --retpoline"
		fi
		if [ -n "${CONFIG_X86_SMAP}" ]; then
			objtoolopt="${objtoolopt} --uaccess"
		fi
		info OBJTOOL ${1}
		tools/objtool/objtool ${objtoolopt} ${1}
	fi
}

# Link of vmlinux
# ${1} - output file
# ${2}, ${3}, ... - optional extra .o files
@@ -251,6 +274,7 @@ ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1
#link vmlinux.o
info LD vmlinux.o
modpost_link vmlinux.o
objtool_link vmlinux.o

# modpost vmlinux.o to check for section mismatches
${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1