summaryrefslogtreecommitdiff
path: root/scripts/link-vmlinux.sh
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-05-29 00:47:04 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-06-05 06:20:57 +0900
commitb42d2306502419688190aa6dd4dab4a6def24b3d (patch)
tree89a23a22dc7f90aacedb20c60f53723dd72ea562 /scripts/link-vmlinux.sh
parent5d45950dfbb1540bba3e3762a3497de8b4a715d3 (diff)
kbuild: factor out the common objtool arguments
scripts/Makefile.build and scripts/link-vmlinux.sh have similar setups for the objtool arguments. It was difficult to factor out them because all the vmlinux build rules were written in a shell script. It is somewhat tedious to touch the two files every time a new objtool option is supported. To reduce the code duplication, move the objtool for vmlinux.o into scripts/Makefile.vmlinux_o. Then, move the common macros to Makefile.lib so they are shared between Makefile.build and Makefile.vmlinux_o. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64)
Diffstat (limited to 'scripts/link-vmlinux.sh')
-rwxr-xr-xscripts/link-vmlinux.sh71
1 files changed, 0 insertions, 71 deletions
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index bf685d4547c1..eecc1863e556 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -45,76 +45,6 @@ info()
printf " %-7s %s\n" "${1}" "${2}"
}
-objtool_link()
-{
- local objtoolcmd;
- local objtoolopt;
-
- if ! is_enabled CONFIG_OBJTOOL; then
- return;
- fi
-
- if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then
-
- # For LTO and IBT, objtool doesn't run on individual
- # translation units. Run everything on vmlinux instead.
-
- if is_enabled CONFIG_HAVE_JUMP_LABEL_HACK; then
- objtoolopt="${objtoolopt} --hacks=jump_label"
- fi
-
- if is_enabled CONFIG_HAVE_NOINSTR_HACK; then
- objtoolopt="${objtoolopt} --hacks=noinstr"
- fi
-
- if is_enabled CONFIG_X86_KERNEL_IBT; then
- objtoolopt="${objtoolopt} --ibt"
- fi
-
- if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then
- objtoolopt="${objtoolopt} --mcount"
- fi
-
- if is_enabled CONFIG_UNWINDER_ORC; then
- objtoolopt="${objtoolopt} --orc"
- fi
-
- if is_enabled CONFIG_RETPOLINE; then
- objtoolopt="${objtoolopt} --retpoline"
- fi
-
- if is_enabled CONFIG_SLS; then
- objtoolopt="${objtoolopt} --sls"
- fi
-
- if is_enabled CONFIG_STACK_VALIDATION; then
- objtoolopt="${objtoolopt} --stackval"
- fi
-
- if is_enabled CONFIG_HAVE_STATIC_CALL_INLINE; then
- objtoolopt="${objtoolopt} --static-call"
- fi
-
- objtoolopt="${objtoolopt} --uaccess"
- fi
-
- if is_enabled CONFIG_NOINSTR_VALIDATION; then
- objtoolopt="${objtoolopt} --noinstr"
- fi
-
- if [ -n "${objtoolopt}" ]; then
-
- if is_enabled CONFIG_GCOV_KERNEL; then
- objtoolopt="${objtoolopt} --no-unreachable"
- fi
-
- objtoolopt="${objtoolopt} --link"
-
- info OBJTOOL ${1}
- tools/objtool/objtool ${objtoolopt} ${1}
- fi
-}
-
# Link of vmlinux
# ${1} - output file
# ${2}, ${3}, ... - optional extra .o files
@@ -298,7 +228,6 @@ ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1
#link vmlinux.o
${MAKE} -f "${srctree}/scripts/Makefile.vmlinux_o"
-objtool_link vmlinux.o
# Generate the list of in-tree objects in vmlinux
#