linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Adam Bratschi-Kaye <ark.email@gmail.com>,
	Alex Gaynor <alex.gaynor@gmail.com>,
	Antonio Terceiro <antonio.terceiro@linaro.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Boris-Chengbiao Zhou <bobo1239@web.de>,
	Borislav Petkov <bp@suse.de>, Daniel Xu <dxu@dxuuu.xyz>,
	Dariusz Sosnowski <dsosnowski@dsosnowski.pl>,
	David Gow <davidgow@google.com>, Douglas Su <d0u9.su@outlook.com>,
	Finn Behrens <me@kloenk.de>, Gary Guo <gary@garyguo.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Miguel Cano <macanroj@gmail.com>, Miguel Ojeda <ojeda@kernel.org>,
	Sven Van Asbroeck <thesven73@gmail.com>,
	Wedson Almeida Filho <wedsonaf@google.com>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: linux-next: manual merge of the rust tree with Linus' tree
Date: Fri, 15 Jul 2022 03:13:17 +0200	[thread overview]
Message-ID: <CANiq72k_dtr2=KX-WheUiM2v2370imAdWFawJR+8P41L7HjwpA@mail.gmail.com> (raw)
In-Reply-To: <Ys6u88DqQdgmkWWf@hirez.programming.kicks-ass.net>

On Wed, Jul 13, 2022 at 1:40 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> Does Rust have the equivalent of -mfunction-return=thunk-extern ?

While GCC has had it for a while, Nick just landed 2 days ago the
X86ReturnThunks pass in LLVM, so it will take some time to arrive in
rustc.

I have naively backported it to rustc and hacked it so that I set the
LLVM attribute for all functions, and I am getting the rets replaced
in Rust functions, e.g.

(gdb) disassemble a::f
Dump of assembler code for function _ZN1a1f17hdc6112b1b4a4fe99E:
   ...
   0x0000000000008a1f <+31>: pop    %rbp
   0x0000000000008a20 <+32>: jmp    0x8ce0 <__x86_return_thunk>

A trivial userspace program that counts the times that it goes through
the return thunk also appears to work.

> Related, how does Rust deal with all the various CC_HAS_ Kconfig stuff?
> What if C has the relevant option but Rust does not; then we must not
> have the feature enabled or there will be a mis-match.

I guess that would depend on the particular option: whether it applies
to Rust at all, whether it creates an incompatibility or not, etc.

> Do we now have to litter everythign with RUSTC_HAS_ ?

Why? Only a single `rustc` version is targeted at the moment, so it is
possible to statically know what it supports.

And later on, when we can declare a minimum version or when a second
compiler is ready, sure, we may need to have options depending on what
we want to do. Why would that be a problem?

Cheers,
Miguel

  reply	other threads:[~2022-07-15  1:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 10:34 linux-next: manual merge of the rust tree with Linus' tree Stephen Rothwell
2022-07-13 10:50 ` Miguel Ojeda
2022-07-13 11:39 ` Peter Zijlstra
2022-07-15  1:13   ` Miguel Ojeda [this message]
2022-07-15  9:01     ` Peter Zijlstra
2022-07-15 11:01       ` Miguel Ojeda
  -- strict thread matches above, loose matches on Subject: below --
2025-07-21  4:31 Stephen Rothwell
2025-07-21  8:23 ` Miguel Ojeda
2025-03-17 10:20 Stephen Rothwell
2025-03-17 19:37 ` Miguel Ojeda
2025-03-17 22:31   ` Stephen Rothwell
2025-03-17 22:35     ` Miguel Ojeda
2025-03-17 10:05 Stephen Rothwell
2025-03-17 19:36 ` Miguel Ojeda
2024-09-16  8:03 Stephen Rothwell
2024-09-16  8:12 ` Miguel Ojeda
2022-10-04  8:05 Stephen Rothwell
2022-09-12  7:24 Stephen Rothwell
2022-07-25  8:41 Stephen Rothwell
2022-07-25  8:52 ` Miguel Ojeda
2021-12-10 18:18 broonie
2021-11-03  3:19 Stephen Rothwell
2021-11-03 10:30 ` Miguel Ojeda
2021-11-03 21:01   ` Stephen Rothwell
2021-11-04 12:19     ` Miguel Ojeda
2021-11-04 20:31       ` Stephen Rothwell
2021-11-05 11:00         ` Miguel Ojeda
2021-07-19  6:16 Stephen Rothwell
2021-07-12  0:37 Stephen Rothwell

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='CANiq72k_dtr2=KX-WheUiM2v2370imAdWFawJR+8P41L7HjwpA@mail.gmail.com' \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=antonio.terceiro@linaro.org \
    --cc=ark.email@gmail.com \
    --cc=bobo1239@web.de \
    --cc=boqun.feng@gmail.com \
    --cc=bp@suse.de \
    --cc=d0u9.su@outlook.com \
    --cc=davidgow@google.com \
    --cc=dsosnowski@dsosnowski.pl \
    --cc=dxu@dxuuu.xyz \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=macanroj@gmail.com \
    --cc=me@kloenk.de \
    --cc=mpe@ellerman.id.au \
    --cc=ndesaulniers@google.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=thesven73@gmail.com \
    --cc=wedsonaf@google.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 NNTP newsgroup(s).