summaryrefslogtreecommitdiff
path: root/scripts/link-vmlinux.sh
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2026-10-11 01:22:02 +0100
committerNathan Chancellor <nathan@kernel.org>2026-10-11 01:22:02 +0100
commitfd26cc1da1ec4dbe4ca19d0c94f802ff4300a788 (patch)
treef343bf7e191d0567d77f8f352fdd53111b75e8e1 /scripts/link-vmlinux.sh
parent185b2c6a021ac46c62342fa814e5e2393f8396c5 (diff)
parentae5f6044c4cdffe2b3361b15c1d6fc67b339f2a4 (diff)
downloadlinux-next-fd26cc1da1ec4dbe4ca19d0c94f802ff4300a788.tar.gz
linux-next-fd26cc1da1ec4dbe4ca19d0c94f802ff4300a788.zip
Merge branch 'kbuild-next-speedups' into kbuild-for-next
* kbuild-next-speedups: kbuild: Mark the initcall ordering recipe as recursive kbuild: Mark the gzip recipes as recursive kconfig: Improve ergonomics around disabling warnings with cc-option scripts/Kconfig.toolchain: Drop compiler symbols from dependencies kbuild: keep .modinfo when vmlinux is linked with --gc-sections kbuild: compress the kernel with pigz if available kbuild: avoid re-running compiler and linker probes kbuild: move the toolchain checks into scripts/Kconfig.toolchain kallsyms: reimplement mksysmap in C elf-parse: add section flags, symbol binding and mapping helpers kbuild: only emit vmlinux relocations when required kbuild: do not sort nm output where the order is irrelevant sorttable: parse nm output correctly kallsyms: output binary data to speed output and kallsyms assembly kallsyms: index symbols by token to speed up table compression kbuild: do not allocate .modinfo in vmlinux Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts/link-vmlinux.sh')
-rwxr-xr-xscripts/link-vmlinux.sh24
1 files changed, 15 insertions, 9 deletions
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index ab0b8125c8cb..c520741f85c2 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -96,6 +96,11 @@ vmlinux_link()
ldflags="${ldflags} ${wl}--strip-debug"
fi
+ # Only the final link actually requires the relocations.
+ if [ "${output}" = "${VMLINUX}" ] && is_enabled CONFIG_ARCH_VMLINUX_NEEDS_RELOCS; then
+ ldflags="${ldflags} ${wl}--emit-relocs"
+ fi
+
if [ -n "${generate_map}" ]; then
ldflags="${ldflags} ${wl}-Map=vmlinux.map"
fi
@@ -118,11 +123,15 @@ kallsymso_changed()
! cmp -s "${kallsymso_prev}.sym" "${kallsymso}.sym"
}
-# Create ${2}.o file with all symbols from the ${1} object file
+# Create ${2}.o with the kallsyms tables for ${1} (the vmlinux, or an empty
+# listing for the first pass); list the symbols used in ${3} if given.
kallsyms()
{
local kallsymopt;
+ if [ -n "${3:-}" ]; then
+ kallsymopt="--sysmap=${3}"
+ fi
if is_enabled CONFIG_KALLSYMS_ALL; then
kallsymopt="${kallsymopt} --all-symbols"
fi
@@ -132,7 +141,7 @@ kallsyms()
fi
info KSYMS "${2}.S"
- scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S"
+ scripts/kallsyms ${kallsymopt} "${1}" "${2}.bin" > "${2}.S"
info AS "${2}.o"
${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \
@@ -145,23 +154,20 @@ kallsyms()
# Perform kallsyms for the given temporary vmlinux.
sysmap_and_kallsyms()
{
- mksysmap "${1}" "${1}.syms"
- kallsyms "${1}.syms" "${1}.kallsyms"
-
+ kallsyms "${1}" "${1}.kallsyms" "${1}.syms"
kallsyms_sysmap=${1}.syms
}
# Create map file with all symbols from ${1}
-# See mksymap for additional details
mksysmap()
{
- info NM ${2}
- ${NM} -n "${1}" | sed -f "${srctree}/scripts/mksysmap" > "${2}"
+ info SYSMAP ${2}
+ scripts/kallsyms --sysmap="${2}" "${1}"
}
sorttable()
{
- ${NM} -S ${1} > .tmp_vmlinux.nm-sort
+ ${NM} -p -S ${1} > .tmp_vmlinux.nm-sort
${objtree}/scripts/sorttable -s .tmp_vmlinux.nm-sort ${1}
}