From f0d0573db1a791958938789b35309aab7323c284 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 14 Aug 2022 19:11:31 +0300 Subject: [PATCH] rustc_target: Do not specify some target options redundantly These values are already inherited --- .../src/spec/aarch64_nintendo_switch_freestanding.rs | 1 - compiler/rustc_target/src/spec/android_base.rs | 1 - .../rustc_target/src/spec/hexagon_unknown_linux_musl.rs | 1 - compiler/rustc_target/src/spec/powerpc_unknown_freebsd.rs | 3 +-- .../rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs | 2 -- compiler/rustc_target/src/spec/x86_64_unknown_none.rs | 7 ++----- 6 files changed, 3 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_target/src/spec/aarch64_nintendo_switch_freestanding.rs b/compiler/rustc_target/src/spec/aarch64_nintendo_switch_freestanding.rs index 1b7161fbb85..b301ce68a1c 100644 --- a/compiler/rustc_target/src/spec/aarch64_nintendo_switch_freestanding.rs +++ b/compiler/rustc_target/src/spec/aarch64_nintendo_switch_freestanding.rs @@ -18,7 +18,6 @@ pub fn target() -> Target { panic_strategy: PanicStrategy::Abort, position_independent_executables: true, dynamic_linking: true, - executables: true, relro_level: RelroLevel::Off, ..Default::default() }, diff --git a/compiler/rustc_target/src/spec/android_base.rs b/compiler/rustc_target/src/spec/android_base.rs index 2bf83a8782a..9f3e0bd5ef0 100644 --- a/compiler/rustc_target/src/spec/android_base.rs +++ b/compiler/rustc_target/src/spec/android_base.rs @@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions { let mut base = super::linux_base::opts(); base.os = "android".into(); base.default_dwarf_version = 2; - base.position_independent_executables = true; base.has_thread_local = false; // This is for backward compatibility, see https://github.com/rust-lang/rust/issues/49867 // for context. (At that time, there was no `-C force-unwind-tables`, so the only solution diff --git a/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs index cc2c78c69fe..2a24e4459c5 100644 --- a/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs @@ -10,7 +10,6 @@ pub fn target() -> Target { base.crt_static_default = false; base.has_rpath = true; base.linker_is_gnu = false; - base.dynamic_linking = true; base.c_enum_min_bits = 8; diff --git a/compiler/rustc_target/src/spec/powerpc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/powerpc_unknown_freebsd.rs index 516b2de37ea..75ac66c276d 100644 --- a/compiler/rustc_target/src/spec/powerpc_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/powerpc_unknown_freebsd.rs @@ -1,5 +1,5 @@ use crate::abi::Endian; -use crate::spec::{LinkerFlavor, RelocModel, Target, TargetOptions}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; pub fn target() -> Target { let mut base = super::freebsd_base::opts(); @@ -15,7 +15,6 @@ pub fn target() -> Target { options: TargetOptions { endian: Endian::Big, features: "+secure-plt".into(), - relocation_model: RelocModel::Pic, mcount: "_mcount".into(), ..base }, diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs b/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs index 78189a0c096..26da7e80011 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs @@ -4,8 +4,6 @@ pub fn target() -> Target { let mut base = super::l4re_base::opts(); base.cpu = "x86-64".into(); base.max_atomic_width = Some(64); - base.crt_static_allows_dylibs = false; - base.dynamic_linking = false; base.panic_strategy = PanicStrategy::Abort; Target { diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/x86_64_unknown_none.rs index 809fd642d41..b9a345127e3 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_none.rs @@ -4,10 +4,8 @@ // `target-cpu` compiler flags to opt-in more hardware-specific // features. -use super::{ - CodeModel, LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, RelroLevel, StackProbeType, - Target, TargetOptions, -}; +use super::{CodeModel, LinkerFlavor, LldFlavor, PanicStrategy}; +use super::{RelroLevel, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let opts = TargetOptions { @@ -18,7 +16,6 @@ pub fn target() -> Target { position_independent_executables: true, static_position_independent_executables: true, relro_level: RelroLevel::Full, - relocation_model: RelocModel::Pic, linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), linker: Some("rust-lld".into()), features: