2014-01-25 04:27:22 +01:00
|
|
|
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Rust's standard distribution of crates and tools
|
|
|
|
#
|
|
|
|
# The crates outlined below are the standard distribution of libraries provided
|
|
|
|
# in a rust installation. These rules are meant to abstract over the
|
|
|
|
# dependencies (both native and rust) of crates and basically generate all the
|
|
|
|
# necessary makefile rules necessary to build everything.
|
|
|
|
#
|
|
|
|
# Here's an explanation of the variables below
|
|
|
|
#
|
|
|
|
# TARGET_CRATES
|
|
|
|
# This list of crates will be built for all targets, including
|
|
|
|
# cross-compiled targets
|
|
|
|
#
|
|
|
|
# HOST_CRATES
|
|
|
|
# This list of crates will be compiled for only host targets. Note that
|
|
|
|
# this set is explicitly *not* a subset of TARGET_CRATES, but rather it is
|
|
|
|
# a disjoint set. Nothing in the TARGET_CRATES set can depend on crates in
|
|
|
|
# the HOST_CRATES set, but the HOST_CRATES set can depend on target
|
|
|
|
# crates.
|
|
|
|
#
|
|
|
|
# TOOLS
|
|
|
|
# A list of all tools which will be built as part of the compilation
|
|
|
|
# process. It is currently assumed that most tools are built through
|
|
|
|
# src/driver/driver.rs with a particular configuration (there's a
|
|
|
|
# corresponding library providing the implementation)
|
|
|
|
#
|
|
|
|
# DEPS_<crate>
|
|
|
|
# These lists are the dependencies of the <crate> that is to be built.
|
2014-11-14 23:38:41 +01:00
|
|
|
# Rust dependencies are listed bare (i.e. std) and native
|
2014-05-03 02:56:35 +02:00
|
|
|
# dependencies have a "native:" prefix (i.e. native:hoedown). All deps
|
2014-01-25 04:27:22 +01:00
|
|
|
# will be built before the crate itself is built.
|
|
|
|
#
|
|
|
|
# TOOL_DEPS_<tool>/TOOL_SOURCE_<tool>
|
|
|
|
# Similar to the DEPS variable, this is the library crate dependencies
|
|
|
|
# list for tool as well as the source file for the specified tool
|
|
|
|
#
|
|
|
|
# You shouldn't need to modify much other than these variables. Crates are
|
|
|
|
# automatically generated for all stage/host/target combinations.
|
|
|
|
################################################################################
|
|
|
|
|
2016-03-02 07:00:18 +01:00
|
|
|
TARGET_CRATES := libc std term \
|
|
|
|
getopts collections test rand \
|
2016-07-25 04:42:11 +02:00
|
|
|
compiler_builtins core alloc \
|
2016-11-29 20:38:08 +01:00
|
|
|
std_unicode rustc_bitflags \
|
rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.
[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md
Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.
With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.
Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-04-09 01:18:40 +02:00
|
|
|
alloc_system alloc_jemalloc \
|
2016-11-28 00:57:25 +01:00
|
|
|
panic_abort panic_unwind unwind rustc_i128
|
2015-08-19 00:01:44 +02:00
|
|
|
RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
|
2015-04-07 12:10:53 +02:00
|
|
|
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
|
2016-06-22 00:08:13 +02:00
|
|
|
rustc_data_structures rustc_platform_intrinsics rustc_errors \
|
2016-03-29 12:51:46 +02:00
|
|
|
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \
|
2016-11-28 00:57:25 +01:00
|
|
|
rustc_const_eval rustc_const_math rustc_incremental proc_macro
|
2016-10-21 09:55:39 +02:00
|
|
|
HOST_CRATES := syntax syntax_ext proc_macro_tokens proc_macro_plugin syntax_pos $(RUSTC_CRATES) \
|
|
|
|
rustdoc fmt_macros flate arena graphviz log serialize
|
2016-02-15 07:26:37 +01:00
|
|
|
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
|
2014-01-25 04:27:22 +01:00
|
|
|
|
2014-05-01 05:05:14 +02:00
|
|
|
DEPS_core :=
|
2016-11-16 18:19:02 +01:00
|
|
|
DEPS_compiler_builtins := core native:compiler-rt
|
2015-10-06 21:26:22 +02:00
|
|
|
DEPS_alloc := core libc alloc_system
|
|
|
|
DEPS_alloc_system := core libc
|
2016-02-08 19:57:41 +01:00
|
|
|
DEPS_alloc_jemalloc := core libc native:jemalloc
|
2016-11-29 20:38:08 +01:00
|
|
|
DEPS_collections := core alloc std_unicode
|
2014-09-23 02:12:15 +02:00
|
|
|
DEPS_libc := core
|
2015-10-06 21:26:22 +02:00
|
|
|
DEPS_rand := core
|
|
|
|
DEPS_rustc_bitflags := core
|
2016-11-29 20:38:08 +01:00
|
|
|
DEPS_std_unicode := core
|
rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.
[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md
Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.
With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.
Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-04-09 01:18:40 +02:00
|
|
|
DEPS_panic_abort := libc alloc
|
|
|
|
DEPS_panic_unwind := libc alloc unwind
|
|
|
|
DEPS_unwind := libc
|
|
|
|
|
2016-07-25 04:42:11 +02:00
|
|
|
RUSTFLAGS_compiler_builtins := -lstatic=compiler-rt
|
2016-11-16 18:19:02 +01:00
|
|
|
RUSTFLAGS_panic_abort := -C panic=abort
|
2015-10-06 21:26:22 +02:00
|
|
|
|
2016-11-29 20:38:08 +01:00
|
|
|
DEPS_std := core libc rand alloc collections compiler_builtins std_unicode \
|
2015-12-02 19:31:29 +01:00
|
|
|
native:backtrace \
|
rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.
[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md
Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.
With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.
Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-04-09 01:18:40 +02:00
|
|
|
alloc_system panic_abort panic_unwind unwind
|
2015-10-06 21:26:22 +02:00
|
|
|
DEPS_arena := std
|
|
|
|
DEPS_glob := std
|
|
|
|
DEPS_flate := std native:miniz
|
|
|
|
DEPS_fmt_macros = std
|
|
|
|
DEPS_getopts := std
|
2014-04-17 21:00:08 +02:00
|
|
|
DEPS_graphviz := std
|
2015-10-06 21:26:22 +02:00
|
|
|
DEPS_log := std
|
|
|
|
DEPS_num := std
|
2016-08-24 15:48:35 +02:00
|
|
|
DEPS_serialize := std log rustc_i128
|
2016-03-02 07:00:18 +01:00
|
|
|
DEPS_term := std
|
|
|
|
DEPS_test := std getopts term native:rust_test_helpers
|
2016-08-24 15:48:35 +02:00
|
|
|
DEPS_rustc_i128 = std
|
2015-10-06 21:26:22 +02:00
|
|
|
|
2016-08-24 15:48:35 +02:00
|
|
|
DEPS_syntax := std term serialize log arena libc rustc_bitflags std_unicode rustc_errors \
|
|
|
|
syntax_pos rustc_data_structures rustc_i128
|
2016-10-03 18:49:39 +02:00
|
|
|
DEPS_syntax_ext := syntax syntax_pos rustc_errors fmt_macros proc_macro
|
2016-08-24 15:48:35 +02:00
|
|
|
DEPS_proc_macro := syntax syntax_pos rustc_plugin log
|
2016-06-22 00:08:13 +02:00
|
|
|
DEPS_syntax_pos := serialize
|
2016-10-21 09:55:39 +02:00
|
|
|
DEPS_proc_macro_tokens := syntax syntax_pos log
|
|
|
|
DEPS_proc_macro_plugin := syntax syntax_pos rustc_plugin log proc_macro_tokens
|
2015-10-06 21:26:22 +02:00
|
|
|
|
2016-08-24 15:48:35 +02:00
|
|
|
DEPS_rustc_const_math := std syntax log serialize rustc_i128
|
2016-03-29 07:50:44 +02:00
|
|
|
DEPS_rustc_const_eval := rustc_const_math rustc syntax log serialize \
|
2016-08-24 15:48:35 +02:00
|
|
|
rustc_back graphviz syntax_pos rustc_i128
|
2015-12-16 18:44:15 +01:00
|
|
|
|
2016-09-01 15:55:33 +02:00
|
|
|
DEPS_rustc := syntax fmt_macros flate arena serialize getopts \
|
2016-03-30 12:11:58 +02:00
|
|
|
log graphviz rustc_llvm rustc_back rustc_data_structures\
|
2016-08-24 15:48:35 +02:00
|
|
|
rustc_const_math syntax_pos rustc_errors rustc_i128
|
2016-03-29 07:50:44 +02:00
|
|
|
DEPS_rustc_back := std syntax flate log libc
|
2016-06-22 00:08:13 +02:00
|
|
|
DEPS_rustc_borrowck := rustc log graphviz syntax syntax_pos rustc_errors rustc_mir
|
2016-08-13 00:22:02 +02:00
|
|
|
DEPS_rustc_data_structures := std log serialize libc
|
2014-12-05 20:17:35 +01:00
|
|
|
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
|
2015-08-19 00:01:44 +02:00
|
|
|
rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
|
2016-08-04 21:20:01 +02:00
|
|
|
rustc_trans rustc_privacy rustc_lint rustc_plugin \
|
2016-10-03 18:49:39 +02:00
|
|
|
rustc_metadata syntax_ext proc_macro_plugin \
|
2016-08-04 21:20:01 +02:00
|
|
|
rustc_passes rustc_save_analysis rustc_const_eval \
|
2016-10-29 03:26:01 +02:00
|
|
|
rustc_incremental syntax_pos rustc_errors proc_macro rustc_data_structures
|
2016-06-22 00:08:13 +02:00
|
|
|
DEPS_rustc_errors := log libc serialize syntax_pos
|
2016-08-24 15:48:35 +02:00
|
|
|
DEPS_rustc_lint := rustc log syntax syntax_pos rustc_const_eval rustc_i128
|
2015-06-25 19:07:01 +02:00
|
|
|
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
|
2016-10-03 18:49:39 +02:00
|
|
|
DEPS_proc_macro := std syntax
|
2016-09-01 15:55:33 +02:00
|
|
|
DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rustc_const_math \
|
2016-08-24 15:48:35 +02:00
|
|
|
proc_macro syntax_ext rustc_i128
|
2016-06-22 00:08:13 +02:00
|
|
|
DEPS_rustc_passes := syntax syntax_pos rustc core rustc_const_eval rustc_errors
|
2016-08-24 15:48:35 +02:00
|
|
|
DEPS_rustc_mir := rustc syntax syntax_pos rustc_const_math rustc_const_eval rustc_bitflags \
|
|
|
|
rustc_i128
|
2016-06-22 00:08:13 +02:00
|
|
|
DEPS_rustc_resolve := arena rustc log syntax syntax_pos rustc_errors
|
2016-03-29 12:50:58 +02:00
|
|
|
DEPS_rustc_platform_intrinsics := std
|
2016-06-22 00:08:13 +02:00
|
|
|
DEPS_rustc_plugin := rustc rustc_metadata syntax syntax_pos rustc_errors
|
|
|
|
DEPS_rustc_privacy := rustc log syntax syntax_pos
|
2016-06-05 18:38:22 +02:00
|
|
|
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
|
2016-08-24 15:48:35 +02:00
|
|
|
log syntax serialize rustc_llvm rustc_platform_intrinsics rustc_i128 \
|
2016-06-22 00:08:13 +02:00
|
|
|
rustc_const_math rustc_const_eval rustc_incremental rustc_errors syntax_pos
|
2016-09-01 15:55:33 +02:00
|
|
|
DEPS_rustc_incremental := rustc syntax_pos serialize rustc_data_structures
|
2016-06-22 00:08:13 +02:00
|
|
|
DEPS_rustc_save_analysis := rustc log syntax syntax_pos serialize
|
|
|
|
DEPS_rustc_typeck := rustc syntax syntax_pos rustc_platform_intrinsics rustc_const_math \
|
2016-11-16 17:21:49 +01:00
|
|
|
rustc_const_eval rustc_errors rustc_data_structures
|
2015-10-06 21:26:22 +02:00
|
|
|
|
2016-08-13 00:22:02 +02:00
|
|
|
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts test \
|
|
|
|
rustc_lint rustc_const_eval syntax_pos rustc_data_structures
|
2014-01-25 04:27:22 +01:00
|
|
|
|
2016-04-16 03:23:50 +02:00
|
|
|
TOOL_DEPS_compiletest := test getopts log serialize
|
2014-11-14 22:55:57 +01:00
|
|
|
TOOL_DEPS_rustdoc := rustdoc
|
2014-11-27 15:57:47 +01:00
|
|
|
TOOL_DEPS_rustc := rustc_driver
|
2015-01-20 19:45:29 +01:00
|
|
|
TOOL_DEPS_rustbook := std rustdoc
|
2016-02-15 07:26:37 +01:00
|
|
|
TOOL_DEPS_error_index_generator := rustdoc syntax serialize
|
2016-04-05 20:34:23 +02:00
|
|
|
TOOL_SOURCE_compiletest := $(S)src/tools/compiletest/src/main.rs
|
2014-01-25 04:27:22 +01:00
|
|
|
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
|
|
|
|
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
|
2016-03-08 07:32:37 +01:00
|
|
|
TOOL_SOURCE_rustbook := $(S)src/tools/rustbook/main.rs
|
2016-03-08 22:42:32 +01:00
|
|
|
TOOL_SOURCE_error_index_generator := $(S)src/tools/error_index_generator/main.rs
|
2014-01-25 04:27:22 +01:00
|
|
|
|
2016-07-25 04:42:11 +02:00
|
|
|
ONLY_RLIB_compiler_builtins := 1
|
2014-05-01 05:05:14 +02:00
|
|
|
ONLY_RLIB_core := 1
|
2014-06-04 01:12:11 +02:00
|
|
|
ONLY_RLIB_libc := 1
|
2014-05-14 01:10:05 +02:00
|
|
|
ONLY_RLIB_alloc := 1
|
std: Recreate a `rand` module
This commit shuffles around some of the `rand` code, along with some
reorganization. The new state of the world is as follows:
* The librand crate now only depends on libcore. This interface is experimental.
* The standard library has a new module, `std::rand`. This interface will
eventually become stable.
Unfortunately, this entailed more of a breaking change than just shuffling some
names around. The following breaking changes were made to the rand library:
* Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which
will return an infinite stream of random values. Previous behavior can be
regained with `rng.gen_iter().take(n).collect()`
* Rng::gen_ascii_str() was removed. This has been replaced with
Rng::gen_ascii_chars() which will return an infinite stream of random ascii
characters. Similarly to gen_iter(), previous behavior can be emulated with
`rng.gen_ascii_chars().take(n).collect()`
* {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all
relied on being able to use an OSRng for seeding, but this is no longer
available in librand (where these types are defined). To retain the same
functionality, these types now implement the `Rand` trait so they can be
generated with a random seed from another random number generator. This allows
the stdlib to use an OSRng to create seeded instances of these RNGs.
* Rand implementations for `Box<T>` and `@T` were removed. These seemed to be
pretty rare in the codebase, and it allows for librand to not depend on
liballoc. Additionally, other pointer types like Rc<T> and Arc<T> were not
supported. If this is undesirable, librand can depend on liballoc and regain
these implementations.
* The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`,
but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice
structure now has a lifetime associated with it.
* The `sample` method on `Rng` has been moved to a top-level function in the
`rand` module due to its dependence on `Vec`.
cc #13851
[breaking-change]
2014-05-25 10:39:37 +02:00
|
|
|
ONLY_RLIB_rand := 1
|
std: Recreate a `collections` module
As with the previous commit with `librand`, this commit shuffles around some
`collections` code. The new state of the world is similar to that of librand:
* The libcollections crate now only depends on libcore and liballoc.
* The standard library has a new module, `std::collections`. All functionality
of libcollections is reexported through this module.
I would like to stress that this change is purely cosmetic. There are very few
alterations to these primitives.
There are a number of notable points about the new organization:
* std::{str, slice, string, vec} all moved to libcollections. There is no reason
that these primitives shouldn't be necessarily usable in a freestanding
context that has allocation. These are all reexported in their usual places in
the standard library.
* The `hashmap`, and transitively the `lru_cache`, modules no longer reside in
`libcollections`, but rather in libstd. The reason for this is because the
`HashMap::new` contructor requires access to the OSRng for initially seeding
the hash map. Beyond this requirement, there is no reason that the hashmap
could not move to libcollections.
I do, however, have a plan to move the hash map to the collections module. The
`HashMap::new` function could be altered to require that the `H` hasher
parameter ascribe to the `Default` trait, allowing the entire `hashmap` module
to live in libcollections. The key idea would be that the default hasher would
be different in libstd. Something along the lines of:
// src/libstd/collections/mod.rs
pub type HashMap<K, V, H = RandomizedSipHasher> =
core_collections::HashMap<K, V, H>;
This is not possible today because you cannot invoke static methods through
type aliases. If we modified the compiler, however, to allow invocation of
static methods through type aliases, then this type definition would
essentially be switching the default hasher from `SipHasher` in libcollections
to a libstd-defined `RandomizedSipHasher` type. This type's `Default`
implementation would randomly seed the `SipHasher` instance, and otherwise
perform the same as `SipHasher`.
This future state doesn't seem incredibly far off, but until that time comes,
the hashmap module will live in libstd to not compromise on functionality.
* In preparation for the hashmap moving to libcollections, the `hash` module has
moved from libstd to libcollections. A previously snapshotted commit enables a
distinct `Writer` trait to live in the `hash` module which `Hash`
implementations are now parameterized over.
Due to using a custom trait, the `SipHasher` implementation has lost its
specialized methods for writing integers. These can be re-added
backwards-compatibly in the future via default methods if necessary, but the
FNV hashing should satisfy much of the need for speedier hashing.
A list of breaking changes:
* HashMap::{get, get_mut} no longer fails with the key formatted into the error
message with `{:?}`, instead, a generic message is printed. With backtraces,
it should still be not-too-hard to track down errors.
* The HashMap, HashSet, and LruCache types are now available through
std::collections instead of the collections crate.
* Manual implementations of hash should be parameterized over `hash::Writer`
instead of just `Writer`.
[breaking-change]
2014-05-30 03:50:12 +02:00
|
|
|
ONLY_RLIB_collections := 1
|
2016-11-29 20:38:08 +01:00
|
|
|
ONLY_RLIB_std_unicode := 1
|
2016-08-24 15:48:35 +02:00
|
|
|
ONLY_RLIB_rustc_i128 := 1
|
2015-01-16 21:20:03 +01:00
|
|
|
ONLY_RLIB_rustc_bitflags := 1
|
2015-06-25 19:07:01 +02:00
|
|
|
ONLY_RLIB_alloc_system := 1
|
2016-02-08 19:57:41 +01:00
|
|
|
ONLY_RLIB_alloc_jemalloc := 1
|
rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.
[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md
Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.
With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.
Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-04-09 01:18:40 +02:00
|
|
|
ONLY_RLIB_panic_unwind := 1
|
|
|
|
ONLY_RLIB_panic_abort := 1
|
|
|
|
ONLY_RLIB_unwind := 1
|
2016-02-08 19:57:41 +01:00
|
|
|
|
|
|
|
TARGET_SPECIFIC_alloc_jemalloc := 1
|
2014-05-01 05:05:14 +02:00
|
|
|
|
2015-04-08 00:11:16 +02:00
|
|
|
# Documented-by-default crates
|
2016-11-29 20:38:08 +01:00
|
|
|
DOC_CRATES := std alloc collections core libc std_unicode
|
2015-04-08 00:11:16 +02:00
|
|
|
|
2016-02-02 08:27:04 +01:00
|
|
|
ifeq ($(CFG_DISABLE_JEMALLOC),)
|
2016-01-22 03:37:46 +01:00
|
|
|
RUSTFLAGS_rustc_back := --cfg 'feature="jemalloc"'
|
2015-06-25 19:07:01 +02:00
|
|
|
endif
|
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
################################################################################
|
|
|
|
# You should not need to edit below this line
|
|
|
|
################################################################################
|
|
|
|
|
2015-06-25 19:07:01 +02:00
|
|
|
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
|
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
# This macro creates some simple definitions for each crate being built, just
|
|
|
|
# some munging of all of the parameters above.
|
|
|
|
#
|
|
|
|
# $(1) is the crate to generate variables for
|
|
|
|
define RUST_CRATE
|
2015-06-12 19:40:07 +02:00
|
|
|
CRATEFILE_$(1) := $$(SREL)src/lib$(1)/lib.rs
|
2014-03-25 23:40:52 +01:00
|
|
|
RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
|
2014-01-25 04:27:22 +01:00
|
|
|
NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
|
|
|
|
|
2016-02-08 19:57:41 +01:00
|
|
|
# $(1) - crate
|
|
|
|
# $(2) - target
|
|
|
|
define RUST_CRATE_DEPS
|
|
|
|
RUST_DEPS_$(1)_T_$(2) := $$(filter-out native:%,$$(DEPS_$(1)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach target,$(CFG_TARGET),\
|
|
|
|
$(foreach crate,$(CRATES),$(eval $(call RUST_CRATE_DEPS,$(crate),$(target)))))
|
|
|
|
|
|
|
|
# $(1) - target
|
|
|
|
# $(2) - crate
|
|
|
|
define DEFINE_TARGET_CRATES
|
|
|
|
ifndef TARGET_SPECIFIC_$(2)
|
|
|
|
TARGET_CRATES_$(1) += $(2)
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach target,$(CFG_TARGET),\
|
|
|
|
$(foreach crate,$(TARGET_CRATES),\
|
|
|
|
$(eval $(call DEFINE_TARGET_CRATES,$(target),$(crate)))))
|
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
# Similar to the macro above for crates, this macro is for tools
|
|
|
|
#
|
|
|
|
# $(1) is the crate to generate variables for
|
|
|
|
define RUST_TOOL
|
2014-03-25 23:40:52 +01:00
|
|
|
TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
|
2014-01-25 04:27:22 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))
|
2015-05-28 08:24:27 +02:00
|
|
|
|
2015-11-03 01:23:22 +01:00
|
|
|
CRATEFILE_libc := $(SREL)src/liblibc/src/lib.rs
|
|
|
|
RUSTFLAGS_libc := --cfg stdbuild
|