kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS (2nd attempt)
PATCH 1/1 kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS (2nd attempt)
If CONFIG_TRIM_UNUSED_KSYMS is enabled and the kernel is built from a pristine state, the vmlinux is linked twice.
Commit 3fdc7d3fe4c0 ("kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS") explains why this happens, but it did not fix the issue at all.
Now I realized I had applied a wrong patch.
In v1 patch [1], the autoksyms_recursive target correctly recurses to "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive".
In v2 patch [2], I accidentally dropped the diff line, and it recurses to "$(MAKE) -f $(srctree)/Makefile vmlinux".
Restore the code I intended in v1.
[1]: https://lore.kernel.org/linux-kbuild/[email protected]/
[2]: https://lore.kernel.org/linux-kbuild/[email protected]/
---
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1141,7 +1141,7 @@ KBUILD_MODULES := 1 autoksyms_recursive: descend modules.order $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ - "$(MAKE) -f $(srctree)/Makefile vmlinux" + "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive" endif autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
Signature · 1 line
2.34.1
Quoted 33 lines · Masahiro Yamada
If
CONFIG_TRIM_UNUSED_KSYMSis enabled and the kernel is built from a pristine state, the vmlinux is linked twice.Commit
3fdc7d3fe4c0("kbuild: link vmlinux only once forCONFIG_TRIM_UNUSED_KSYMS") explains why this happens, but it did not fix the issue at all.Now I realized I had applied a wrong patch.
In v1 patch [1], the
autoksyms_recursivetarget correctly recurses to "$(MAKE) -f $(srctree)/Makefileautoksyms_recursive".In v2 patch [2], I accidentally dropped the diff line, and it recurses to "$(MAKE) -f $(srctree)/Makefile vmlinux".
Restore the code I intended in v1.
[1]: https://lore.kernel.org/linux-kbuild/[email protected]/
[2]: https://lore.kernel.org/linux-kbuild/[email protected]/Fixes 3fdc7d3fe4c0 ("kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS")Signed-off-by Masahiro Yamada <[email protected]>---
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +0
-0
Makefile KBUILD_MODULES := 1 · line 1147
Quoted 8 lines
Makefile +1
-1@@ -1141,7 +1141,7 @@ KBUILD_MODULES := 1 autoksyms_recursive: descend modules.order $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ - "$(MAKE) -f $(srctree)/Makefile vmlinux" + "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive" endif autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
Thanks for looking into this, Masahiro! I can confirm that this patch fixes the issue with vmlinux getting linked twice in our use case.
Sami
Quoted 16 lines · Masahiro Yamada
If
CONFIG_TRIM_UNUSED_KSYMSis enabled and the kernel is built from a pristine state, the vmlinux is linked twice.Commit
3fdc7d3fe4c0("kbuild: link vmlinux only once forCONFIG_TRIM_UNUSED_KSYMS") explains why this happens, but it did not fix the issue at all.Now I realized I had applied a wrong patch.
In v1 patch [1], the
autoksyms_recursivetarget correctly recurses to "$(MAKE) -f $(srctree)/Makefileautoksyms_recursive".In v2 patch [2], I accidentally dropped the diff line, and it recurses to "$(MAKE) -f $(srctree)/Makefile vmlinux".
Quoted 7 lines
Restore the code I intended in v1.
[1]: https://lore.kernel.org/linux-kbuild/[email protected]/
[2]: https://lore.kernel.org/linux-kbuild/[email protected]/Fixes 3fdc7d3fe4c0 ("kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS")Signed-off-by Masahiro Yamada <[email protected]>
Thanks for digging into this more!
Quoted 21 lines
---
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-2@@ -1141,7 +1141,7 @@ KBUILD_MODULES := 1 autoksyms_recursive: descend modules.order $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ - "$(MAKE) -f $(srctree)/Makefile vmlinux" + "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive" endif autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) --2.34.1
Signature · 2 lines
Thanks, ~Nick Desaulniers