Commit graph

47 commits

Author SHA1 Message Date
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
Alex Crichton
6122a5f559 mk: Fix MSVC build for rustllvm.lib
This commit updates the rustllvm.mk file with the necessary flags and such to
build rustllvm.lib with cl.exe instead of gcc. Some comments can be found in the
commit itself.
2015-05-19 10:52:57 -07:00
Alex Crichton
681fc82456 mk: Remove a bunch of unused directives 2015-04-27 09:22:05 -07:00
Murarth
2c028452b5 Add LLVM ExecutionEngine API 2014-12-11 15:33:27 -07:00
Alex Crichton
91882a4c56 Remove VPATH usage in Makefiles
This is just messing up all the doc dependencies because of such similar
directory names and file names.

Closes #11422
2014-02-02 10:59:14 -08:00
Alex Crichton
2611483894 Refactor the build system for easily adding crates
Before this patch, if you wanted to add a crate to the build system you had to
change about 100 lines across 8 separate makefiles. This is highly error prone
and opaque to all but a few. This refactoring is targeted at consolidating this
effort so adding a new crate adds one line in one file in a way that everyone
can understand it.
2014-01-26 00:53:41 -08:00
Alex Crichton
e91ffb0710 Link rustllvm statically, and distribute a static snapshot
In order to keep up to date with changes to the libraries that `llvm-config`
spits out, the dependencies to the LLVM are a dynamically generated rust file.
This file is now automatically updated whenever LLVM is updated to get kept
up-to-date.

At the same time, this cleans out some old cruft which isn't necessary in the
makefiles in terms of dependencies.

Closes #10745
Closes #10744
2013-12-06 20:51:17 -08:00
Heather
8a593a8bdb support for GNU configure syntax 2013-10-29 16:22:08 -07:00
Vadim Chugunov
d4ebe835b2 Fixed makefile to point to the new llvm build directory. 2013-09-05 23:44:10 -07:00
Alex Crichton
7b3dd32797 Move the rt build directory under $target
Closes #2302
2013-09-04 23:34:09 -07:00
Alex Crichton
6b3c7cb4e2 Build rustllvm into $target/rustllvm 2013-09-03 23:48:45 -07:00
James Miller
d694e283b3 Refactor optimization pass handling.
Refactor the optimization passes to explicitly use the passes. This commit
just re-implements the same passes as were already being run.

