From 53b940c74c4f56ef075ee3c71f3cb157aaff65af Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Fri, 31 Jul 2020 03:57:20 +1200 Subject: [PATCH] [AVR] Remove unnecessary arguments passed to the linker for GNU target In general, linking with libc is not required, only libgcc is needed. As suggested in the code review, a better option for libc support is by building it into rust-lang/libc directly. This also removes the '-Os' argument to the linker, which is a NOP. --- src/librustc_target/spec/avr_gnu_base.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/librustc_target/spec/avr_gnu_base.rs b/src/librustc_target/spec/avr_gnu_base.rs index 5fcaaaacbeed..878f0e9dcba7 100644 --- a/src/librustc_target/spec/avr_gnu_base.rs +++ b/src/librustc_target/spec/avr_gnu_base.rs @@ -19,13 +19,12 @@ pub fn target(target_cpu: String) -> TargetResult { cpu: target_cpu.clone(), exe_suffix: ".elf".to_string(), linker: Some("avr-gcc".to_owned()), - pre_link_args: vec![( - LinkerFlavor::Gcc, - vec!["-Os".to_owned(), format!("-mmcu={}", target_cpu)], + pre_link_args: vec![(LinkerFlavor::Gcc, + vec![format!("-mmcu={}", target_cpu)], )] .into_iter() .collect(), - late_link_args: vec![(LinkerFlavor::Gcc, vec!["-lc".to_owned(), "-lgcc".to_owned()])] + late_link_args: vec![(LinkerFlavor::Gcc, vec!["-lgcc".to_owned()])] .into_iter() .collect(), ..super::freestanding_base::opts()