From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Benjamin Berg <benjamin@sipsolutions.net>
Cc: linux-um@lists.infradead.org, Willy Tarreau <w@1wt.eu>,
linux-kselftest@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
linux-kernel@vger.kernel.org, Tiwei Bie <tiwei.btw@antgroup.com>,
Benjamin Berg <benjamin.berg@intel.com>
Subject: Re: [PATCH 6/9] tools/nolibc: add option to disable startup code
Date: Mon, 15 Sep 2025 10:55:44 +0200 [thread overview]
Message-ID: <e2f2b0e3-a72d-4b6f-9677-02de711b7d3a@t-8ch.de> (raw)
In-Reply-To: <20250915071115.1429196-7-benjamin@sipsolutions.net>
On 2025-09-15 09:11:12+0200, Benjamin Berg wrote:
> From: Benjamin Berg <benjamin.berg@intel.com>
>
> In principle, it is possible to use nolibc for only some object files in
> a program. In that case, the startup code in _start and _start_c is not
> going to be used. Add the NOLIBC_NO_STARTCODE compile time option to
> disable it entirely and also remove anything that depends on it.
Not a big fan of the naming. More than only _start()/_start_c() are
disabled. Maybe NOLIBC_NO_RUNTIME? I'm horrible at naming...
> Doing this avoids warnings from modpost for UML as the _start_c code
> references the main function from the .init.text section while it is not
> inside .init itself.
>
> Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
> ---
> tools/include/nolibc/arch-arm.h | 2 ++
> tools/include/nolibc/arch-arm64.h | 2 ++
> tools/include/nolibc/arch-loongarch.h | 2 ++
> tools/include/nolibc/arch-m68k.h | 2 ++
> tools/include/nolibc/arch-mips.h | 2 ++
> tools/include/nolibc/arch-powerpc.h | 2 ++
> tools/include/nolibc/arch-riscv.h | 2 ++
> tools/include/nolibc/arch-s390.h | 2 ++
> tools/include/nolibc/arch-sh.h | 2 ++
> tools/include/nolibc/arch-sparc.h | 2 ++
> tools/include/nolibc/arch-x86.h | 4 ++++
> tools/include/nolibc/crt.h | 3 +++
> tools/include/nolibc/stackprotector.h | 2 ++
> tools/include/nolibc/stdlib.h | 2 ++
> tools/include/nolibc/sys.h | 3 ++-
> tools/include/nolibc/sys/auxv.h | 3 +++
> 16 files changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc/arch-arm.h
> index 1f66e7e5a444..24ad348cc1e8 100644
> --- a/tools/include/nolibc/arch-arm.h
> +++ b/tools/include/nolibc/arch-arm.h
> @@ -185,6 +185,7 @@
> })
>
> /* startup code */
> +#ifndef NOLIBC_NO_STARTCODE
I'd prefer the ifdef around the comments.
> void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
> {
> __asm__ volatile (
> @@ -193,5 +194,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
> );
> __nolibc_entrypoint_epilogue();
> }
> +#endif /* NOLIBC_NO_STARTCODE */
(...)
next prev parent reply other threads:[~2025-09-15 8:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 7:11 [PATCH 0/9] Start porting UML to nolibc Benjamin Berg
2025-09-15 7:11 ` [PATCH 1/9] tools compiler.h: fix __used definition Benjamin Berg
2025-09-15 8:39 ` Thomas Weißschuh
2025-09-15 7:11 ` [PATCH 2/9] um: use tools/include for user files Benjamin Berg
2025-09-15 10:40 ` kernel test robot
2025-09-15 7:11 ` [PATCH 3/9] tools/nolibc/stdio: remove perror if NOLIBC_IGNORE_ERRNO is set Benjamin Berg
2025-09-15 8:44 ` Thomas Weißschuh
2025-09-15 7:11 ` [PATCH 4/9] tools/nolibc/dirent: avoid errno in readdir_r Benjamin Berg
2025-09-15 8:45 ` Thomas Weißschuh
2025-09-15 7:11 ` [PATCH 5/9] tools/nolibc: use __fallthrough__ rather than fallthrough Benjamin Berg
2025-09-15 8:50 ` Thomas Weißschuh
2025-09-15 7:11 ` [PATCH 6/9] tools/nolibc: add option to disable startup code Benjamin Berg
2025-09-15 8:55 ` Thomas Weißschuh [this message]
2025-09-15 7:11 ` [PATCH 7/9] um: add infrastructure to build files using nolibc Benjamin Berg
2025-09-15 8:57 ` Thomas Weißschuh
2025-09-15 7:11 ` [PATCH 8/9] um: use nolibc for the --showconfig implementation Benjamin Berg
2025-09-15 7:11 ` [PATCH 9/9] um: switch ptrace FP register access to nolibc Benjamin Berg
2025-09-15 9:07 ` Thomas Weißschuh
2025-09-15 11:09 ` Berg, Benjamin
2025-09-15 11:22 ` Thomas Weißschuh
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=e2f2b0e3-a72d-4b6f-9677-02de711b7d3a@t-8ch.de \
--to=linux@weissschuh.net \
--cc=acme@redhat.com \
--cc=benjamin.berg@intel.com \
--cc=benjamin@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=tiwei.btw@antgroup.com \
--cc=w@1wt.eu \
/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
all inboxes | Powered by JetHome®