Skip to content

Commit 523fa13

Browse files
committed
Auto merge of #31494 - alexcrichton:ar-gnu-by-default, r=brson
The compiler currently vendors its own version of "llvm-ar" (not literally the binary but rather the library support) and uses it for all major targets by default (e.g. everything defined in `src/librustc_back/target`). All custom target specs, however, still search for an `ar` tool by default. This commit changes this default behavior to using the internally bundled llvm-ar with the GNU format. Currently all targets use the GNU format except for OSX which uses the BSD format (surely makes sense, right?), and custom targets can change the format via the `archive-format` key in custom target specs. I suspect that we can outright remove support for invoking an external `ar` utility, but I figure for now there may be some crazy target relying on that so we should leave support in for now.
2 parents 9a20bfc + d66f394 commit 523fa13

12 files changed

+1
-12
lines changed

src/librustc_back/target/asmjs_unknown_emscripten.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub fn target() -> Target {
2121
no_compiler_rt: true,
2222
linker_is_gnu: true,
2323
allow_asm: false,
24-
archive_format: "gnu".to_string(),
2524
obj_is_bitcode: true,
2625
.. Default::default()
2726
};

src/librustc_back/target/bitrig_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub fn opts() -> TargetOptions {
1919
linker_is_gnu: true,
2020
has_rpath: true,
2121
position_independent_executables: true,
22-
archive_format: "gnu".to_string(),
2322
exe_allocation_crate: "alloc_system".to_string(),
2423

2524
.. Default::default()

src/librustc_back/target/dragonfly_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub fn opts() -> TargetOptions {
2929
"-Wl,-z,noexecstack".to_string(),
3030
),
3131
position_independent_executables: true,
32-
archive_format: "gnu".to_string(),
3332
exe_allocation_crate: super::maybe_jemalloc(),
3433
.. Default::default()
3534
}

src/librustc_back/target/freebsd_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub fn opts() -> TargetOptions {
2121
// Always enable NX protection when it is available
2222
"-Wl,-z,noexecstack".to_string(),
2323
],
24-
archive_format: "gnu".to_string(),
2524
exe_allocation_crate: super::maybe_jemalloc(),
2625

2726
.. Default::default()

src/librustc_back/target/le32_unknown_nacl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub fn target() -> Target {
2525
no_compiler_rt: false,
2626
linker_is_gnu: true,
2727
allow_asm: false,
28-
archive_format: "gnu".to_string(),
2928
.. Default::default()
3029
};
3130
Target {

src/librustc_back/target/linux_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub fn opts() -> TargetOptions {
3131
"-Wl,-z,noexecstack".to_string(),
3232
],
3333
position_independent_executables: true,
34-
archive_format: "gnu".to_string(),
3534
exe_allocation_crate: super::maybe_jemalloc(),
3635
has_elf_tls: true,
3736
.. Default::default()

src/librustc_back/target/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl Default for TargetOptions {
249249
pre_link_objects_dll: Vec::new(),
250250
post_link_objects: Vec::new(),
251251
late_link_args: Vec::new(),
252-
archive_format: String::new(),
252+
archive_format: "gnu".to_string(),
253253
custom_unwind_resume: false,
254254
lib_allocation_crate: "alloc_system".to_string(),
255255
exe_allocation_crate: "alloc_system".to_string(),

src/librustc_back/target/netbsd_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub fn opts() -> TargetOptions {
2929
"-Wl,-z,noexecstack".to_string(),
3030
),
3131
position_independent_executables: true,
32-
archive_format: "gnu".to_string(),
3332
.. Default::default()
3433
}
3534
}

src/librustc_back/target/openbsd_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub fn opts() -> TargetOptions {
2929
"-Wl,-z,noexecstack".to_string(),
3030
),
3131
position_independent_executables: true,
32-
archive_format: "gnu".to_string(),
3332
exe_allocation_crate: "alloc_system".to_string(),
3433
.. Default::default()
3534
}

src/librustc_back/target/solaris_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub fn opts() -> TargetOptions {
1818
executables: true,
1919
has_rpath: true,
2020
is_like_solaris: true,
21-
archive_format: "gnu".to_string(),
2221
exe_allocation_crate: super::maybe_jemalloc(),
2322

2423
.. Default::default()

src/librustc_back/target/windows_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub fn opts() -> TargetOptions {
2525
staticlib_suffix: ".lib".to_string(),
2626
no_default_libraries: true,
2727
is_like_windows: true,
28-
archive_format: "gnu".to_string(),
2928
pre_link_args: vec!(
3029
// And here, we see obscure linker flags #45. On windows, it has been
3130
// found to be necessary to have this flag to compile liblibc.

src/librustc_back/target/windows_msvc_base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ pub fn opts() -> TargetOptions {
5959
"/NOLOGO".to_string(),
6060
"/NXCOMPAT".to_string(),
6161
],
62-
archive_format: "gnu".to_string(),
6362
exe_allocation_crate: "alloc_system".to_string(),
6463

6564
.. Default::default()

0 commit comments

Comments
 (0)