-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[Regression] GlobalValue with DLLImport Storage is dso_local! #101377
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Confirmed with searched nightlies: from nightly-2022-09-01 to nightly-2022-09-03 bisected with cargo-bisect-rustc v0.6.4Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --preserve --start 2022-09-01 -- build --target x86_64-unknown-uefi # Cargo.toml:
[dependencies]
uefi = "0.16.1"
uefi-services = "0.13.1"
# .cargo/config.toml:
[unstable]
build-std = ["core", "compiler_builtins", "alloc"]
build-std-features = ["compiler-builtins-mem"] // src/main.rs:
#![no_main]
#![no_std]
use uefi::prelude::*;
#[export_name = "efi_main"]
pub extern "C" fn main(_h: *mut core::ffi::c_void, mut st: SystemTable<Boot>) -> usize {
uefi_services::init(&mut st).expect("Failed to initialize utilities");
0
} The |
Here's a slightly reduced test case: # Cargo.toml:
[dependencies]
log = { version = "0.4.5", default-features = false }
# .cargo/config.toml:
[unstable]
build-std = ["core", "compiler_builtins", "alloc"]
build-std-features = ["compiler-builtins-mem"] // src/main.rs:
#![no_main]
#![no_std]
use core::ffi::c_void;
#[panic_handler]
fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
#[export_name = "efi_main"]
pub extern "C" fn main(_h: *mut c_void, _st: *mut c_void) -> usize {
log::error!("hello");
0
} Build output:
It seems the issue here is the switch from PIC to static for the reloc model in the UEFI targets. I will put up a PR to switch it back. |
It feels wrong to produce executables with So I think there is some bug hiding somewhere. However, reverting to PIC to get things working is preferable to the status quo. The linked PR looks good to me! |
…static-reloc, r=petrochenkov Use RelocModel::Pic for UEFI targets In rust-lang#100537, the relocation model for UEFI targets was changed from PIC (the default value) to static. There was some dicussion of this change here: rust-lang#100537 (comment) It turns out that this can cause compilation to fail as described in rust-lang#101377, so switch back to PIC. Fixes rust-lang#101377
Hello,
I was trying to compile the uefi crate, but I can't compile it with nightly-2022-09-02. The previous nightly works fine.
I get:
GlobalValue with DLLImport Storage is dso_local!
ptr @_ZN4core7unicode12unicode_data11white_space14WHITESPACE_MAP17h76c794c1a16111d0E
LLVM ERROR: Broken module found, compilation aborted!
Maybe, the pr that broke it is #100537.
The text was updated successfully, but these errors were encountered: