diff options
| author | Dylan McKay <me@dylanmckay.io> | 2020-07-31 04:04:26 +1200 |
|---|---|---|
| committer | Dylan McKay <me@dylanmckay.io> | 2020-08-24 18:43:31 +1200 |
| commit | dc2023801281dd21f04c97fc4ec073c02b2abd46 (patch) | |
| tree | bdea81690de27b165e32a1d93f5bd04e9456dac5 | |
| parent | 53b940c74c4f56ef075ee3c71f3cb157aaff65af (diff) | |
| download | rust-dc2023801281dd21f04c97fc4ec073c02b2abd46.tar.gz rust-dc2023801281dd21f04c97fc4ec073c02b2abd46.zip | |
[AVR] Merge the 'freestanding' base target spec into AVR base target spec
The 'freestanding' module was only ever used for AVR. It was an unnecessary layer of abstraction. This commit merges the 'freestanding_base' module into 'avr_gnu_base'.
| -rw-r--r-- | src/librustc_target/spec/avr_gnu_base.rs | 24 | ||||
| -rw-r--r-- | src/librustc_target/spec/freestanding_base.rs | 31 | ||||
| -rw-r--r-- | src/librustc_target/spec/mod.rs | 1 |
3 files changed, 21 insertions, 35 deletions
diff --git a/src/librustc_target/spec/avr_gnu_base.rs b/src/librustc_target/spec/avr_gnu_base.rs index 878f0e9dcba..ff559c2bfd6 100644 --- a/src/librustc_target/spec/avr_gnu_base.rs +++ b/src/librustc_target/spec/avr_gnu_base.rs @@ -18,16 +18,34 @@ pub fn target(target_cpu: String) -> TargetResult { options: TargetOptions { cpu: target_cpu.clone(), exe_suffix: ".elf".to_string(), + linker: Some("avr-gcc".to_owned()), - pre_link_args: vec![(LinkerFlavor::Gcc, - vec![format!("-mmcu={}", target_cpu)], + dynamic_linking: false, + executables: true, + linker_is_gnu: true, + has_rpath: false, + position_independent_executables: false, + eh_frame_header: false, + pre_link_args: vec![( + LinkerFlavor::Gcc, + vec![ + format!("-mmcu={}", target_cpu), + // We want to be able to strip as much executable code as possible + // from the linker command line, and this flag indicates to the + // linker that it can avoid linking in dynamic libraries that don't + // actually satisfy any symbols up to that point (as with many other + // resolutions the linker does). This option only applies to all + // following libraries so we're sure to pass it as one of the first + // arguments. + "-Wl,--as-needed".to_string(), + ], )] .into_iter() .collect(), late_link_args: vec![(LinkerFlavor::Gcc, vec!["-lgcc".to_owned()])] .into_iter() .collect(), - ..super::freestanding_base::opts() + ..TargetOptions::default() }, }) } diff --git a/src/librustc_target/spec/freestanding_base.rs b/src/librustc_target/spec/freestanding_base.rs deleted file mode 100644 index c338856228d..00000000000 --- a/src/librustc_target/spec/freestanding_base.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; -use std::default::Default; - -pub fn opts() -> TargetOptions { - let mut args = LinkArgs::new(); - - args.insert( - LinkerFlavor::Gcc, - vec![ - // We want to be able to strip as much executable code as possible - // from the linker command line, and this flag indicates to the - // linker that it can avoid linking in dynamic libraries that don't - // actually satisfy any symbols up to that point (as with many other - // resolutions the linker does). This option only applies to all - // following libraries so we're sure to pass it as one of the first - // arguments. - "-Wl,--as-needed".to_string(), - ], - ); - - TargetOptions { - dynamic_linking: false, - executables: true, - linker_is_gnu: true, - has_rpath: false, - pre_link_args: args, - position_independent_executables: false, - eh_frame_header: false, - ..Default::default() - } -} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index b16351c063a..d6e8b304380 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -55,7 +55,6 @@ mod avr_gnu_base; mod cloudabi_base; mod dragonfly_base; mod freebsd_base; -mod freestanding_base; mod fuchsia_base; mod haiku_base; mod hermit_base; |
