[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFJgqgS8u=HZ4kps=9iEcw4ra2ocLU5YL+=YNB3Vo9E+1jNnXg@mail.gmail.com>
Date: Tue, 25 Feb 2025 08:55:21 -0700
From: Ventura Jack <venturajack85@...il.com>
To: Philip Herron <herron.philip@...glemail.com>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, "Theodore Ts'o" <tytso@....edu>,
Linus Torvalds <torvalds@...ux-foundation.org>, Kent Overstreet <kent.overstreet@...ux.dev>,
Gary Guo <gary@...yguo.net>, airlied@...il.com, boqun.feng@...il.com,
david.laight.linux@...il.com, ej@...i.de, gregkh@...uxfoundation.org,
hch@...radead.org, hpa@...or.com, ksummit@...ts.linux.dev,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
Ralf Jung <post@...fj.de>, Antoni Boucher <bouanto@...o.com>,
Arthur Cohen <arthur.cohen@...ecosm.com>
Subject: Re: C aggregate passing (Rust kernel policy)
On Mon, Feb 24, 2025 at 9:42 AM Philip Herron
<herron.philip@...glemail.com> wrote:
> My 50 cents here is that gccrs is trying to follow rustc as a guide, and
> there are a lot of assumptions in libcore about the compiler, such as lang
> items, that we need to follow in order to compile Rust code. [Omitted]
>
> Thanks
>
> --Phil
Is this snippet from the Rust standard library an example of one
of the assumptions about the compiler that the Rust standard library
makes? The code explicitly assumes that LLVM is the backend of
the compiler.
https://github.com/rust-lang/rust/blob/master/library/core/src/ffi/va_list.rs#L292-L301
// FIXME: this should call `va_end`, but there's no clean way to
// guarantee that `drop` always gets inlined into its caller,
// so the `va_end` would get directly called from the same function as
// the corresponding `va_copy`. `man va_end` states that C
requires this,
// and LLVM basically follows the C semantics, so we need to make sure
// that `va_end` is always called from the same function as `va_copy`.
// For more details, see https://github.com/rust-lang/rust/pull/59625
// and https://llvm.org/docs/LangRef.html#llvm-va-end-intrinsic.
//
// This works for now, since `va_end` is a no-op on all
current LLVM targets.
How do you approach, or plan to approach, code like the above in gccrs?
Maybe make a fork of the Rust standard library that only replaces the
LLVM-dependent parts of the code? I do not know how widespread
LLVM-dependent code is in the Rust standard library, nor how
well-documented the dependence on LLVM typically is. In the above
case, it is well-documented.
Best, VJ.
Powered by blists - more mailing lists