diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index be3fdd897a8d..ce73d77f1f53 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -110,18 +110,12 @@ vmlinux_link() local lds="${objtree}/${KBUILD_LDS}" local output=${1} local objects - local strip_debug info LD ${output} # skip output file argument shift - # The kallsyms linking does not need debug symbols included. - if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then - strip_debug=-Wl,--strip-debug - fi - if [ "${SRCARCH}" != "um" ]; then if [ -n "${CONFIG_LTO_CLANG}" ]; then # Use vmlinux.o instead of performing the slow LTO @@ -141,7 +135,6 @@ vmlinux_link() fi ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \ - ${strip_debug#-Wl,} \ -o ${output} \ -T ${lds} ${objects} else @@ -154,7 +147,6 @@ vmlinux_link() ${@}" ${CC} ${CFLAGS_vmlinux} \ - ${strip_debug} \ -o ${output} \ -Wl,-T,${lds} \ ${objects} \ @@ -181,9 +173,8 @@ gen_btf() return 1 fi - vmlinux_link ${1} - info "BTF" ${2} + vmlinux_link ${1} LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} # Create ${2} which contains just .BTF section but no symbols. Add @@ -230,8 +221,8 @@ kallsyms() kallsyms_step() { kallsymso_prev=${kallsymso} - kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1} - kallsymso=${kallsyms_vmlinux}.o + kallsymso=.tmp_kallsyms${1}.o + kallsyms_vmlinux=.tmp_vmlinux${1} vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o} kallsyms ${kallsyms_vmlinux} ${kallsymso} @@ -254,6 +245,7 @@ cleanup() { rm -f .btf.* rm -f .tmp_System.map + rm -f .tmp_kallsyms* rm -f .tmp_lto.lds rm -f .tmp_vmlinux* rm -f System.map @@ -325,8 +317,9 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | btf_vmlinux_bin_o="" if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then - btf_vmlinux_bin_o=.btf.vmlinux.bin.o - if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then + if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then + btf_vmlinux_bin_o=.btf.vmlinux.bin.o + else echo >&2 "Failed to generate BTF for vmlinux" echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF" exit 1