exports.c 730 B

123456789101112131415161718192021
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * A hack to export Rust symbols for loadable modules without having to redo
  4. * the entire `include/linux/export.h` logic in Rust.
  5. *
  6. * This requires the Rust's new/future `v0` mangling scheme because the default
  7. * one ("legacy") uses invalid characters for C identifiers (thus we cannot use
  8. * the `EXPORT_SYMBOL_*` macros).
  9. *
  10. * All symbols are exported as GPL-only to guarantee no GPL-only feature is
  11. * accidentally exposed.
  12. */
  13. #include <linux/module.h>
  14. #define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym)
  15. #include "exports_core_generated.h"
  16. #include "exports_alloc_generated.h"
  17. #include "exports_bindings_generated.h"
  18. #include "exports_kernel_generated.h"