[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240127212728.GA14846@1wt.eu>
Date: Sat, 27 Jan 2024 22:27:28 +0100
From: Willy Tarreau <w@....eu>
To: David Laight <David.Laight@...LAB.COM>
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
Rodrigo Campos <rodrigo@...g.com.ar>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/1] tools/nolibc/string: export strlen()
On Sat, Jan 27, 2024 at 09:23:01PM +0000, David Laight wrote:
> ..
> > Yes, once we have the proof that the compiler may produce such a call, it
> > can also happen in whatever user code so we need to export the function,
> > there's no other solution.
>
> Does that mean that it you try to implement strlen() in C
> gcc will generate a recursive call?
Yes, that's exactly what happened the first time with strlen() itself!
> I guess an 'asm volatile("");' in the loop fix it.
That's how we fixed it for strlen(). The problem I'm having with
addressing it this way is that as long as the compiler will decide
to emit calls to strlen() which was not explicitly referenced in
the code, it will still be missing and will continue to fail. Thus
the safest solution is to make sure strlen() remains accessible in
case the compiler decides to make use of it.
Willy
Powered by blists - more mailing lists