Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit _fltused on uefi targets as a short-term workaround #64990

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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