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>
29 lines
753 B
Makefile
29 lines
753 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Makefile for the Linux/LoongArch kernel.
|
|
#
|
|
|
|
extra-y := vmlinux.lds
|
|
|
|
obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \
|
|
traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \
|
|
elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o
|
|
|
|
obj-$(CONFIG_ACPI) += acpi.o
|
|
obj-$(CONFIG_EFI) += efi.o
|
|
|
|
obj-$(CONFIG_CPU_HAS_FPU) += fpu.o
|
|
|
|
obj-$(CONFIG_MODULES) += module.o module-sections.o
|
|
obj-$(CONFIG_STACKTRACE) += stacktrace.o
|
|
|
|
obj-$(CONFIG_PROC_FS) += proc.o
|
|
|
|
obj-$(CONFIG_SMP) += smp.o
|
|
|
|
obj-$(CONFIG_NUMA) += numa.o
|
|
|
|
obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
|
|
obj-$(CONFIG_UNWINDER_PROLOGUE) += unwind_prologue.o
|
|
|
|
CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
|