1 // SPDX-License-Identifier: GPL-2.0 1 // SPDX-License-Identifier: GPL-2.0 2 /* 2 /* 3 * A hack to export Rust symbols for loadable 3 * A hack to export Rust symbols for loadable modules without having to redo 4 * the entire `include/linux/export.h` logic i 4 * the entire `include/linux/export.h` logic in Rust. 5 * 5 * 6 * This requires the Rust's new/future `v0` ma 6 * This requires the Rust's new/future `v0` mangling scheme because the default 7 * one ("legacy") uses invalid characters for 7 * one ("legacy") uses invalid characters for C identifiers (thus we cannot use 8 * the `EXPORT_SYMBOL_*` macros). 8 * the `EXPORT_SYMBOL_*` macros). 9 * 9 * 10 * All symbols are exported as GPL-only to gua 10 * All symbols are exported as GPL-only to guarantee no GPL-only feature is 11 * accidentally exposed. 11 * accidentally exposed. 12 */ 12 */ 13 13 14 #include <linux/export.h> 14 #include <linux/export.h> 15 15 16 #define EXPORT_SYMBOL_RUST_GPL(sym) extern int 16 #define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym) 17 17 18 #include "exports_core_generated.h" 18 #include "exports_core_generated.h" 19 #include "exports_alloc_generated.h" 19 #include "exports_alloc_generated.h" 20 #include "exports_helpers_generated.h" 20 #include "exports_helpers_generated.h" 21 #include "exports_bindings_generated.h" 21 #include "exports_bindings_generated.h" 22 #include "exports_kernel_generated.h" 22 #include "exports_kernel_generated.h" 23 23 24 // For modules using `rust/build_error.rs`. 24 // For modules using `rust/build_error.rs`. 25 #ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW 25 #ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW 26 EXPORT_SYMBOL_RUST_GPL(rust_build_error); 26 EXPORT_SYMBOL_RUST_GPL(rust_build_error); 27 #endif 27 #endif 28 28
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.