mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Mark panic_fmt as no_mangle to work around rust-lang/rust#38281 (#262)
This commit is contained in:
committed by
GitHub
parent
f4ff2b0000
commit
c5dd983949
@@ -57,7 +57,7 @@ Now we place our root source file in `src/lib.rs`:
|
||||
pub extern fn rust_main() {}
|
||||
|
||||
#[lang = "eh_personality"] extern fn eh_personality() {}
|
||||
#[lang = "panic_fmt"] extern fn panic_fmt() -> ! {loop{}}
|
||||
#[lang = "panic_fmt"] #[no_mangle] extern fn panic_fmt() -> ! {loop{}}
|
||||
```
|
||||
Let's break it down:
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ We used `expect` in the code above, which will panic if there is no memory map t
|
||||
|
||||
```rust
|
||||
#[lang = "panic_fmt"]
|
||||
#[no_mangle]
|
||||
extern fn panic_fmt() -> ! {
|
||||
println!("PANIC");
|
||||
loop{}
|
||||
@@ -112,6 +113,7 @@ Now we get a `PANIC` message. But we can do even better. The `panic_fmt` functio
|
||||
|
||||
```rust
|
||||
#[lang = "panic_fmt"]
|
||||
#[no_mangle]
|
||||
extern fn panic_fmt(fmt: core::fmt::Arguments, file: &'static str,
|
||||
line: u32) -> !
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user