Skip to content

Commit dc20238

Browse files
committed
[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'.
1 parent 53b940c commit dc20238

File tree

3 files changed

+21
-35
lines changed

3 files changed

+21
-35
lines changed

src/librustc_target/spec/avr_gnu_base.rs

+21-3
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,34 @@ pub fn target(target_cpu: String) -> TargetResult {
1818
options: TargetOptions {
1919
cpu: target_cpu.clone(),
2020
exe_suffix: ".elf".to_string(),
21+
2122
linker: Some("avr-gcc".to_owned()),
22-
pre_link_args: vec![(LinkerFlavor::Gcc,
23-
vec![format!("-mmcu={}", target_cpu)],
23+
dynamic_linking: false,
24+
executables: true,
25+
linker_is_gnu: true,
26+
has_rpath: false,
27+
position_independent_executables: false,
28+
eh_frame_header: false,
29+
pre_link_args: vec![(
30+
LinkerFlavor::Gcc,
31+
vec![
32+
format!("-mmcu={}", target_cpu),
33+
// We want to be able to strip as much executable code as possible
34+
// from the linker command line, and this flag indicates to the
35+
// linker that it can avoid linking in dynamic libraries that don't
36+
// actually satisfy any symbols up to that point (as with many other
37+
// resolutions the linker does). This option only applies to all
38+
// following libraries so we're sure to pass it as one of the first
39+
// arguments.
40+
"-Wl,--as-needed".to_string(),
41+
],
2442
)]
2543
.into_iter()
2644
.collect(),
2745
late_link_args: vec![(LinkerFlavor::Gcc, vec!["-lgcc".to_owned()])]
2846
.into_iter()
2947
.collect(),
30-
..super::freestanding_base::opts()
48+
..TargetOptions::default()
3149
},
3250
})
3351
}

src/librustc_target/spec/freestanding_base.rs

-31
This file was deleted.

src/librustc_target/spec/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ mod avr_gnu_base;
5555
mod cloudabi_base;
5656
mod dragonfly_base;
5757
mod freebsd_base;
58-
mod freestanding_base;
5958
mod fuchsia_base;
6059
mod haiku_base;
6160
mod hermit_base;

0 commit comments

Comments
 (0)