Skip to content

Commit 21e1cd9

Browse files
committed
Auto merge of #85531 - luqmana:flip-gc, r=petrochenkov
Swap TargetOptions::linker_is_gnu default from false to true and update targets as appropriate. #85274 gated the `--gc-sections` flag on targets that specified `linker_is_gnu` to stop us from passing it to incompatible linkers. But that had the unintended effect of the flag no longer being passed on targets for which it is valid and hence caused a regression in binary size. Given that most `ld`-style linkers are GNU compatible, this change flips our default for `linker_is_gnu` from false to true. That also means updating the targets that relied on the previous default: * Apple * Illumos * L4Re (not sure about this one) * MSVC * NvtPtx * Solaris Fixes #85519
2 parents 51d1610 + 3221a5e commit 21e1cd9

27 files changed

+8
-22
lines changed

compiler/rustc_target/src/spec/aarch64_unknown_none.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub fn target() -> Target {
1616
executables: true,
1717
relocation_model: RelocModel::Static,
1818
disable_redzone: true,
19-
linker_is_gnu: true,
2019
max_atomic_width: Some(128),
2120
panic_strategy: PanicStrategy::Abort,
2221
unsupported_abis: super::arm_base::unsupported_abis(),

compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub fn target() -> Target {
1616
executables: true,
1717
relocation_model: RelocModel::Static,
1818
disable_redzone: true,
19-
linker_is_gnu: true,
2019
max_atomic_width: Some(128),
2120
panic_strategy: PanicStrategy::Abort,
2221
unsupported_abis: super::arm_base::unsupported_abis(),

compiler/rustc_target/src/spec/apple_base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub fn opts(os: &str) -> TargetOptions {
2222
// macOS has -dead_strip, which doesn't rely on function_sections
2323
function_sections: false,
2424
dynamic_linking: true,
25+
linker_is_gnu: false,
2526
executables: true,
2627
families: vec!["unix".to_string()],
2728
is_like_osx: true,

compiler/rustc_target/src/spec/avr_gnu_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub fn target(target_cpu: String) -> Target {
1616

1717
linker: Some("avr-gcc".to_owned()),
1818
executables: true,
19-
linker_is_gnu: true,
2019
eh_frame_header: false,
2120
pre_link_args: vec![(LinkerFlavor::Gcc, vec![format!("-mmcu={}", target_cpu)])]
2221
.into_iter()

compiler/rustc_target/src/spec/dragonfly_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pub fn opts() -> TargetOptions {
66
dynamic_linking: true,
77
executables: true,
88
families: vec!["unix".to_string()],
9-
linker_is_gnu: true,
109
has_rpath: true,
1110
position_independent_executables: true,
1211
relro_level: RelroLevel::Full,

compiler/rustc_target/src/spec/freebsd_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pub fn opts() -> TargetOptions {
66
dynamic_linking: true,
77
executables: true,
88
families: vec!["unix".to_string()],
9-
linker_is_gnu: true,
109
has_rpath: true,
1110
position_independent_executables: true,
1211
eliminate_frame_pointer: false, // FIXME 43575

compiler/rustc_target/src/spec/fuchsia_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub fn opts() -> TargetOptions {
2727
executables: true,
2828
families: vec!["unix".to_string()],
2929
is_like_fuchsia: true,
30-
linker_is_gnu: true,
3130
pre_link_args,
3231
pre_link_objects: crt_objects::new(&[
3332
(LinkOutputKind::DynamicNoPicExe, &["Scrt1.o"]),

compiler/rustc_target/src/spec/haiku_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub fn opts() -> TargetOptions {
77
executables: true,
88
families: vec!["unix".to_string()],
99
relro_level: RelroLevel::Full,
10-
linker_is_gnu: true,
1110
..Default::default()
1211
}
1312
}

compiler/rustc_target/src/spec/hermit_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn opts() -> TargetOptions {
1313
linker: Some("rust-lld".to_owned()),
1414
executables: true,
1515
has_elf_tls: true,
16-
linker_is_gnu: true,
1716
pre_link_args,
1817
panic_strategy: PanicStrategy::Abort,
1918
position_independent_executables: true,

compiler/rustc_target/src/spec/hermit_kernel_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn opts() -> TargetOptions {
1414
linker: Some("rust-lld".to_owned()),
1515
executables: true,
1616
has_elf_tls: true,
17-
linker_is_gnu: true,
1817
pre_link_args,
1918
panic_strategy: PanicStrategy::Abort,
2019
position_independent_executables: true,

0 commit comments

Comments
 (0)