Commit Graph

50317 Commits

Author SHA1 Message Date
Corey Farwell
e5e2cdb9e3 Add LLVM ModulePass regression test using run-make.
Part of #31185
2016-02-13 22:04:51 -05:00
bors
c7640aa2aa Auto merge of #31583 - petrochenkov:indi_ast, r=Manishearth
cc #31487
plugin-[breaking-change]

The AST part of https://github.com/rust-lang/rust/pull/30087

r? @Manishearth
2016-02-12 14:56:20 +00:00
bors
9257e8956e Auto merge of #31541 - tomaka:more-emscripten, r=brson
r? @brson
2016-02-12 12:51:12 +00:00
bors
77f9231818 Auto merge of #31368 - JohanLorenzo:dont-strip-if-test-build, r=alexcrichton
Tools which rely on DWARF for generating code coverage report, don't generate accurate numbers on test builds. For instance, [this sample main](757bdbf388/src/main.rs) returns [100% coverage](https://coveralls.io/builds/4940156/source?filename=main.rs) when [kcov](https://github.com/SimonKagstrom/kcov/) runs.

With @pnkfelix 's great help, we could narrow down the issue: The linker strips unused function during phase 6. Here's a patch which stops stripping when someone calls `rustc --test $ARGS`. @pnkfelix wasn't sure if we should add a new flag, or just use --test. What do you think @alexcrichton ?

Also, I'm not too sure: where is the best place to add a test for this addition?

Thanks for the help!
2016-02-12 05:53:18 +00:00
bors
4b2c7030fd Auto merge of #30830 - arcnmx:static-extern, r=alexcrichton
See #29676

r? @alexcrichton
2016-02-12 02:16:13 +00:00
bors
78a5d5b54e Auto merge of #31123 - alexcrichton:who-doesnt-want-two-build-systems, r=brson
This series of commits adds the initial implementation of a new build system for
the compiler and standard library based on Cargo. The high-level architecture
now looks like:

1. The `./configure` script is run with `--enable-rustbuild` and other standard
   configuration options.
2. A `Makefile` is generate which proxies commands to the new build system.
3. The new build system has a Python script entry point which manages
   downloading both a Rust and Cargo nightly. This initial script also manages
   building the build system itself (which is written in Rust).
4. The build system, written in rust and called `bootstrap`, architects how to
   call `cargo` and manages building all native libraries and such.

One might reasonably ask "why rewrite the build system?", which is a good
question! The Rust project has used Makefiles for as long as I can remember at
least, and while ugly and difficult to use are undeniably robust as they contain
years worth of tweaking and tuning for working on as many platforms in as many
situation as possible. The rationale behind this PR, however is:

* The makefiles are impenetrable to all but a few people on this
  planet. This means that contributions to the build system are almost
  nonexistent, and furthermore if a build system change is needed it's
  incredibly difficult to figure out how to do so. This hindrance prevents us
  from doing some "perhaps fancier" things we may wish to do in make.

* Our build system, while portable, is unfortunately not infinitely portable
  everywhere.  For example the recently-introduced MSVC target is quite unlikely
  to have `make` installed by default (e.g. it requires building inside of an
  MSYS2 shell currently). Conversely, the portability of make comes at a cost of
  crazy and weird hacks to work around all sorts of versions of software
  everywhere, especially when it comes to the configure script and makefiles.
  By rewriting this logic in one of the most robust platforms there is, Rust,
  we get to assuage all of these worries for free!

* There's a standard tool to build Rust crates, Cargo, but the standard library
  and compiler don't use it. This means that they cannot benefit easily from the
  crates.io ecosystem, nor can the ecosystem benefit from a standard way to
  build this repository itself. Moving to Cargo should help assuage both of
  these needs. This has the added benefit of making the compiler more
  approachable for newbies as working on the compiler will just happen to be
  working on a large Cargo project, all the same standard tools and tricks will
  apply.

* There's a huge amount of portability information in the main distribution, for
  example around cross compiling, compiling on new OSes, etc. Pushing this logic
  into standard crates (like `gcc`) enables the community to immediately benefit
  from new build logic.

Despite these benefits, it's going to be a long road to actually replace our
current build system. This PR is just the beginning and doesn't implement the
full suite of functionality as the current one, but there are many more to
follow! The current implementation strategy hopes to look like:

1. Land a second build system in-tree that can be itereated on an and
   contributed to. This will not be used just yet in terms of gating new commits
   to the repo.
2. Over time, bring the second build system to feature parity with the old build
   system, start setting up CI for both build systems.
3. At some point in the future, switch the default to the new build system, but
   keep the old one around.
4. At some further point in the future, delete the entire old build system.

---

Alright, so with all that out of the way, here's some more info on this PR
itself. The inital build system here is contained in the `src/bootstrap`
directory and just adds the necessary minimum bits to bootstrap the compiler
itself. There is currently no support for building documentation, running tests,
or installing, but the implemented support is:

* Compiling LLVM with `cmake` instead of `./configure` + `make`. The LLVM
  project is removing their autotools build system, so we'd have to make this
  transition eventually anyway.

