Linux Modules
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Giuliano Procida" <gprocida@google.com>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	rust-for-linux@vger.kernel.org,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	linux-modules@vger.kernel.org,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Petr Pavlu" <petr.pavlu@suse.com>,
	"Daniel Gomez" <da.gomez@kernel.org>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Aaron Tomlin" <atomlin@atomlin.com>
Subject: Re: [PATCH v4 0/2] clean up EXPORT_SYMBOL_RUST_GPL
Date: Mon, 09 Nov 2026 15:14:07 +0000	[thread overview]
Message-ID: <DMQS0SH6975Y.23Z4V64W0HWN5@garyguo.net> (raw)
In-Reply-To: <20261103165833.418845-1-gprocida@google.com>

On Tue Nov 3, 2026 at 4:58 PM GMT, Giuliano Procida wrote:
> Move EXPORT_SYMBOL_RUST_GPL definitions into linux/export.h and
> prevent the emission of bogus type information for Rust symbols.
>
> Addressing review comments, the first commit now ensures the moves do
> not trigger warnings from scripts/misc-check about missing symbol
> exports by extending regexes to match EXPORT_SYMBOL_RUST_GPL as well.
>
> Giuliano Procida (2):
>   rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h
>   rust: exports: emit ___EXPORT_SYMBOL without C declarations
>
>  drivers/gpu/Makefile                      |  4 ++--
>  drivers/gpu/nova-core/nova_core_exports.c |  5 ++---
>  include/linux/export.h                    | 14 ++++++++++++++
>  rust/exports.c                            | 12 +-----------
>  scripts/misc-check                        |  4 ++--
>  5 files changed, 21 insertions(+), 18 deletions(-)

How about just getting rid of EXPORT_SYMBOL_RUST_GPL completely? The only reason
that it exists is because EXPORT_SYMBOL_GPL in C expects the symbol to exist.

We can simply change change rust/exports.c to rust/exports.S and get rid of
EXPORT_SYMBOL_RUST_GPL completely (plus saving a C compiler invoocation):

Something like this:

diff --git a/rust/Makefile b/rust/Makefile
index 0165626decbe..75de47028b60 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -571,7 +571,7 @@ rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__(p
 
 quiet_cmd_exports = EXPORTS $@
       cmd_exports = \
-	$(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n") > $@
+	$(call rust_exports,$<,"EXPORT_SYMBOL_GPL(%s);\n") > $@
 
 $(obj)/exports_core_generated.h: $(obj)/core.o FORCE
 	$(call if_changed,exports)
diff --git a/rust/exports.c b/rust/exports.S
similarity index 86%
rename from rust/exports.c
rename to rust/exports.S
index 1b52460b0f4e..efe6bff0f983 100644
--- a/rust/exports.c
+++ b/rust/exports.S
@@ -13,8 +13,6 @@
 
 #include <linux/export.h>
 
-#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym)
-
 #include "exports_core_generated.h"
 #include "exports_bindings_generated.h"
 #include "exports_kernel_generated.h"
@@ -25,5 +23,5 @@
 
 // For modules using `rust/build_error.rs`.
 #ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW
-EXPORT_SYMBOL_RUST_GPL(rust_build_error);
+EXPORT_SYMBOL_GPL(rust_build_error);
 #endif


  parent reply	other threads:[~2026-11-09 15:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261019151243.1595858-1-gprocida@google.com>
2026-10-20 19:22 ` [PATCH] rust: exports: emit ___EXPORT_SYMBOL without C declarations Miguel Ojeda
2026-10-21  9:27   ` Petr Pavlu
2026-10-21  9:44     ` Miguel Ojeda
2026-10-21 14:21   ` Giuliano Procida
2026-10-22 12:42     ` Miguel Ojeda
2026-10-22 13:46       ` [PATCH v2 0/2] clean up EXPORT_SYMBOL_RUST_GPL Giuliano Procida
2026-11-03 12:58         ` [PATCH v3 " Giuliano Procida
2026-11-03 12:58         ` [PATCH v3 1/2] rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h Giuliano Procida
2026-11-03 15:57           ` Petr Pavlu
2026-11-03 16:25             ` Giuliano Procida
2026-11-03 16:58               ` [PATCH v4 0/2] clean up EXPORT_SYMBOL_RUST_GPL Giuliano Procida
2026-11-04  1:18                 ` Sami Tolvanen
2026-11-09 14:05                 ` Petr Pavlu
2026-11-09 15:14                 ` Gary Guo [this message]
2026-11-11 15:01                   ` Giuliano Procida
2026-11-11 15:07                     ` Gary Guo
2026-11-03 16:58               ` [PATCH v4 1/2] rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h Giuliano Procida
2026-11-03 16:58               ` [PATCH v4 2/2] rust: exports: emit ___EXPORT_SYMBOL without C declarations Giuliano Procida
2026-11-03 12:58         ` [PATCH v3 " Giuliano Procida
2026-10-22 13:46       ` [PATCH v2 1/2] rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h Giuliano Procida
2026-10-22 13:55         ` sashiko-bot
2026-10-22 13:46       ` [PATCH v2 2/2] rust: exports: emit ___EXPORT_SYMBOL without C declarations Giuliano Procida

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=DMQS0SH6975Y.23Z4V64W0HWN5@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=atomlin@atomlin.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=da.gomez@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gprocida@google.com \
    --cc=linux-modules@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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