about summary refs log tree commit diff
path: root/mk/target.mk
AgeCommit message (Collapse)AuthorLines
2017-02-06Delete the `mk` folderAlex Crichton-209/+0
This commit deletes the old build system located in the `mk` folder as it's now been obsoleted for two cycles and is replaced by rustbuild.
2016-10-19Allow bootstrapping without a key. Fixes #36548Brian Anderson-21/+0
This will make it easier for packagers to bootstrap rustc when they happen to have a bootstrap compiler with a slightly different version number. It's not ok for anything other than the build system to set this environment variable.
2016-05-23mk: Fix bootstrapping cross-hosts on betaAlex Crichton-9/+20
The beta builds are currently failing, unfortunately, due to what is presumably some odd behavior with our makefiles. The wrong bootstrap key is being used to generate the stage1 cross-compiled libraries, which fails the build. Interestingly enough if the targets are directly specified as part of the build then it works just fine! Just a bare `make` fails... Instead of trying to understand what's happening in the makefiles instead just tweak how we configure the bootstrap key in a way that's more likely to work.
2016-04-19mk: Bootstrap from stable instead of snapshotsAlex Crichton-2/+16
This commit removes all infrastructure from the repository for our so-called snapshots to instead bootstrap the compiler from stable releases. Bootstrapping from a previously stable release is a long-desired feature of distros because they're not fans of downloading binary stage0 blobs from us. Additionally, this makes our own CI easier as we can decommission all of the snapshot builders and start having a regular cadence to when we update the stage0 compiler. A new `src/etc/get-stage0.py` script was added which shares some code with `src/bootstrap/bootstrap.py` to read a new file, `src/stage0.txt`, which lists the current stage0 compiler as well as cargo that we bootstrap from. This script will download the relevant `rustc` package an unpack it into `$target/stage0` as we do today. One problem of bootstrapping from stable releases is that we're not able to compile unstable code (e.g. all the `#![feature]` directives in libcore/libstd). To overcome this we employ two strategies: * The bootstrap key of the previous compiler is hardcoded into `src/stage0.txt` (enabled as a result of #32731) and exported by the build system. This enables nightly features in the compiler we download. * The standard library and compiler are pinned to a specific stage0, which doesn't change, so we're guaranteed that we'll continue compiling as we start from a known fixed source. The process for making a release will also need to be tweaked now to continue to cadence of bootstrapping from the previous release. This process looks like: 1. Merge `beta` to `stable` 2. Produce a new stable compiler. 3. Change `master` to bootstrap from this new stable compiler. 4. Merge `master` to `beta` 5. Produce a new beta compiler 6. Change `master` to bootstrap from this new beta compiler. Step 3 above should involve very few changes as `master` was previously bootstrapping from `beta` which is the same as `stable` at that point in time. Step 6, however, is where we benefit from removing lots of `#[cfg(stage0)]` and get to use new features. This also shouldn't slow the release too much as steps 1-5 requires little work other than waiting and step 6 just needs to happen at some point during a release cycle, it's not time sensitive. Closes #29555 Closes #29557
2016-03-28mk: Add `-C metadata` for compiling crates we shipAlex Crichton-0/+1
This should re-enable all external builds of crates with the same name. Right now Cargo doesn't pass `-C metadata` for the top-level library being compiled, so if that library is called `libc`, for example, then it won't be able to link to the standard library which *also* has a `libc` library compiled without `-C metadata`. This can result in naming conflicts which need to be resolved. By passing `-C metadata` to the in-tree crates we ship it should add some extra salt to all symbol names to ensure that they don't collide.
2016-02-25mk: Move disable-jemalloc logic into makefilesAlex Crichton-2/+2
The `--disable-jemalloc` configure option has a failure mode where it will create a distribution that is not compatible with other compilers. For example the nightly for Linux will assume that it will link to jemalloc by default as an allocator for executable crates. If, however, a standard library is used which was built via `./configure --disable-jemalloc` then this will fail because the jemalloc crate wasn't built. While this seems somewhat reasonable as a niche situation, the same mechanism is used for disabling jemalloc for platforms that just don't support it. For example if the rumprun target is compiled then the sibiling Linux target *also* doesn't have jemalloc. This is currently a problem for our cross-build nightlies which build many targets. If rumprun is also built, it will disable jemalloc for all targets, which isn't desired. This commit moves the platform-specific disabling of jemalloc as hardcoded logic into the makefiles that is scoped per-platform. This way when configuring multiple targets **without the `--disable-jemalloc` option specified** all targets will get jemalloc as they should.
2016-02-01Revert "mk: fix some undefined variable warnings"Alex Crichton-2/+2
This reverts commit d03712977d7c913044f2b863269c4491d7fa7c36.
2016-02-01mk: fix some undefined variable warningsTamir Duberstein-2/+2
Some of this is scary stuff. Probably time to lint against this. Found with `make --warn-undefined-variables`.
2016-01-24mk: Move from `-D warnings` to `#![deny(warnings)]`Alex Crichton-8/+0
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2015-12-20remove specific code for OpenBSD that define STDCPP_LIBDIR_RUSTFLAGSSébastien Marie-2/+0
it isn't the good way to process, as it makes conflicts when building rustc while another version of rustc in installed system-wide.
2015-12-13Better support for `--llvm-root`.Richard Diamond-0/+1
This handles cases when the LLVM used isn't configured will the 'usual' targets. Also, cases where LLVM is shared are also handled (ie with `LD_LIBRARY_PATH` etc).
2015-12-08Remove STARTUP_OBJS from Makefile deps for non win-gnu targets.Felix S. Klock II-0/+2
The `rsbegin.o` and `rsend.o` build products should not be generated on non WinGnu platforms. This is another path to resolving #30063 for non win-gnu targets. (And it won't require a snapshot, unlike PR #30208.)
2015-11-17Auto merge of #29794 - semarie:openbsd-stdcpp-path, r=alexcrichtonbors-1/+4
under openbsd, the library path of libstdc++ need to be explicit (due to the fact the default linker `cc` is gcc-4.2, and not gcc-4.9). but when a recent LLVM is installed, rustc compilation pikes the bad LLVM version (which live in /usr/local/lib, which is same directory of libestdc++.so for gcc-4.9). this patch move the libstdc++ path from RUST_FLAGS_<target> to special variable, and use it *after* LLVM_LIBDIR_RUSTFLAGS_<target> in arguments. r? @alexcrichton
2015-11-13Clean up some "suspicious" whitespace in target.mkWilliam Throwe-2/+2
Emacs warns that makefile lines that start with spaces followed by tabs are "suspicious". These were harmless since they were continuation lines, but getting rid of the warning is nice and this version looks better.
2015-11-11pass stdc++ library path after LVVM library pathSébastien Marie-1/+4
under openbsd, the library path of libstdc++ need to be explicit (due to the fact the default linker `cc` is gcc-4.2, and not gcc-4.9). but when a recent LLVM is installed, rustc compilation pikes the bad LLVM version (which live in /usr/local/lib, which is same directory of libestdc++.so for gcc-4.9). this patch move the libstdc++ path from RUST_FLAGS_<target> to special variable, and use it *after* LLVM_LIBDIR_RUSTFLAGS_<target> in arguments.
2015-11-07Make sure rsbegin.o and rsend.o get packaged with target lib artifacts.Vadim Chugunov-42/+2
Also, unified libc startup objects finding logic with that of the `-musl` target, since conceptually they were doing the same thing.
2015-10-21Use `gcc -print-file-name` for finding C runtime startup objects:Vadim Chugunov-14/+27
reverted changes in configure, refactored target.mk
2015-10-19Don't use GCC's startup objects (crtbegin.o/crtend.o); build and use our own ↵Vadim Chugunov-0/+59
(for now on for -windows-gnu target only). Since it isn't possible to disable linkage of just GCC startup objects, we now need logic for finding libc installation directory and copying the required startup files (e.g. crt2.o) to rustlib directory. Bonus change: use the `-nodefaultlibs` flag on Windows, thus paving the way to direct linker invocation.
2015-09-06plumbing to automatically run MIR for crates where it works;Niko Matsakis-0/+1
this serves as a poor man's unit test infrastructure until MIR is more built up
2015-08-19rustc_back: add configure options for default linker and arMarc-Antoine Perennou-0/+4
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2015-08-11Register new snapshotsAlex Crichton-92/+1
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-11Auto merge of #27518 - alexcrichton:msvc-builtin-llvm-ar, r=huonwbors-0/+6
This means that we no longer need to ship the `llvm-ar.exe` binary in the MSVC distribution, and after a snapshot we can remove a good bit of logic from the makefiles!
2015-08-10trans: Stop informing LLVM about dllexportAlex Crichton-2/+2
Rust's current compilation model makes it impossible on Windows to generate one object file with a complete and final set of dllexport annotations. This is because when an object is generated the compiler doesn't actually know if it will later be included in a dynamic library or not. The compiler works around this today by flagging *everything* as dllexport, but this has the drawback of exposing too much. Thankfully there are alternate methods of specifying the exported surface area of a dll on Windows, one of which is passing a `*.def` file to the linker which lists all public symbols of the dynamic library. This commit removes all locations that add `dllexport` to LLVM variables and instead dynamically generates a `*.def` file which is passed to the linker. This file will include all the public symbols of the current object file as well as all upstream libraries, and the crucial aspect is that it's only used when generating a dynamic library. When generating an executable this file isn't generated, so all the symbols aren't exported from an executable. To ensure that statically included native libraries are reexported correctly, the previously added support for the `#[linked_from]` attribute is used to determine the set of FFI symbols that are exported from a dynamic library, and this is required to get the compiler to link correctly.
2015-08-10trans: Specify `archive_format` for MSVCAlex Crichton-0/+6
This means that we no longer need to ship the `llvm-ar.exe` binary in the MSVC distribution, and after a snapshot we can remove a good bit of logic from the makefiles!
2015-08-10Remove morestack supportAlex Crichton-2/+1
This commit removes all morestack support from the compiler which entails: * Segmented stacks are no longer emitted in codegen. * We no longer build or distribute libmorestack.a * The `stack_exhausted` lang item is no longer required The only current use of the segmented stack support in LLVM is to detect stack overflow. This is no longer really required, however, because we already have guard pages for all threads and registered signal handlers watching for a segfault on those pages (to print out a stack overflow message). Additionally, major platforms (aka Windows) already don't use morestack. This means that Rust is by default less likely to catch stack overflows because if a function takes up more than one page of stack space it won't hit the guard page. This is what the purpose of morestack was (to catch this case), but it's better served with stack probes which have more cross platform support and no runtime support necessary. Until LLVM supports this for all platform it looks like morestack isn't really buying us much. cc #16012 (still need stack probes) Closes #26458 (a drive-by fix to help diagnostics on stack overflow)
2015-07-01msvc: Lookup linker in windows registryAlex Crichton-6/+4
This commit alters the compiler to no longer "just run link.exe" but instead probe the system's registry to find where the linker is located. The default library search path (normally found through LIB) is also found through the registry. This also brings us in line with the default behavior of Clang, and much of the logic of where to look for information is copied over from Clang as well. Finally, this commit removes the makefile logic for updating the environment variables for the compiler, except for stage0 where it's still necessary. The motivation for this change is rooted in two positions: * Not having to set up these environment variables is much less hassle both for the bootstrap and for running the compiler itself. This means that the compiler can be run outside of VS shells and be run inside of cmd.exe or a MSYS shell. * When dealing with cross compilation, there's not actually a set of environment variables that can be set for the compiler. This means, for example, if a Cargo compilation is targeting 32-bit from 64-bit you can't actually set up one set of environment variables. Having the compiler deal with the logic instead is generally much more convenient!
2015-06-27mk: Add support for i686-pc-windows-msvcAlex Crichton-0/+37
This commit modifies the configure script and our makefiles to support building 32-bit MSVC targets. The MSVC toolchain is now parameterized over whether it can produce a 32-bit or 64-bit binary. The configure script was updated to export more variables at configure time, and the makefiles were rejiggered to selectively reexport the relevant environment variables for the applicable targets they're going to run for.
2015-05-27mk: Fix MSVC bootstrapping itselfAlex Crichton-0/+39
Now that MSVC support has landed in the most recent nightlies we can now have MSVC bootstrap itself without going through a GNU compiler first. Unfortunately, however, the bootstrap currently fails due to the compiler not being able to find the llvm-ar.exe tool during the stage0 libcore compile. The compiler cannot find this tool because it's looking inside a directory that does not exist: $SYSROOT/rustlib/x86_64-pc-windows-gnu/bin The `gnu` on this triple is because the bootstrap compiler's host architecture is GNU. The build system, however, only arranges for the llvm-ar.exe tool to be available in this location: $SYSROOT/rustlib/x86_64-pc-windows-msvc/bin To resolve this discrepancy, the build system has been modified to understand triples that are bootstrapped from another triple, and in this case copy the native tools to the right location.
2015-05-19mk: Generate a .def file for rustc_llvm on MSVCAlex Crichton-1/+3
Windows needs explicit exports of functions from DLLs but LLVM does not mention any of its symbols as being export-able from a DLL. The compiler, however, relies on being able to use LLVM symbols across DLL boundaries so we need to force many of LLVM's symbols to be exported from `rustc_llvm.dll`. This commit adds support for generation of a `rustc_llvm.def` file which is passed along to the linker when generating `rustc_llvm.dll` which should keep all these symbols exportable and usable.
2015-05-19mk: Add the ability to depend on native LLVM toolsAlex Crichton-1/+8
The compiler will require that `llvm-ar.exe` be available for MSVC-targeting builds (more comments on this soon), so this commit adds support for targets to depend on LLVM tools. The `core` library for MSVC depends on `llvm-ar.exe` which will be copied into place for the target before the compiler starts to run. Note that these targets all depend on `llvm-config.exe` to ensure that they're built before they're attempted to be copied.
2015-05-19mk: Fix native LLVM deps for cross-host buildsAlex Crichton-1/+1
We use a script called `mklldeps.py` to run `llvm-config` to generate a list of LLVM libraries and native dependencies needed by LLVM, but all cross-compiled LLVM builds were using the *host triple's* `llvm-config` instead of the *target's* `llvm-config`. This commit alters this to require the right `llvmdeps.rs` to be generated which will run the correct `llvm-config`.
2015-04-27mk: Add support for musl-based buildsAlex Crichton-9/+4
This commit adds support to the makefiles, configuration script, and build system to understand MUSL. This is broken up into a few parts: * Any target of the form `*-musl` requires the `--musl-root` option to `./configure` which will indicate the root of the MUSL installation. It is also expected that there is a libunwind build inside of that installation built against that MUSL. * Objects from MUSL are copied into the build tree for Rust to be statically linked into the appropriate Rust library. * Objects for binary startup and shutdown are included in each Rust installation by default for MUSL. This requires MUSL to only be installed on the machine compiling rust. Only a linker will be necessary for compiling against MUSL on a target machine. Eventually a MUSL and/or libunwind build may be integrated by default into the build but for now they are just always assumed to exist externally.
2015-03-28Fix some typosVadim Petrochenkov-1/+1
2015-03-16Fix the Linux nightly build by adding a LLVM_CONFIG_<target-triple> dep.Ryan Prichard-0/+1
The RUST_TARGET_STAGE_N rule uses LLVM_LIBDIR_RUSTFLAGS_<target-triple>, which expands to -L "$(llvm-config --libdir)" when the target-triple is also a host-triple. Rather than expand to -L "" if llvm-config has not yet been built, add a dependency on the target llvm-config. When the target-triple is not a host-triple, the new LLVM_CONFIG_$(2) dependency should expand to nothing.
2015-03-13Avoid passing -L "" during cross-compilation.Ryan Prichard-1/+1
LLVM_LIBDIR_<triple> is only defined for host triples, not target triples. FWIW, the same is true for LLVM_STDCPP_RUSTFLAGS_<triple>, where we explicitly define it as empty when --enable-llvm-static-stdcpp is not specified, but it's still undefined for cross-compiled triples.
2015-03-12Avoid passing -L "" to rustc.Ryan Prichard-1/+1
Currently, target.mk passes -L "" when LLVM_STDCPP_LOCATION_$(2) is empty. This fixes #23287.
2015-03-03Make build timestamp files robust in face of concurrent source modification.Felix S. Klock II-1/+2
Strategy: If the end goal is to touch e.g. `stamp.std`, then we first touch `stamp.std.start_time` before doing anything else. Then when the receipe finishes, we touch `stamp.std` using the timestamp from `stamp.std.start_time` as the reference time, and remove `stamp.std.start_time`. Fix #6518.
2014-11-30mk: Use host llvm linkage paths, not target onesAlex Crichton-1/+1
We only build LLVM for the host architecture, not the target architecture, so this was just a minor typo in the parameters uses. Closes #19383
2014-11-25Don't use the same llvmdeps.rs for every host.Richard Diamond-3/+2
2014-11-20mk/target: fix typo so we depend on the correct directoryCody P Schafer-1/+1
Without this, if we we're using a non-standard host libdir, the target bindir would not exist (and rustc would fail to write to the non-existent directory).
2014-11-03rustc: Default to static linking dylibsAlex Crichton-4/+4
If a dylib is being produced, the compiler will now first check to see if it can be created entirely statically before falling back to dynamic dependencies. This behavior can be overridden with `-C prefer-dynamic`. Due to the alteration in behavior, this is a breaking change. Any previous users relying on dylibs implicitly maximizing dynamic dependencies should start passing `-C prefer-dynamic` to compilations. Closes #18499 [breaking-change]
2014-07-23mk: Add space before line continuation backslashBirunthan Mohanathas-4/+4
2014-07-23mk: Remove extra whitespace before line continuation backslashesBirunthan Mohanathas-35/+35
2014-07-14Move llvm bindings to their own crateBrian Anderson-1/+1
2014-07-09Register new snapshotsAlex Crichton-10/+1
Closes #15544
2014-07-06mk: Fix bootstrapping the nightly buildsAlex Crichton-8/+10
The stage0 compiler for a non-CFG_BUILD architecture needs to have the new `-C extra-filename` argument passed.
2014-07-05rustc: Stop putting hashes in filenames by defaultAlex Crichton-1/+10
The compiler will no longer insert a hash or version into a filename by default. Instead, all output is simply based off the crate name being compiled. For example, a crate name of `foo` would produce the following outputs: * bin => foo * rlib => libfoo.rlib * dylib => libfoo.{so,dylib} or foo.dll * staticlib => libfoo.a The old behavior has been moved behind a new codegen flag, `-C extra-filename=<hash>`. For example, with the "extra filename" of `bar` and a crate name of `foo`, the following outputs would be generated: * bin => foo (same old behavior) * rlib => libfoobar.rlib * dylib => libfoobar.{so,dylib} or foobar.dll * staticlib => libfoobar.a The makefiles have been altered to pass a hash by default to invocations of `rustc` so all installed rust libraries will have a hash in their filename. This is done because the standard libraries are intended to be installed into privileged directories such as /usr/local. Additionally, it involves very few build system changes! RFC: 0035-remove-crate-id [breaking-change]
2014-06-16alloc: Allow disabling jemallocAlex Crichton-0/+1
2014-05-21mk: Replace 'oxidize' with 'rustc'. Closes #13781Brian Anderson-2/+2
2014-04-17llvm: Add an option to statically link libstdc++Alex Crichton-0/+1
The goal of the snapshot bots is to produce binaries which can run in as many locations as possible. Currently we build on Centos 6 for this reason, but with LLVM's update to C++11, this reduces the number of platforms that we could possibly run on. This adds a --enable-llvm-static-stdcpp option to the ./configure script for Rust which will enable building a librustc with a static dependence on libstdc++. This normally isn't necessary, but this option can be used on the snapshot builders in order to continue to make binaries which should be able to run in as many locations as possible.