Skip to content

Commit dc93f1d

Browse files
committed
Make x86_64-unknown-linux-none relocation-model=static by default
Writing our own dynamic loader is fun, but shouldn't be the default expectation.
1 parent e5bf8b0 commit dc93f1d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, StackProbeType, Target, base};
1+
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, StackProbeType, Target, base};
22

33
pub(crate) fn target() -> Target {
44
let mut base = base::linux::opts();
@@ -8,6 +8,9 @@ pub(crate) fn target() -> Target {
88
base.linker_flavor = LinkerFlavor::Gnu(Cc::No, Lld::Yes);
99
base.linker = Some("rust-lld".into());
1010
base.panic_strategy = PanicStrategy::Abort;
11+
// Without any runtime, users would need to write their own dynamic loader to make PIE work.
12+
// While they are free to do that, avoid making that the default.
13+
base.relocation_model = RelocModel::Static;
1114

1215
Target {
1316
llvm_target: "x86_64-unknown-linux-none".into(),

0 commit comments

Comments
 (0)