* Compiling compiler-rt with `cmake` as well (for the same rationale as above).

* Adding `Cargo.toml` to map out the dependency graph to all crates, and also
  adding `build.rs` files where appropriate. For example `alloc_jemalloc` has a
  script to build jemalloc, `flate` has a script to build `miniz.c`, `std` will
  build `libbacktrace`, etc.

* Orchestrating all the calls to `cargo` to build the standard distribution,
  following the normal bootstrapping process. This also tracks dependencies
  between steps to ensure cross-compilation targets happen as well.

* Configuration is intended to eventually be done through a `config.toml` file,
  so support is implemented for this. The most likely vector of configuration
  for now, however, is likely through `config.mk` (what `./configure` emits), so
  the build system currently parses this information.

There's still quite a few steps left to do, and I'll open up some follow-up
issues (as well as a tracking issue) for this migration, but hopefully this is a
great start to get going! This PR is currently tested on all the
Windows/Linux/OSX triples for x86\_64 and x86, but more portability is always
welcome!

---

Future functionality left to implement

* [ ] Re-verify that multi-host builds work
* [ ] Verify android build works
* [ ] Verify iOS build work (mostly compiler-rt)
* [ ] Verify sha256 and ideally gpg of downloaded nightly compiler and nightly rustc
* [ ] Implement testing -- this is a huge bullet point with lots of sub-bullets
* [ ] Build and generate documentation (plus the various tools we have in-tree)
* [ ] Move various src/etc scripts into Rust -- not sure how this interacts with `make` build system
* [ ] Implement `make install` - like testing this is also quite massive
* [x] Deduplicate version information with makefiles
2016-02-12 00:19:13 +00:00
bors
98ec51a4dd Auto merge of #31545 - dotdash:no_noalias, r=alexcrichton
LLVM's memory dependence analysis doesn't properly account for calls
that could unwind and thus effectively act as a branching point. This
can lead to stores that are only visible when the call unwinds being
removed, possibly leading to calls to drop() functions with b0rked
memory contents.

As there is no fix for this in LLVM yet and we want to keep
compatibility to current LLVM versions anyways, we have to workaround
this bug by omitting the noalias attribute on &mut function arguments.
Benchmarks suggest that the performance loss by this change is very
small.

Thanks to @RalfJung for pushing me towards not removing too many
noalias annotations and @alexcrichton for helping out with the test for
this bug.

Fixes #29485
2016-02-11 22:22:54 +00:00
Vadim Petrochenkov
77cc5764b9 Remove some unnecessary indirection from AST structures 2016-02-11 23:33:09 +03:00
Alex Crichton
55dd595c08 rustc_back: Fix disabling jemalloc
When building with Cargo we need to detect `feature = "jemalloc"` to enable
jemalloc, so propagate this same change to the build system to pass the right
`--cfg` argument.
2016-02-11 11:12:33 -08:00
Alex Crichton
bb2e92171f configure: Add an option to use the cargo build system
This commit adds a `--enable-rustbuild` option to the configure script which
will copy a different `Makefile.in` into place to intercept all `make`
invocations.

Currently this makefile only has one target, but it's expected to be filled out
quite a bit over time!
2016-02-11 11:12:33 -08:00
Alex Crichton
34f7364332 rustc_llvm: Tweak how initialization is performed
Refactor a bit to have less repetition and #[cfg] and try to bury it all inside
of a macro.
2016-02-11 11:12:33 -08:00
Alex Crichton
32c56138ec rustbook: Make main a public function
This will allow it to be used as a crate in a Cargo-based build
2016-02-11 11:12:32 -08:00
Alex Crichton
eac0a8bc30 bootstrap: Add directives to not double-link libs
Have all Cargo-built crates pass `--cfg cargobuild` and then add appropriate
`#[cfg]` definitions to all crates to avoid linking anything if this is passed.
This should help allow libstd to compile with both the makefiles and with Cargo.
2016-02-11 11:12:32 -08:00
Alex Crichton
4da4970767 bootstrap: Add build scripts for crates
This commits adds build scripts to the necessary Rust crates for all the native
dependencies. This is currently a duplication of the support found in mk/rt.mk
and is my best effort at representing the logic twice, but there may be some
unfortunate-and-inevitable divergence.

As a summary:

* alloc_jemalloc - build script to compile jemallocal
* flate - build script to compile miniz.c
* rustc_llvm - build script to run llvm-config and learn about how to link it.
  Note that this crucially (and will not ever) compile LLVM as that would take
  far too long.
* rustdoc - build script to compile hoedown
* std - script to determine lots of libraries/linkages as well as compile
  libbacktrace
2016-02-11 11:12:32 -08:00
Alex Crichton
2581b14147 bootstrap: Add a bunch of Cargo.toml files
These describe the structure of all our crate dependencies.
2016-02-11 11:12:32 -08:00
bors
7342dd8727 Auto merge of #31083 - SimonSapin:set_port, r=alexcrichton
As demonstrated in the `resolve_socket_addr` change, this is less awkward than re-creating a new address from the other parts.

