Skip to content

Commit

Permalink
Emit _fltused on uefi targets as a short-term workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 2, 2019
1 parent 22bc9e1 commit f8ac1ae
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libcore/num/float.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// HACK(https://github.com/rust-lang/rust/issues/62785): uefi targets need special LLVM support
// unless we emit the _fltused
#[cfg(target_os = "uefi")]
#[no_mangle]
#[used]
static _fltused: i32 = 0;
1 change: 1 addition & 0 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ pub mod dec2flt;
pub mod bignum;
pub mod diy_float;

mod float;
mod wrapping;

macro_rules! usize_isize_to_xe_bytes_doc {
Expand Down
25 changes: 25 additions & 0 deletions src/test/ui/uefi-float.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// build-pass
// https://github.com/rust-lang/rust/issues/62785

#![no_std]
#![no_main]
use core::fmt::{Write,Error};

struct Dummy;

impl Write for Dummy {
fn write_str(&mut self, _s: &str) -> Result<(), Error>{
Ok(())
}
}

#[no_mangle]
pub extern "C" fn efi_main() -> i32 {
write!(Dummy,"Hello, world!").unwrap();
0
}

#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop{}
}
3 changes: 3 additions & 0 deletions src/tools/tidy/src/pal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const EXCEPTION_PATHS: &[&str] = &[
// target_os to tell targets with different LLVM-versions appart
// (e.g. `wasm32-unknown-emscripten` vs `wasm32-unknown-unknown`):
"src/libcore/hint.rs",
// HACK(https://github.com/rust-lang/rust/issues/62785): uefi targets need special LLVM support
// unless we emit the _fltused
"src/libcore/num/float.rs",
"src/libstd/sys/", // Platform-specific code for std lives here.
// This has the trailing slash so that sys_common is not excepted.
"src/libstd/os", // Platform-specific public interfaces
Expand Down

0 comments on commit f8ac1ae

Please sign in to comment.