It also adds an option (behind `-Z`) to run the LLVM lint pass on the
unoptimized IR.
2013-05-29 14:16:49 +12:00
Young-il Choi
7714d52cd9 mk: cleanup - lib and executable suffix handling 2013-03-02 21:25:12 +09:00
Young-il Choi
26a5dc593c mk: rewrite make files 2013-02-27 14:53:35 +09:00
Brian Anderson
15c0c35352 mk: Split target triples into bulid triple + host triples + target triples
For cross compiling to targets that don't want to build a compiler
2013-02-21 17:51:55 -08:00
Graydon Hoare
d1affff623 Reliciense makefiles and testsuite. Yup. 2012-12-10 17:32:58 -08:00
Zack Corr
4912428cb5 rusti: Add linenoise, wrap into core::rl and add rusti REPL tool
Add Brian Leibig to AUTHORS.txt for REPL contributions
2012-10-27 18:03:15 +10:00
Zack Corr
efb576a60d jit: Clean rustllvm code, let rustc expose __morestack instead of linking in libmorestack and return _rust_main and call it from rustc 2012-08-31 16:20:36 -07:00
Zack Corr
795acb7395 jit: Link in __morestack and make it resolvable by JIT 2012-08-31 16:20:36 -07:00
Michael Sullivan
f99f2e8ce2 Update the build system to handle dependency on header files. Closes #2547. 2012-06-14 14:50:14 -07:00
Michael Sullivan
3a36ffe5ff Revert "Update the build system to handle dependency on header files. Closes #2547."
This reverts commit 31f4b63dff.
2012-06-13 18:37:07 -07:00
Michael Sullivan
31f4b63dff Update the build system to handle dependency on header files. Closes #2547. 2012-06-13 16:39:09 -07:00
Michael Sullivan
f8afe107fa Minor makefile cleanup. 2012-06-13 16:39:09 -07:00
Patrick Walton
59abf93b79 llvm: Update llvm to use new gcnoteroot infrastructure 2012-04-09 18:06:22 -07:00
Brian Anderson
a92218e630 Upgrade LLVM to svn revision 145779
This pulls in commits 145765 & 145766, which are required for split stacks.
2011-12-04 14:59:56 -08:00
Niko Matsakis
9c00c62b08 fix makefiles, add option to ignore changes in makefiles 2011-11-29 12:51:09 -08:00
Brian Anderson
4b6585c924 Parameterize the LLVM build over the target triples 2011-11-05 13:23:11 -07:00
Brian Anderson
a4e1a438f6 Cleanup LLVM build rules after rebase onto x64 changes 2011-11-05 13:23:11 -07:00
Brian Anderson
a0ff3db258 LLVM build cleanup 2011-11-05 13:23:11 -07:00
Brian Anderson
26bb6716ef Tie the LLVM build into ours 2011-11-05 13:23:10 -07:00
Niko Matsakis
2bfa72ea42 virtualize rustllvm construction per target triple 2011-11-02 14:14:20 -07:00
Patrick Walton
c9003d301f Stub a __morestack implementation and stack segment allocation. Untested. 2011-10-31 14:20:56 -07:00
Brian Anderson
d8a85f0758 Make rpath work on mac 2011-10-06 13:09:00 -07:00
Patrick Walton
e8d170beae rt: Stub Rust GC metadata printer and Rust GC strategy modules 2011-08-11 21:15:26 -07:00
Rafael Ávila de Espíndola
6402b63b4f Use the new C API for PassManagerBuilder. 2011-08-11 19:09:52 -04:00
Rafael Ávila de Espíndola
01675f34e0 Remove old hack of creating a .a file with code that existed both in rust
and on newer versions of llvm.
2011-07-25 16:18:39 -04:00
Brian Anderson
09ca57adb0 Revert "Revert "Rename Passes2.cpp to Passes.cpp""
This reverts commit 52507f406e.
2011-07-17 19:16:23 -07:00
Brian Anderson
52507f406e Revert "Rename Passes2.cpp to Passes.cpp"
This reverts commit c18127b913.
2011-07-17 19:15:27 -07:00
Brian Anderson
c18127b913 Rename Passes2.cpp to Passes.cpp
The original Passes.cpp is dead so Passes2 gets promoted
2011-07-17 14:57:28 -07:00
Brian Anderson
13f5de0671 Remove Passes.cpp from rustllvm
Upstreamed
2011-07-17 14:57:28 -07:00
Brian Anderson
b7699b7889 Remove Object.h from rustllvm
This file appears to be upstream now
2011-07-17 14:57:28 -07:00
Graydon Hoare
8ebcab711d More work on mingw cross build. 2011-06-28 11:18:34 -07:00
Rafael Ávila de Espíndola
bea28ea537 Easy fix for using newer LLVMs: just use the MachOObjectFile.cpp they provide. 2011-06-27 11:52:23 -04:00
Graydon Hoare
79ba31504b Fixes to speed and clean up makefiles. 2011-06-25 19:23:32 +00:00
Patrick Walton
269550f673 build: Use clang to compile the runtime if available 2011-05-08 21:10:43 -07:00
Patrick Walton
d089d9f9ed rustllvm: Add a binding to the LLVM standard module passes 2011-05-06 12:38:00 -07:00
Graydon Hoare
40624e35d7 Start splitting up Makefile.in 2011-05-01 20:20:25 +00:00