-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix compile error in the latest nightly 1.33.0. (#1)
* fix compile error in the latest nightly 1.33.0. * review: Add eh_personality.
- Loading branch information
1 parent
67b57cf
commit 26ecfcd
Showing
8 changed files
with
35 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
use alloc::*; | ||
use alloc::vec::Vec; | ||
use core::fmt; | ||
use spin::Mutex; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
use core; | ||
use core::panic::PanicInfo; | ||
|
||
// These functions and traits are used by the compiler, but not | ||
// for a bare-bones hello world. These are normally | ||
// provided by libstd. | ||
#[lang = "eh_personality"] | ||
#[no_mangle] | ||
pub extern "C" fn eh_personality() {} | ||
|
||
#[lang = "eh_unwind_resume"] | ||
#[no_mangle] | ||
pub extern "C" fn eh_unwind_resume(_a: *const u8) {} | ||
|
||
#[allow(dead_code)] | ||
extern "C" { | ||
fn abort(); | ||
fn abort() -> !; | ||
fn panic_c(); | ||
} | ||
|
||
#[lang = "panic_fmt"] | ||
#[panic_handler] | ||
#[no_mangle] | ||
pub extern "C" fn rust_begin_panic(msg: core::fmt::Arguments, file: &'static str, line: u32) -> ! { | ||
use super::io; | ||
pub fn rust_begin_panic(info: &PanicInfo) -> ! { | ||
// Print the file and line number | ||
println!("Rust panic @ {}:{}", file, line); | ||
if let Some(location) = info.location() { | ||
println!("Rust panic @ {}:{}", | ||
location.file(), location.line()); | ||
} | ||
|
||
// Print the message and a newline | ||
io::print(msg); | ||
println!(""); | ||
if let Some(message) = info.message() { | ||
println!("{}", message); | ||
} | ||
|
||
unsafe { | ||
// In a real kernel module, we should use abort() instead of panic() | ||
abort(); // replace with panic_c() if you want | ||
abort() // replace with panic_c() if you want | ||
} | ||
loop {} | ||
} | ||
|
||
use core::alloc::Layout; | ||
#[cfg(not(test))] | ||
#[alloc_error_handler] | ||
pub fn alloc_error(_: Layout) -> ! { | ||
unsafe { abort() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters