Skip to content

Commit 0188664

Browse files
committed
Swap TargetOptions::linker_is_gnu default from false to true and update targets as appropriate.
1 parent 99e3aef commit 0188664

File tree

7 files changed

+8
-2
lines changed

7 files changed

+8
-2
lines changed

compiler/rustc_target/src/spec/apple_base.rs

+1
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/illumos_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub fn opts() -> TargetOptions {
3333
has_rpath: true,
3434
families: vec!["unix".to_string()],
3535
is_like_solaris: true,
36+
linker_is_gnu: false,
3637
limit_rdylib_exports: false, // Linker doesn't support this
3738
eliminate_frame_pointer: false,
3839
eh_frame_header: false,

compiler/rustc_target/src/spec/l4re_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub fn opts() -> TargetOptions {
2020
executables: true,
2121
panic_strategy: PanicStrategy::Abort,
2222
linker: Some("ld".to_string()),
23+
linker_is_gnu: false,
2324
families: vec!["unix".to_string()],
2425
..Default::default()
2526
}

compiler/rustc_target/src/spec/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ pub struct TargetOptions {
10861086
/// Version of DWARF to use if not using the default.
10871087
/// Useful because some platforms (osx, bsd) only want up to DWARF2.
10881088
pub dwarf_version: Option<u32>,
1089-
/// Whether the linker support GNU-like arguments such as -O. Defaults to false.
1089+
/// Whether the linker support GNU-like arguments such as -O. Defaults to true.
10901090
pub linker_is_gnu: bool,
10911091
/// The MinGW toolchain has a known issue that prevents it from correctly
10921092
/// handling COFF object files with more than 2<sup>15</sup> sections. Since each weak
@@ -1307,7 +1307,7 @@ impl Default for TargetOptions {
13071307
is_like_fuchsia: false,
13081308
is_like_wasm: false,
13091309
dwarf_version: None,
1310-
linker_is_gnu: false,
1310+
linker_is_gnu: true,
13111311
allows_weak_linkage: true,
13121312
has_rpath: false,
13131313
no_default_libraries: true,

compiler/rustc_target/src/spec/msvc_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
1616
is_like_windows: true,
1717
is_like_msvc: true,
1818
lld_flavor: LldFlavor::Link,
19+
linker_is_gnu: false,
1920
pre_link_args,
2021
abi_return_struct_as_int: true,
2122
emit_debug_gdb_scripts: false,

compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub fn target() -> Target {
1414
linker_flavor: LinkerFlavor::PtxLinker,
1515
// The linker can be installed from `crates.io`.
1616
linker: Some("rust-ptx-linker".to_string()),
17+
linker_is_gnu: false,
1718

1819
// With `ptx-linker` approach, it can be later overridden via link flags.
1920
cpu: "sm_30".to_string(),

compiler/rustc_target/src/spec/solaris_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub fn opts() -> TargetOptions {
88
has_rpath: true,
99
families: vec!["unix".to_string()],
1010
is_like_solaris: true,
11+
linker_is_gnu: false,
1112
limit_rdylib_exports: false, // Linker doesn't support this
1213
eh_frame_header: false,
1314

0 commit comments

Comments
 (0)