[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrfJOr6Dmn0j00Yh@biznet-home.integral.gnuweeb.org>
Date: Sun, 11 Aug 2024 03:10:34 +0700
From: Ammar Faizi <ammarfaizi2@...weeb.org>
To: Willy Tarreau <w@....eu>
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] tools/nolibc: x86_64: wrap asm functions in functions
On Sat, Aug 10, 2024 at 09:45:45PM +0200, Willy Tarreau wrote:
> The constraints are trivial, the problem is that they're not supposed to
> be used in a naked function. I tried, as you can guess. gcc accepted
> them without complaining but clang not at all. However what's interesting
> is that the compiler being aware of our unability to inform it about the
> clobber list, it did consider everything clobbered and saved the registers
> in the caller in this case. That does make sense, otherwise it would be
> impossible to use asm in naked functions. However we need to restrict
> this use case to true naked functions, not the ones we were doing ourselves
> before the existence of the naked attribute.
Ah, I get it now. Apparently, my ignorance of naked functions led to,
well, not knowing about naked functions. I didn't know about the naked
attribute.
Yeah, clang indeed throws errors while GCC does not:
```
<source>:24:10: error: parameter references not allowed in naked functions
24 | : "+D"(dst), "+S"(src), "+c"(len), "=a"(rax)
| ^
<source>:4:16: note: attribute is here
4 | __attribute__((naked))
| ^
<source>:7:2: error: non-ASM statement in naked function is not supported
7 | void *rax;
| ^
<source>:4:16: note: attribute is here
4 | __attribute__((naked))
| ^
2 errors generated.
Compiler returned: 1
```
For now, I'll wait for your discussion with Thomas to resolve this
issue. And yes, I agree that we should find a solution that doesn't
require maintaining two different versions.
--
Ammar Faizi
Powered by blists - more mailing lists