Skip to content

Commit

Permalink
rustc: Use llvm-ar for custom targets by default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton committed Feb 8, 2016
1 parent 7fce503 commit d66f394
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion src/librustc_back/target/asmjs_unknown_emscripten.rs
Expand Up @@ -21,7 +21,6 @@ pub fn target() -> Target {
no_compiler_rt: true,
linker_is_gnu: true,
allow_asm: false,
archive_format: "gnu".to_string(),
obj_is_bitcode: true,
.. Default::default()
};
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/bitrig_base.rs
Expand Up @@ -19,7 +19,6 @@ pub fn opts() -> TargetOptions {
linker_is_gnu: true,
has_rpath: true,
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: "alloc_system".to_string(),

.. Default::default()
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/dragonfly_base.rs
Expand Up @@ -29,7 +29,6 @@ pub fn opts() -> TargetOptions {
"-Wl,-z,noexecstack".to_string(),
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::maybe_jemalloc(),
.. Default::default()
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/freebsd_base.rs
Expand Up @@ -21,7 +21,6 @@ pub fn opts() -> TargetOptions {
// Always enable NX protection when it is available
"-Wl,-z,noexecstack".to_string(),
],
archive_format: "gnu".to_string(),
exe_allocation_crate: super::maybe_jemalloc(),

.. Default::default()
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/le32_unknown_nacl.rs
Expand Up @@ -25,7 +25,6 @@ pub fn target() -> Target {
no_compiler_rt: false,
linker_is_gnu: true,
allow_asm: false,
archive_format: "gnu".to_string(),
.. Default::default()
};
Target {
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/linux_base.rs
Expand Up @@ -31,7 +31,6 @@ pub fn opts() -> TargetOptions {
"-Wl,-z,noexecstack".to_string(),
],
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::maybe_jemalloc(),
has_elf_tls: true,
.. Default::default()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/mod.rs
Expand Up @@ -249,7 +249,7 @@ impl Default for TargetOptions {
pre_link_objects_dll: Vec::new(),
post_link_objects: Vec::new(),
late_link_args: Vec::new(),
archive_format: String::new(),
archive_format: "gnu".to_string(),
custom_unwind_resume: false,
lib_allocation_crate: "alloc_system".to_string(),
exe_allocation_crate: "alloc_system".to_string(),
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/netbsd_base.rs
Expand Up @@ -29,7 +29,6 @@ pub fn opts() -> TargetOptions {
"-Wl,-z,noexecstack".to_string(),
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
.. Default::default()
}
}
1 change: 0 additions & 1 deletion src/librustc_back/target/openbsd_base.rs
Expand Up @@ -29,7 +29,6 @@ pub fn opts() -> TargetOptions {
"-Wl,-z,noexecstack".to_string(),
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: "alloc_system".to_string(),
.. Default::default()
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/solaris_base.rs
Expand Up @@ -18,7 +18,6 @@ pub fn opts() -> TargetOptions {
executables: true,
has_rpath: true,
is_like_solaris: true,
archive_format: "gnu".to_string(),
exe_allocation_crate: super::maybe_jemalloc(),

.. Default::default()
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/windows_base.rs
Expand Up @@ -25,7 +25,6 @@ pub fn opts() -> TargetOptions {
staticlib_suffix: ".lib".to_string(),
no_default_libraries: true,
is_like_windows: true,
archive_format: "gnu".to_string(),
pre_link_args: vec!(
// And here, we see obscure linker flags #45. On windows, it has been
// found to be necessary to have this flag to compile liblibc.
Expand Down
1 change: 0 additions & 1 deletion src/librustc_back/target/windows_msvc_base.rs
Expand Up @@ -59,7 +59,6 @@ pub fn opts() -> TargetOptions {
"/NOLOGO".to_string(),
"/NXCOMPAT".to_string(),
],
archive_format: "gnu".to_string(),
exe_allocation_crate: "alloc_system".to_string(),

.. Default::default()
Expand Down

0 comments on commit d66f394

Please sign in to comment.