Re: [PATCH v2 7/8] kbuild: use obj-y instead extra-y for objects placed at the head
From: Masahiro Yamada
Date: Thu Sep 08 2022 - 03:16:49 EST
On Tue, Sep 6, 2022 at 3:13 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> 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.
>
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> ---
>
> (no changes since v1)
>
> @@ -198,12 +198,12 @@ KCOV_INSTRUMENT_paca.o := n
> CFLAGS_setup_64.o += -fno-stack-protector
> CFLAGS_paca.o += -fno-stack-protector
>
> -extra-$(CONFIG_PPC_FPU) += fpu.o
> -extra-$(CONFIG_ALTIVEC) += vector.o
> -extra-$(CONFIG_PPC64) += entry_64.o
> -extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o
> +obj-$(CONFIG_PPC_FPU) += fpu.o
> +obj-$(CONFIG_ALTIVEC) += vector.o
> +obj-$(CONFIG_PPC64) += entry_64.o
> +obj-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o
>
> -extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check
> +obj-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check
This line should not be changed.
I fixed it up locally.
https://lore.kernel.org/lkml/CAK7LNARzFmJjpyUciy1LRvaFo72aZcqRbzY-63ArpeszC+HfmQ@xxxxxxxxxxxxxx/
--
Best Regards
Masahiro Yamada