Skip to content

Commit 857a43d

Browse files
authored
Rollup merge of #101413 - nicholasbishop:bishop-remove-uefi-static-reloc, r=petrochenkov
Use RelocModel::Pic for UEFI targets In #100537, the relocation model for UEFI targets was changed from PIC (the default value) to static. There was some dicussion of this change here: #100537 (comment) It turns out that this can cause compilation to fail as described in #101377, so switch back to PIC. Fixes #101377
2 parents 87eb3e2 + 54d9ba8 commit 857a43d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

compiler/rustc_target/src/spec/tests/tests_impl.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ impl Target {
146146
if self.position_independent_executables && !triple.ends_with("-linuxkernel") {
147147
assert_eq!(self.relocation_model, RelocModel::Pic);
148148
}
149-
if self.relocation_model == RelocModel::Pic {
149+
// The UEFI targets do not support dynamic linking but still require PIC (#101377).
150+
if self.relocation_model == RelocModel::Pic && self.os != "uefi" {
150151
assert!(self.dynamic_linking || self.position_independent_executables);
151152
}
152153
if self.static_position_independent_executables {

compiler/rustc_target/src/spec/uefi_msvc_base.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// code runs in the same environment, no process separation is supported.
1111

1212
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy};
13-
use crate::spec::{RelocModel, StackProbeType, TargetOptions};
13+
use crate::spec::{StackProbeType, TargetOptions};
1414

1515
pub fn opts() -> TargetOptions {
1616
let mut base = super::msvc_base::opts();
@@ -47,7 +47,6 @@ pub fn opts() -> TargetOptions {
4747
stack_probes: StackProbeType::Call,
4848
singlethread: true,
4949
linker: Some("rust-lld".into()),
50-
relocation_model: RelocModel::Static,
5150
..base
5251
}
5352
}

src/test/codegen/abi-efiapi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ trait Freeze { }
2424
#[lang="copy"]
2525
trait Copy { }
2626

27-
//x86_64: define dso_local win64cc void @has_efiapi
27+
//x86_64: define win64cc void @has_efiapi
2828
//i686: define void @has_efiapi
2929
//aarch64: define dso_local void @has_efiapi
3030
//arm: define dso_local void @has_efiapi

0 commit comments

Comments
 (0)