Merge tag 'pci-v5.11-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
[linux-2.6-microblaze.git] / scripts / link-vmlinux.sh
index e6e2d9e..6eded32 100755 (executable)
@@ -169,10 +169,9 @@ gen_btf()
        printf '\1' | dd of=${2} conv=notrunc bs=1 seek=16 status=none
 }
 
-# Create ${2} .o file with all symbols from the ${1} object file
+# Create ${2} .S file with all symbols from the ${1} object file
 kallsyms()
 {
-       info KSYM ${2}
        local kallsymopt;
 
        if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
@@ -187,13 +186,8 @@ kallsyms()
                kallsymopt="${kallsymopt} --base-relative"
        fi
 
-       local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL}               \
-                     ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
-
-       local afile="`basename ${2} .o`.S"
-
-       ${NM} -n ${1} | scripts/kallsyms ${kallsymopt} > ${afile}
-       ${CC} ${aflags} -c -o ${2} ${afile}
+       info KSYMS ${2}
+       ${NM} -n ${1} | scripts/kallsyms ${kallsymopt} > ${2}
 }
 
 # Perform one step in kallsyms generation, including temporary linking of
@@ -203,9 +197,15 @@ kallsyms_step()
        kallsymso_prev=${kallsymso}
        kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1}
        kallsymso=${kallsyms_vmlinux}.o
+       kallsyms_S=${kallsyms_vmlinux}.S
 
        vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
-       kallsyms ${kallsyms_vmlinux} ${kallsymso}
+       kallsyms ${kallsyms_vmlinux} ${kallsyms_S}
+
+       info AS ${kallsyms_S}
+       ${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \
+             ${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
+             -c -o ${kallsymso} ${kallsyms_S}
 }
 
 # Create map file with all symbols from ${1}
@@ -341,9 +341,9 @@ fi
 vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
 
 # fill in BTF IDs
-if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
-info BTFIDS vmlinux
-${RESOLVE_BTFIDS} vmlinux
+if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then
+       info BTFIDS vmlinux
+       ${RESOLVE_BTFIDS} vmlinux
 fi
 
 if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then