Skip to content

Commit a4cd181

Browse files
committed
Change aarch64-unknown-none to generate static-PIE binaries by default
Currently, `aarch64-unknown-none` generates static position *dependent* binaries which must be loaded at a fixed address in memory. The [openVMM](https://github.com/microsoft/openvmm) project uses the `*-unknown-none` targets for an embedded-like environment but needs the binary to be loadable to any memory address. Currently, the `x86_64-unknown-none` target is configured to allow this by default but the `aarch64-unknown-none` target is not. This commit changes the defaults for the `aarch64-unknown-none` target to enable static-PIE binaries which aligns the target more closely with the corresponding `x86_64-unknown-none` target. If users prefer the prior behavior, they can request that via `-Crelocation-model=static`.
1 parent 83e49b7 commit a4cd181

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// For example, `-C target-cpu=cortex-a53`.
88

99
use crate::spec::{
10-
Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, StackProbeType, Target,
10+
Arch, Cc, LinkerFlavor, Lld, PanicStrategy, SanitizerSet, StackProbeType, Target,
1111
TargetMetadata, TargetOptions,
1212
};
1313

@@ -22,12 +22,13 @@ pub(crate) fn target() -> Target {
2222
),
2323
features: "+v8a,+strict-align,+neon".into(),
2424
supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
25-
relocation_model: RelocModel::Static,
2625
disable_redzone: true,
2726
max_atomic_width: Some(128),
2827
stack_probes: StackProbeType::Inline,
2928
panic_strategy: PanicStrategy::Abort,
3029
default_uwtable: true,
30+
position_independent_executables: true,
31+
static_position_independent_executables: true,
3132
..Default::default()
3233
};
3334
Target {

0 commit comments

Comments
 (0)