From: Willy Tarreau <w@1wt.eu>
To: Daniel Palmer <daniel@thingy.jp>
Cc: linux@weissschuh.net, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 00/10] nolibc: Add static-pie support
Date: Sat, 7 Feb 2026 16:34:40 +0100 [thread overview]
Message-ID: <aYdbkEnAooEuWkae@1wt.eu> (raw)
In-Reply-To: <20260204124542.523567-1-daniel@thingy.jp>
Hi Daniel,
On Wed, Feb 04, 2026 at 09:45:32PM +0900, Daniel Palmer wrote:
> v2:
>
> - This is still RFC quality
> - I have gotten a few more archs to work (not crash in nolibc-test) so I have added them
> to show the that the arch specific parts are pretty small.
> - This should now only add this extra code if NOLIBC_WANT_RELOC is defined, which happens
> automatically if you compile with -fpie. Should address Willy's concern with the size
> blowing up for even binaries that don't need this.
Oh yes that's a nice improvement indeed, thank you:
$ size init-master init-dpalmer*
text data bss dec hex filename
22519 24 39424 61967 f20f init-master
22562 24 39424 62010 f23a init-dpalmer
22710 56 39424 62190 f2ee init-dpalmer-pie
22816 24 39424 62264 f338 init-dpalmer-want-reloc
I think the 43 bytes increase on the _start_c part remains acceptable,
especially compared to the +300 before :-)
> Size difference on ppc64 is massive, I guess PIC code is big there.
>
> static:
>
> $ file nolibc-test
> nolibc-test: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, Power ELF V1 ABI, version 1 (SYSV), statically linked, not stripped
> $ size nolibc-test
> text data bss dec hex filename
> 59560 3240 104 62904 f5b8 nolibc-test
>
> static pie:
>
> $ file nolibc-test
> nolibc-test: ELF 64-bit MSB pie executable, 64-bit PowerPC or cisco 7500, Power ELF V1 ABI, version 1 (SYSV), static-pie linked, with debug_info, not stripped
> $ size nolibc-test
> text data bss dec hex filename
> 67801 3656 104 71561 11789 nolibc-test
>
> - Each of the archs checks that the relocations they need (just the one at the moment) is defined
> before defining the relocation defines. So this shouldn't break with older UAPI headers.
I confirm, I've built against 5.10 to 6.18 and it's OK, and if -fpie
is passed we get an error saying the arch doesn't support it.
> - I think maybe you might want to set NOLIBC_WANT_RELOC even if __pie__ is not defined,
> maybe for testing? So I didn't make it _NOLIBC_WANT_RELOC.
It's possible, at least for developers/maintainers maybe. Above I used it
to compare the size increase caused by the changes.
> - I was worried some archs didn't work because calling the relocation functions was
> causing things like accessing the stack canary before it was accessible. So I added
> __inline__ to all of the relocation functions to force them to get inlined into _start_c().
If you absolutely need to forcefully inline, you should add
__attribute__((always_inline)) in addition to __inline__, as
it will override the default compiler setting based on the
optimization level. However the functions are short enough
that they were always inlined in my tests regardless of the
attribute.
> This might be too much. checkpatch certainly hates it.
No big deal.
Thanks,
Willy
next prev parent reply other threads:[~2026-02-07 15:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 12:45 [RFC PATCH v2 00/10] nolibc: Add static-pie support Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 01/10] elf: Add relocation types used by nolibc Daniel Palmer
2026-02-07 15:35 ` Willy Tarreau
2026-02-16 20:33 ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 02/10] tools/nolibc: crt: Split _start_c() into stack-only and normal parts Daniel Palmer
2026-02-07 15:45 ` Willy Tarreau
2026-02-08 1:40 ` Daniel Palmer
2026-02-16 20:42 ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 03/10] tools/nolibc: Add basic ELF self-relocation support for static PIE Daniel Palmer
2026-02-07 15:49 ` Willy Tarreau
2026-02-04 12:45 ` [RFC PATCH v2 04/10] tools/nolibc: m68k: Add relocation support Daniel Palmer
2026-02-16 20:51 ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 05/10] tools/nolibc: x86: " Daniel Palmer
2026-02-16 21:06 ` Thomas Weißschuh
2026-02-04 12:45 ` [RFC PATCH v2 06/10] tools/nolibc: riscv: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 07/10] tools/nolibc: arm: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 08/10] tools/nolibc: sh: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 09/10] tools/nolibc: ppc: " Daniel Palmer
2026-02-04 12:45 ` [RFC PATCH v2 10/10] selftests/nolibc: Add option for building with -static-pie Daniel Palmer
2026-02-16 20:59 ` Thomas Weißschuh
2026-02-07 15:34 ` Willy Tarreau [this message]
2026-02-08 1:35 ` [RFC PATCH v2 00/10] nolibc: Add static-pie support Daniel Palmer
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=aYdbkEnAooEuWkae@1wt.eu \
--to=w@1wt.eu \
--cc=daniel@thingy.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.