-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fcbaea
commit 10a255a
Showing
5 changed files
with
47 additions
and
29 deletions.
There are no files selected for viewing
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,28 +1,44 @@ | ||
#![no_std] | ||
#![feature(lang_items)] | ||
#![feature(core_intrinsics)] | ||
use core::intrinsics; | ||
use core::panic::PanicInfo; | ||
|
||
mod lib_f32; | ||
mod lib_f64; | ||
mod lib_fenv; | ||
mod lib_long_double; | ||
mod musl_missing; | ||
mod new_lib; | ||
|
||
pub use lib_f32::*; | ||
pub use lib_f64::*; | ||
pub use lib_fenv::*; | ||
pub use lib_long_double::*; | ||
|
||
pub use musl_missing::*; | ||
pub use new_lib::*; | ||
|
||
#[no_mangle] | ||
pub static mut signgam: i32 = 0; | ||
|
||
use core::panic::PanicInfo; | ||
|
||
#[panic_handler] | ||
fn panic(_panic: &PanicInfo<'_>) -> ! { | ||
loop {} | ||
fn panic(_info: &PanicInfo) -> ! { | ||
intrinsics::abort() | ||
} | ||
|
||
/* | ||
#[panic_handler] | ||
fn panic(_: &PanicInfo<'_>) -> ! { | ||
extern "Rust" { | ||
#[link_name = "\nerror(panic-never): your program contains at least one panicking branch"] | ||
fn undefined() -> !; | ||
} | ||
unsafe { undefined() } | ||
} | ||
*/ | ||
|
||
#[lang = "eh_personality"] | ||
extern "C" fn eh_personality() {} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use libc::{c_float, c_int, c_long, c_longlong}; | ||
|
||
// todo : add a newlib test cfg feature flag? | ||
#[no_mangle] | ||
pub extern "C" fn __isfinitef(x: c_float) -> c_int { | ||
if (x as f32).is_finite() { | ||
1 | ||
} else { | ||
0 | ||
} | ||
} | ||
#[no_mangle] | ||
pub extern "C" fn __isnormalf(x: c_float) -> c_int { | ||
if (x as f32).is_normal() { | ||
1 | ||
} else { | ||
0 | ||
} | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn __fpclassifyf(_x: c_float) -> c_int { | ||
const FP_NORMAL: i32 = 0x4; | ||
FP_NORMAL | ||
} |