linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Masahiro Yamada" <masahiroy@kernel.org>, linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Linux-Arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH v2 8/8] kbuild: remove head-y syntax
Date: Tue, 06 Sep 2022 09:59:39 +0200	[thread overview]
Message-ID: <f76020e2-e8bd-4f75-a697-3d6ec6665969@www.fastmail.com> (raw)
In-Reply-To: <20220906061313.1445810-9-masahiroy@kernel.org>

On Tue, Sep 6, 2022, at 8:13 AM, Masahiro Yamada wrote:
> Kbuild puts the objects listed in head-y at the head of vmlinux.
> Conventionally, we do this for head*.S, which contains the kernel entry
> point.
>
> A counter approach is to control the section order by the linker script.
> Actually, the code marked as __HEAD goes into the ".head.text" section,
> which is placed before the normal ".text" section.
>
> I do not know if both of them are needed. From the build system
> perspective, head-y is not mandatory. If you can achieve the proper code
> placement by the linker script only, it would be cleaner.
>
> I collected the current head-y objects into head-object-list.txt. It is
> a whitelist. My hope is it will be reduced in the long run.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

The scripts/head-object-list.txt approach feels a little awkward,
so overall I'm not convinced that this is an improvement as long
as there is no final decision for what should be done instead.

If the .head.text section approach works, maybe convert at
a minimum the x86 and arm64 architectures to provide an example
of what it should look like in the end, otherwise I doubt that
any architecture maintainers are going to work on removing their
architectures from the head-object-list.txt file.

> +arch/alpha/kernel/head.o
> +arch/arc/kernel/head.o
> +arch/arm/kernel/head-nommu.o
> +arch/arm/kernel/head.o
> +arch/arm64/kernel/head.o
> +arch/csky/kernel/head.o
> +arch/hexagon/kernel/head.o
> +arch/ia64/kernel/head.o
> +arch/loongarch/kernel/head.o
> +arch/m68k/68000/head.o
> +arch/m68k/coldfire/head.o
> +arch/m68k/kernel/head.o
> +arch/m68k/kernel/sun3-head.o
> +arch/microblaze/kernel/head.o
> +arch/mips/kernel/head.o
> +arch/nios2/kernel/head.o
> +arch/openrisc/kernel/head.o
> +arch/parisc/kernel/head.o
> +arch/powerpc/kernel/head_40x.o
> +arch/powerpc/kernel/head_44x.o
> +arch/powerpc/kernel/head_64.o
> +arch/powerpc/kernel/head_8xx.o
> +arch/powerpc/kernel/head_book3s_32.o
> +arch/powerpc/kernel/head_fsl_booke.o
> +arch/powerpc/kernel/entry_64.o
> +arch/powerpc/kernel/fpu.o
> +arch/powerpc/kernel/vector.o
> +arch/powerpc/kernel/prom_init.o
> +arch/riscv/kernel/head.o
> +arch/s390/kernel/head64.o
> +arch/sh/kernel/head_32.o
> +arch/sparc/kernel/head_32.o
> +arch/sparc/kernel/head_64.o
> +arch/x86/kernel/head_32.o
> +arch/x86/kernel/head_64.o
> +arch/x86/kernel/head32.o
> +arch/x86/kernel/head64.o
> +arch/x86/kernel/ebda.o
> +arch/x86/kernel/platform-quirks.o
> +arch/xtensa/kernel/head.o

Seeing that almost all of these have the same naming
convention, another alternative would be to have a
special case exclusively for arch/*/kernel/head.S and
make that either an assembly file that includes all
the other files from your current list, or use
an intermediate object to link head-*.o into head.o
before putting that first.

     Arnd

  reply	other threads:[~2022-09-06  8:06 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  6:13 [PATCH v2 0/8] kbuild: various cleanups Masahiro Yamada
2022-09-06  6:13 ` [PATCH v2 1/8] kbuild: fix and refactor single target build Masahiro Yamada
2022-09-06  6:13 ` [PATCH v2 2/8] kbuild: rename modules.order in sub-directories to .modules.order Masahiro Yamada
2022-09-06  6:13 ` [PATCH v2 3/8] kbuild: move core-y and drivers-y to ./Kbuild Masahiro Yamada
2022-09-21  4:39   ` Guenter Roeck
     [not found]     ` <CGME20220922121655eucas1p11822db5dbd1455bcbdba901f543b8e6b@eucas1p1.samsung.com>
2022-09-22 12:16       ` Marek Szyprowski
     [not found]         ` <CGME20220923113907eucas1p2b33fa5cf73646401089f96a69cf9b745@eucas1p2.samsung.com>
2022-09-23 11:39           ` Marek Szyprowski
2022-09-23 11:41             ` Masahiro Yamada
2022-09-23 12:09             ` Masahiro Yamada
2022-09-06  6:13 ` [PATCH v2 4/8] kbuild: move .vmlinux.objs rule to Makefile.modpost Masahiro Yamada
2022-09-06  6:13 ` [PATCH v2 5/8] kbuild: move vmlinux.o rule to the top Makefile Masahiro Yamada
2022-09-06  6:13 ` [PATCH v2 6/8] kbuild: unify two modpost invocations Masahiro Yamada
2022-09-06  6:13 ` [PATCH v2 7/8] kbuild: use obj-y instead extra-y for objects placed at the head Masahiro Yamada
2022-09-08  7:15   ` Masahiro Yamada
2022-09-19  8:10   ` Geert Uytterhoeven
2022-09-19 12:17     ` Masahiro Yamada
2022-09-19 12:28       ` Geert Uytterhoeven
2022-09-19 22:50   ` Guenter Roeck
2022-09-20  6:56     ` Geert Uytterhoeven
2022-09-20 13:33       ` Guenter Roeck
2022-09-06  6:13 ` [PATCH v2 8/8] kbuild: remove head-y syntax Masahiro Yamada
2022-09-06  7:59   ` Arnd Bergmann [this message]
2022-09-06  8:16     ` Ard Biesheuvel
2022-09-06  9:08     ` Masahiro Yamada
2022-09-07 20:15 ` [PATCH v2 0/8] kbuild: various cleanups Nicolas Schier
2022-09-07 20:18   ` Nicolas Schier
2022-09-08  2:00     ` Masahiro Yamada
2022-09-24 18:05 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f76020e2-e8bd-4f75-a697-3d6ec6665969@www.fastmail.com \
    --to=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).