mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
To: Willy Tarreau <w@1wt.eu>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] tools/nolibc: x86_64: wrap asm functions in functions
Date: Sun, 11 Aug 2024 03:10:34 +0700	[thread overview]
Message-ID: <ZrfJOr6Dmn0j00Yh@biznet-home.integral.gnuweeb.org> (raw)
In-Reply-To: <20240810194545.GA5065@1wt.eu>

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


      reply	other threads:[~2024-08-10 20:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10 10:54 [PATCH 0/3] tools/nolibc: LTO compatibility Thomas Weißschuh
2024-08-10 10:54 ` [PATCH 1/3] tools/nolibc: crt: mark _start_c() as used Thomas Weißschuh
2024-08-10 10:54 ` [PATCH 2/3] tools/nolibc: stackprotector: mark implicitly used symbols " Thomas Weißschuh
2024-08-10 10:54 ` [PATCH 3/3] tools/nolibc: x86_64: wrap asm functions in functions Thomas Weißschuh
2024-08-10 12:12   ` Ammar Faizi
2024-08-10 12:37     ` Thomas Weißschuh
2024-08-10 14:35       ` Willy Tarreau
2024-08-10 16:04         ` Thomas Weißschuh
2024-08-10 16:45           ` Thomas Weißschuh
2024-08-10 17:00             ` Willy Tarreau
2024-08-12 17:01               ` Thomas Weißschuh
2024-08-12 19:38                 ` Willy Tarreau
2024-08-10 19:16           ` Ammar Faizi
2024-08-10 19:45             ` Willy Tarreau
2024-08-10 20:10               ` Ammar Faizi [this message]

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=ZrfJOr6Dmn0j00Yh@biznet-home.integral.gnuweeb.org \
    --to=ammarfaizi2@gnuweeb.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --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®