rust/mk
Alex Crichton 4a824275b9 trans: Use LLVM's writeArchive to modify archives
We have previously always relied upon an external tool, `ar`, to modify archives
that the compiler produces (staticlibs, rlibs, etc). This approach, however, has
a number of downsides:

* Spawning a process is relatively expensive for small compilations
* Encoding arguments across process boundaries often incurs unnecessary overhead
  or lossiness. For example `ar` has a tough time dealing with files that have
  the same name in archives, and the compiler copies many files around to ensure
  they can be passed to `ar` in a reasonable fashion.
* Most `ar` programs found do **not** have the ability to target arbitrary
  platforms, so this is an extra tool which needs to be found/specified when
  cross compiling.

The LLVM project has had a tool called `llvm-ar` for quite some time now, but it
wasn't available in the standard LLVM libraries (it was just a standalone
program). Recently, however, in LLVM 3.7, this functionality has been moved to a
library and is now accessible by consumers of LLVM via the `writeArchive`
function.

This commit migrates our archive bindings to no longer invoke `ar` by default
but instead make a library call to LLVM to do various operations. This solves
all of the downsides listed above:

* Archive management is now much faster, for example creating a "hello world"
  staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also
  recently started requiring modification of rlibs, and linking a hello world
  dynamic library is now 2x faster.
* The compiler is now one step closer to "hassle free" cross compilation because
  no external tool is needed for managing archives, LLVM does the right thing!

This commit does not remove support for calling a system `ar` utility currently.
We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward
(so the system LLVM can be used wherever possible), and in these cases we must
shell out to a system utility. All nightly builds of Rust, however, will stop
needing a system `ar`.
2015-07-10 09:06:21 -07:00
..
cfg Add netbsd amd64 support 2015-07-01 19:09:14 -07:00
clean.mk mk: Enable building LLVM targeting MSVC 2015-05-19 10:52:57 -07:00
crates.mk mk: Build crates with relative paths to rustc 2015-06-13 01:41:52 +02:00
ctags.mk Fix make TAGS.emacs. 2014-12-16 17:08:49 +01:00
debuggers.mk debuginfo: Create common debugger pretty printer module. 2015-05-30 20:06:08 +02:00
dist.mk mk: Don't build compiler-docs before installation. #25699 2015-05-22 13:02:52 -07:00
docs.mk diagnostics: Resurrect the Compiler Error Index. 2015-06-20 16:57:40 +10:00
grammar.mk Add a LALR grammar for Rust with testing support 2015-01-20 18:47:17 -08:00
host.mk mk: Add space before line continuation backslash 2014-07-23 08:44:11 -07:00
install.mk configure: Remove obsolete --disable-verify option 2015-04-08 12:16:47 -07:00
llvm.mk mk: Add the ability to depend on native LLVM tools 2015-05-19 10:53:04 -07:00
main.mk Remove unused variable 2015-07-06 08:40:40 -04:00
perf.mk support for GNU configure syntax 2013-10-29 16:22:08 -07:00
platform.mk mk: Add support for i686-pc-windows-msvc 2015-06-27 13:02:18 -07:00
prepare.mk Replace nop hack, explain substitution reasoning 2015-06-13 17:27:12 +01:00
reconfig.mk mk: Fix reconfiguring top-level ./configure 2015-06-17 17:32:11 -07:00
rt.mk mk: Add support for i686-pc-windows-msvc 2015-06-27 13:02:18 -07:00
rustllvm.mk trans: Use LLVM's writeArchive to modify archives 2015-07-10 09:06:21 -07:00
snap.mk mk: Remove extra whitespace before line continuation backslashes 2014-07-23 08:41:55 -07:00
stage0.mk mk/stage0: complain instead of creating an empty file 2014-11-20 16:00:12 -05:00
target.mk msvc: Lookup linker in windows registry 2015-07-01 09:35:55 -07:00
tests.mk Auto merge of #25654 - petrochenkov:encenv, r=alexcrichton 2015-06-02 02:08:17 +00:00
util.mk mk: Build crates with relative paths to rustc 2015-06-13 01:41:52 +02:00