public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Re: [RFC] Linux system call builtins
Date: Mon, 8 Apr 2024 10:58:20 +0100	[thread overview]
Message-ID: <CAH6eHdRDNj7HdVC3eP=mLrwauqu6=k7NLEAVy8N-D7qU1WZseg@mail.gmail.com> (raw)
In-Reply-To: <2d2f1e405361d2b36dd513e3fabd1fe0@gmail.com>

Hello,

On Mon, 8 Apr 2024 at 10:20, Matheus Afonso Martins Moreira via Gcc
<gcc@gcc.gnu.org> wrote:
>
> I'd like to add GCC builtins for generating Linux system call
> code for all architectures supported by Linux.
>
> They would look like this:
>
>     __builtin_linux_system_call(long n, ...)
>     __builtin_linux_system_call_1(long n, long _1)
>     __builtin_linux_system_call_2(long n, long _1, long _2)
>     /* More definitions, all the way up to 6 arguments */

What's the advantage of the _1, _2 etc. forms? The compiler knows how
many arguments you're passing, why can't there just be one built-in
handling all cases?



>
>   + It doesn't make sense for libraries to support it
>
>         There are libraries out there that provide
>         system call functionality. The various libcs do.
>         However they usually don't support the full set
>         of Linux system calls. Using certain system calls
>         could invalidate global state in these libraries
>         which leads to them not being supported. Clone is
>         the quintessential example. So I think libraries
>         are not the proper place for this functionality.

Your proposal doesn't seem to actually address the problem. If using
the clone syscall causes problems for glibc by not giving glibc a
chance to set up TLS etc for the new thread, how does making it easier
to use the clone syscall help?

  reply	other threads:[~2024-04-08  9:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  9:19 Matheus Afonso Martins Moreira
2024-04-08  9:58 ` Jonathan Wakely [this message]
2024-04-08 11:59   ` Matheus Afonso Martins Moreira
2024-04-08 14:00     ` Jonathan Wakely
2024-04-08 11:24 ` Florian Weimer
2024-04-08 11:44   ` Alexander Monakov
2024-04-08 11:50     ` Florian Weimer
2024-04-08 13:01       ` Alexander Monakov
2024-04-08 13:37   ` Matheus Afonso Martins Moreira
2024-04-08 18:18 ` Paul Iannetta
2024-04-08 18:26   ` Andrew Pinski
2024-04-08 20:01     ` Paul Iannetta
2024-04-08 20:20       ` Paul Koning
2024-04-10  1:48     ` Matheus Afonso Martins Moreira
2024-04-10 13:15       ` Paul Koning
2024-04-10 14:10         ` Matheus Afonso Martins Moreira
2024-04-10  1:26   ` Matheus Afonso Martins Moreira
2024-04-08 20:24 ` Paul Floyd
2024-04-10  2:19   ` Matheus Afonso Martins Moreira
2024-04-09 11:45 ` Szabolcs Nagy
2024-04-10  2:59   ` Matheus Afonso Martins Moreira
2024-04-10 11:04     ` Szabolcs Nagy
2024-04-10 14:00       ` Matheus Afonso Martins Moreira

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='CAH6eHdRDNj7HdVC3eP=mLrwauqu6=k7NLEAVy8N-D7qU1WZseg@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=matheus.a.m.moreira@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).