diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2024-06-10 20:25:17 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2024-07-16 01:08:36 +0900 |
commit | c442db3f49f27e5a60a641b2ac9a3c6320796ed6 (patch) | |
tree | 665aa0090b4e1c77ce6e2c2d1b89111c8a5a333e /scripts/link-vmlinux.sh | |
parent | ddf41329839f49dadf26973cd845ea160ac1784d (diff) | |
download | linux-c442db3f49f27e5a60a641b2ac9a3c6320796ed6.tar.gz linux-c442db3f49f27e5a60a641b2ac9a3c6320796ed6.tar.bz2 linux-c442db3f49f27e5a60a641b2ac9a3c6320796ed6.zip |
kbuild: remove PROVIDE() for kallsyms symbols
This reimplements commit 951bcae6c5a0 ("kallsyms: Avoid weak references
for kallsyms symbols") because I am not a big fan of PROVIDE().
As an alternative solution, this commit prepends one more kallsyms step.
KSYMS .tmp_vmlinux.kallsyms0.S # added
AS .tmp_vmlinux.kallsyms0.o # added
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.o
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.o
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.o
LD vmlinux
Step 0 takes /dev/null as input, and generates .tmp_vmlinux.kallsyms0.o,
which has a valid kallsyms format with the empty symbol list, and can be
linked to vmlinux. Since it is really small, the added compile-time cost
is negligible.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/link-vmlinux.sh')
-rwxr-xr-x | scripts/link-vmlinux.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 3d9d7257143a..83d605ba7241 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -227,6 +227,10 @@ btf_vmlinux_bin_o= kallsymso= strip_debug= +if is_enabled CONFIG_KALLSYMS; then + kallsyms /dev/null .tmp_vmlinux.kallsyms0 +fi + if is_enabled CONFIG_DEBUG_INFO_BTF; then if ! gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then echo >&2 "Failed to generate BTF for vmlinux" @@ -239,9 +243,10 @@ if is_enabled CONFIG_KALLSYMS; then # kallsyms support # Generate section listing all symbols and add it into vmlinux - # It's a three step process: + # It's a four step process: + # 0) Generate a dummy __kallsyms with empty symbol list. # 1) Link .tmp_vmlinux.kallsyms1 so it has all symbols and sections, - # but __kallsyms is empty. + # with a dummy __kallsyms. # Running kallsyms on that gives us .tmp_kallsyms1.o with # the right size # 2) Link .tmp_vmlinux.kallsyms2 so it now has a __kallsyms section of |