Merge tag 'lkdtm-next' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux...
[linux-2.6-microblaze.git] / scripts / link-vmlinux.sh
index 666f7bb..9361a1e 100755 (executable)
@@ -50,7 +50,7 @@ gen_initcalls()
 {
        info GEN .tmp_initcalls.lds
 
-       ${PYTHON} ${srctree}/scripts/jobserver-exec             \
+       ${PYTHON3} ${srctree}/scripts/jobserver-exec            \
        ${PERL} ${srctree}/scripts/generate_initcall_order.pl   \
                ${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS}   \
                > .tmp_initcalls.lds
@@ -108,14 +108,20 @@ objtool_link()
        local objtoolcmd;
        local objtoolopt;
 
-       if is_enabled CONFIG_LTO_CLANG && is_enabled CONFIG_STACK_VALIDATION; then
+       if is_enabled CONFIG_STACK_VALIDATION && \
+          ( is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT ); then
+
                # Don't perform vmlinux validation unless explicitly requested,
                # but run objtool on vmlinux.o now that we have an object file.
                if is_enabled CONFIG_UNWINDER_ORC; then
                        objtoolcmd="orc generate"
                fi
 
-               objtoolopt="${objtoolopt} --duplicate"
+               objtoolopt="${objtoolopt} --lto"
+
+               if is_enabled CONFIG_X86_KERNEL_IBT; then
+                       objtoolopt="${objtoolopt} --ibt"
+               fi
 
                if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then
                        objtoolopt="${objtoolopt} --mcount"
@@ -134,7 +140,7 @@ objtool_link()
                if ! is_enabled CONFIG_FRAME_POINTER; then
                        objtoolopt="${objtoolopt} --no-fp"
                fi
-               if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then
+               if is_enabled CONFIG_GCOV_KERNEL; then
                        objtoolopt="${objtoolopt} --no-unreachable"
                fi
                if is_enabled CONFIG_RETPOLINE; then
@@ -168,7 +174,7 @@ vmlinux_link()
        # skip output file argument
        shift
 
-       if is_enabled CONFIG_LTO_CLANG; then
+       if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then
                # Use vmlinux.o instead of performing the slow LTO link again.
                objs=vmlinux.o
                libs=