Skip to content

Commit 7f7d4f9

Browse files
committed
rust: export build_error symbol if RUST_BUILD_ASSERT_DENY is not set
This ensures that under `RUST_BUILD_ASSERT_WARN` or `RUST_BUILD_ASSERT_ALLOW`, modpost will not reject modules containing call to `rust_build_error`. Signed-off-by: Gary Guo <[email protected]>
1 parent 4099db9 commit 7f7d4f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rust/build_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
/// Panics if executed in const context, or triggers a build error if not.
1818
#[inline(never)]
1919
#[cold]
20-
#[no_mangle]
20+
#[export_name = "rust_build_error"]
2121
#[track_caller]
2222
pub const fn build_error(msg: &'static str) -> ! {
2323
panic!("{}", msg);
2424
}
2525

2626
#[cfg(CONFIG_RUST_BUILD_ASSERT_WARN)]
27-
#[link_section = ".gnu.warning.build_error"]
27+
#[link_section = ".gnu.warning.rust_build_error"]
2828
#[used]
2929
static BUILD_ERROR_WARNING: [u8; 45] = *b"call to build_error present after compilation";

0 commit comments

Comments
 (0)