If this is to be accepted, pleas open a tracking issue (I can’t set the appropriate tags) and I’ll update the PR with the tracking issue number.
2016-02-11 18:44:52 +00:00
Alex Crichton
7cbd2457ad configure: Remove default NDK path value
This likely isn't always valid, and subverts auto-detection.
2016-02-11 10:42:45 -08:00
Alex Crichton
0a54e4dd87 bootstrap: Read configuration from config.mk
During the transition period where we're still using ./configure and makefiles,
read some extra configuration from `config.mk` if it's present. This means that
the bootstrap build should be configured the same as the original ./configure
invocation.

Eventually this will all be removed in favor of only storing information in
`config.toml` (e.g. the configure script will generate config.toml), but for now
this should suffice.
2016-02-11 10:42:43 -08:00
Alex Crichton
046e6874c4 Add a Cargo-based build system
This commit is the start of a series of commits which start to replace the
makefiles with a Cargo-based build system. The aim is not to remove the
makefiles entirely just yet but rather just replace the portions that invoke the
compiler to do the bootstrap. This commit specifically adds enough support to
perform the bootstrap (and all the cross compilation within) along with
generating documentation.

More commits will follow up in this series to actually wire up the makefiles to
call this build system, so stay tuned!
2016-02-11 10:42:28 -08:00
arcnmx
0ff055ad66 Pass through diagnostic handler instead 2016-02-11 12:45:52 -05:00
arcnmx
a141c52816 Use find_export_name_attr instead of string literal 2016-02-11 12:45:52 -05:00
arcnmx
32328ac6ff Remove link_section and linkage as extern indicators 2016-02-11 12:45:52 -05:00
arcnmx
e6f0f7d52d Only retain external static symbols across LTO 2016-02-11 12:45:52 -05:00
bors
aa1dc0975a Auto merge of #31532 - tomaka:fix-emscripten, r=brson
Before this PR:

> test result: FAILED. 2039 passed; 327 failed; 2 ignored; 0 measured

After:

> test result: FAILED. 2232 passed; 134 failed; 2 ignored; 0 measured

r? @brson
2016-02-11 16:49:20 +00:00
bors
a91ff1c9d1 Auto merge of #31527 - danlrobertson:i15735, r=alexcrichton
After some digging I couldn't find a test for #15735, so I added a simplified version to `run-pass` and tested it against 80a3f45 to ensure it fails.
2016-02-11 14:51:47 +00:00
Simon Sapin
3de820ee79 Add SocketAddrV6::set_flowinfo and set_scope_id 2016-02-11 15:36:10 +01:00
Simon Sapin
5a249abba7 Add SocketAddr{,V4,V6}::set_ip. 2016-02-11 15:29:18 +01:00
Simon Sapin
cd01366279 Add SocketAddr{,V4,V6}::set_port.
As demonstrated in the `resolve_socket_addr` change, this is less awkward
than re-creating a new address from the other parts.
2016-02-11 14:24:48 +01:00
bors
7732c0aa9e Auto merge of #31487 - oli-obk:breaking_batch/ast/unop, r=Manishearth
r? @Manishearth

I just noticed they can't be rolled up (often modifying the same line(s) in imports). So once I reach the critical amount for them to be merged I'll create a PR that merges all of them.
2016-02-11 12:52:42 +00:00
Oliver Schneider
bafea3bf78 fixup: meta item kind 2016-02-11 12:35:47 +01:00
Oliver 'ker' Schneider
2b816b0d6a [breaking-change] don't glob export ast::PathListItem_ variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
8b3856b1bc [breaking-change] don't glob export ast::StrStyle variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
d844bfb196 [breaking-change] don't glob export ast::Visibility variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
dfe35da6b8 [breaking-change] don't glob export ast::TraitItemKind variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
73fa9b2da2 [breaking-change] don't glob export ast::Mutablity variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
14e09ad468 [breaking-change] don't glob export ast::MetaItem_ 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
e797e1961d [breaking-change] don't glob export ast::MacStmtStyle 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
798974cae5 [breaking-change] don't glob export ast::KleeneOp variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
019614f03d [breaking-change] don't glob export ast::Item_ variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
0d6ddd1903 [breaking-change] don't glob export ast::ForeignItem_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
8290c950a8 [breaking-change] don't pub export ast::Stmt_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
498a2e416e [breaking-change] don't pub export ast::IntLitType variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
69072c4f5d [breaking-change] don't pub export ast::Lit_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
05d4cefd63 [breaking-change] don't pub export ast::Ty_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
ec61e632c0 [breaking-change] remove unused enum ast::PrimTy 2016-02-11 12:34:48 +01:00
Oliver Schneider
08e35d4dec remove unit test that can't be tested anymore 2016-02-11 12:34:48 +01:00
Oliver Schneider
bfa66bb389 [breaking-change] remove the sign from integer literals in the ast 2016-02-11 12:34:48 +01:00
Oliver Schneider
625e78b700 [breaking-change] don't glob export ast::{UintTy, IntTy} variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
ccf48bcd40 [breaking-change] don't glob export ast::FloatTy variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
80bf9ae18a [breaking-change] don't glob export ast::Expr_ variants 2016-02-11 12:34:48 +01:00