Skip to content

Commit d686c92

Browse files
committed
rust: kernel: Mark rust_fmt_argument as extern "C"
The rust_fmt_argument function is called from printk() to handle the %pA format specifier. Since it's called from C, we should mark it extern "C" to make sure it's ABI compatible. Fixes: 247b365 ("rust: add `kernel` crate") Signed-off-by: David Gow <[email protected]>
1 parent 6618d69 commit d686c92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rust/kernel/print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::bindings;
1818

1919
// Called from `vsprintf` with format specifier `%pA`.
2020
#[no_mangle]
21-
unsafe fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *const c_void) -> *mut c_char {
21+
unsafe extern "C" fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *const c_void) -> *mut c_char {
2222
use fmt::Write;
2323
// SAFETY: The C contract guarantees that `buf` is valid if it's less than `end`.
2424
let mut w = unsafe { RawFormatter::from_ptrs(buf.cast(), end.cast()) };

0 commit comments

Comments
 (0)