From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Daniel Palmer <daniel@0x0f.com>,
linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH] tools/nolibc: sh: enter _start_c with jsr instead of bsr
Date: Fri, 23 Oct 2026 20:35:37 +0200 [thread overview]
Message-ID: <atuo-ZOI7koEs8RV@1wt.eu> (raw)
In-Reply-To: <5a82da39-1f60-41b6-9359-f08e6fefdb6d@t-8ch.de>
On Fri, Oct 23, 2026 at 07:32:55PM +0200, Thomas Weißschuh wrote:
> > > I fear that we will have the same problems in other architectures.
> > > And for those we'll also need custom assembly. While the mechanisms
> > > above would not need that.
> >
> > But all archs support indirect calls one way or another. Normally we
> > should be able to do the equivalent of placing an absolute value in a
> > storage area, load it in a register and branch to it at least.
>
> Of course it is possible to do. But it differs between architectures and
> somebody will have to write and maintain that assembly code.
>
> > For me, sorted sections are most likely meant to be used to group code by
> > locality, not to guarantee that branch offsets will always remain
> > small enough for all architectures.
>
> Exactly this locality should provide small enough branch offsets.
> The section ".text.sorted.nolibc_crt" should only ever have two functions:
> Our _start() and _start_c().
> While there won't be a formal guarantee that the architecture's branch
> offsets will be able to handle those, I find it hard to imagine that
> they won't.
It has worked till then at least so it should.
> > An indirect call on the other hand is well defined, standard and can
> > be adopted where needed at the cost of only 4 or 8 bytes in the
> > startup code.
>
> Its a few more bytes, not that it really matters.
> * 3 additional instructions -> 6 bytes
> * The embedded offset -> 4 bytes
> * Up to 3 bytes of alignment
It depends on the arch in fact but that remains the order of magnitude.
> The adoption will require additional fiddling with assembly.
Yes I agree.
> Maybe we let Daniel break the tie? :-)
The advantage of the ld-based one is that it should be the lowest effort
across all archs at once, so we should probably try with this one first.
If we later discover that it displaces the problem somewhere else, then
you can reconsider it and switch to the asm one.
Willy
next prev parent reply other threads:[~2026-10-23 18:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 10:01 Daniel Palmer
2026-10-22 16:12 ` Thomas Weißschuh
2026-10-23 5:09 ` Willy Tarreau
2026-10-23 15:53 ` Thomas Weißschuh
2026-10-23 16:20 ` Willy Tarreau
2026-10-23 17:32 ` Thomas Weißschuh
2026-10-23 18:35 ` Willy Tarreau [this message]
2026-10-24 5:16 ` Daniel Palmer
2026-10-24 5:27 ` Willy Tarreau
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=atuo-ZOI7koEs8RV@1wt.eu \
--to=w@1wt.eu \
--cc=daniel@0x0f.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@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 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®