162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * A hack to export Rust symbols for loadable modules without having to redo 462306a36Sopenharmony_ci * the entire `include/linux/export.h` logic in Rust. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * This requires the Rust's new/future `v0` mangling scheme because the default 762306a36Sopenharmony_ci * one ("legacy") uses invalid characters for C identifiers (thus we cannot use 862306a36Sopenharmony_ci * the `EXPORT_SYMBOL_*` macros). 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * All symbols are exported as GPL-only to guarantee no GPL-only feature is 1162306a36Sopenharmony_ci * accidentally exposed. 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <linux/module.h> 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#include "exports_core_generated.h" 1962306a36Sopenharmony_ci#include "exports_alloc_generated.h" 2062306a36Sopenharmony_ci#include "exports_bindings_generated.h" 2162306a36Sopenharmony_ci#include "exports_kernel_generated.h" 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci// For modules using `rust/build_error.rs`. 2462306a36Sopenharmony_ci#ifdef CONFIG_RUST_BUILD_ASSERT_ALLOW 2562306a36Sopenharmony_ciEXPORT_SYMBOL_RUST_GPL(rust_build_error); 2662306a36Sopenharmony_ci#endif 27