kbuild: use obj-y instead extra-y for objects placed at the head
The objects placed at the head of vmlinux need special treatments: - arch/$(SRCARCH)/Makefile adds them to head-y in order to place them before other archives in the linker command line. - arch/$(SRCARCH)/kernel/Makefile adds them to extra-y instead of obj-y to avoid them going into built-in.a. This commit gets rid of the latter. Create vmlinux.a to collect all the objects that are unconditionally linked to vmlinux. The objects listed in head-y are moved to the head of vmlinux.a by using 'ar m'. With this, arch/$(SRCARCH)/kernel/Makefile can consistently use obj-y for builtin objects. There is no *.o that is directly linked to vmlinux. Drop unneeded code in scripts/clang-tools/gen_compile_commands.py. $(AR) mPi needs 'T' to workaround the llvm-ar bug. The fix was suggested by Nathan Chancellor [1]. [1]: https://lore.kernel.org/llvm/YyjjT5gQ2hGMH0ni@dev-arch.thelio-3990X/ Signed-off-by:Masahiro Yamada <masahiroy@kernel.org> Tested-by:
Nick Desaulniers <ndesaulniers@google.com> Reviewed-by:
Nicolas Schier <nicolas@fjasle.eu>
Showing
- Documentation/kbuild/makefiles.rst 1 addition, 17 deletionsDocumentation/kbuild/makefiles.rst
- Makefile 18 additions, 5 deletionsMakefile
- arch/alpha/kernel/Makefile 2 additions, 2 deletionsarch/alpha/kernel/Makefile
- arch/arc/kernel/Makefile 2 additions, 2 deletionsarch/arc/kernel/Makefile
- arch/arm/kernel/Makefile 2 additions, 2 deletionsarch/arm/kernel/Makefile
- arch/arm64/kernel/Makefile 2 additions, 2 deletionsarch/arm64/kernel/Makefile
- arch/csky/kernel/Makefile 2 additions, 2 deletionsarch/csky/kernel/Makefile
- arch/hexagon/kernel/Makefile 2 additions, 1 deletionarch/hexagon/kernel/Makefile
- arch/ia64/kernel/Makefile 2 additions, 2 deletionsarch/ia64/kernel/Makefile
- arch/loongarch/kernel/Makefile 2 additions, 2 deletionsarch/loongarch/kernel/Makefile
- arch/m68k/68000/Makefile 1 addition, 1 deletionarch/m68k/68000/Makefile
- arch/m68k/coldfire/Makefile 1 addition, 1 deletionarch/m68k/coldfire/Makefile
- arch/m68k/kernel/Makefile 12 additions, 11 deletionsarch/m68k/kernel/Makefile
- arch/microblaze/kernel/Makefile 2 additions, 2 deletionsarch/microblaze/kernel/Makefile
- arch/mips/kernel/Makefile 2 additions, 2 deletionsarch/mips/kernel/Makefile
- arch/nios2/kernel/Makefile 1 addition, 1 deletionarch/nios2/kernel/Makefile
- arch/openrisc/kernel/Makefile 2 additions, 2 deletionsarch/openrisc/kernel/Makefile
- arch/parisc/kernel/Makefile 2 additions, 2 deletionsarch/parisc/kernel/Makefile
- arch/powerpc/kernel/Makefile 10 additions, 10 deletionsarch/powerpc/kernel/Makefile
- arch/riscv/kernel/Makefile 1 addition, 1 deletionarch/riscv/kernel/Makefile
Loading
Please register or sign in to comment