Commit Graph

91 Commits

Author SHA1 Message Date
Stefan Lankes
d349e32fc7 Merge branch 'master' into rusty-hermit, resolve conflicts 2019-10-25 09:09:55 +02:00
Alex Crichton
060b6cbe74 Update hashbrown to 0.6.2
Pulls in rust-lang/hashbrown#119 which should be a good improvement for
compile times of hashmap-heavy crates.
2019-10-24 08:07:03 -07:00
Stefan Lankes
99b2e04a6e add aarch64 support for HermitCore 2019-10-21 19:39:38 +02:00
Stefan Lankes
b6801b7dcd
Merge branch 'master' into rusty-hermit 2019-10-20 10:48:58 +02:00
Stefan Lankes
5ebd4d9c27 move interface to the unikernel in the crate hermit-abi
=> simplifies the maintenance of the interface
2019-10-20 10:46:18 +02:00
Félix Saparelli
bdcc21cbc4 Implement (HashMap) Entry::insert as per #60142 2019-10-09 11:00:29 +13:00
Shotaro Yamada
0423c2a7a3 Remove unused dependencies 2019-09-23 15:25:00 +09:00
Ralf Jung
dac0a158eb rename the crate, not the feature 2019-09-14 12:12:32 +02:00
Ralf Jung
b60954757e std: always depend on backtrace, but only enable its features on demand 2019-09-14 10:23:51 +02:00
Mazdak Farrokhzad
611458ba06
Rollup merge of #63806 - mati865:rand, r=alexcrichton
Upgrade rand to 0.7

Also upgrades `getrandom` to avoid bug encountered by https://github.com/rust-lang/rust/pull/61393 which bumps libc to `0.2.62`.
2019-09-09 22:18:08 +02:00
Mazdak Farrokhzad
24172084e1
Rollup merge of #64152 - cramertj:update-backtrace, r=alexcrichton
Use backtrace formatting from the backtrace crate

r? @alexcrichton
2019-09-08 12:11:56 +02:00
Mateusz Mikuła
32101ad3b3 Upgrade rand to 0.7 2019-09-06 14:45:28 +02:00
Mazdak Farrokhzad
5b995397db
Rollup merge of #63676 - newpavlov:wasi, r=alexcrichton
Use wasi crate for Core API

Blocked by: CraneStation/rust-wasi#5

Blocks: rust-lang/libc#1461

cc @sunfishcode @alexcrichton
2019-09-06 09:36:36 +02:00
Taylor Cramer
290f5b2275 Use backtrace formatting from the backtrace crate 2019-09-04 16:18:12 -07:00
Artyom Pavlov
0662fcf4f9
make wasi a target-specific dependency 2019-09-03 14:37:53 +00:00
newpavlov
6374b8458f update to wasi v0.7 2019-08-29 20:13:15 +03:00
Alex Crichton
8fe65da935 std: Remove the wasm_syscall feature
This commit removes the `wasm_syscall` feature from the
wasm32-unknown-unknown build of the standard library. This feature was
originally intended to allow an opt-in way to interact with the
operating system in a posix-like way but it was never stabilized.
Nowadays with the advent of the `wasm32-wasi` target that should
entirely replace the intentions of the `wasm_syscall` feature.
2019-08-28 08:34:31 -07:00
newpavlov
926f36400f move cvt 2019-08-21 19:36:12 +03:00
Alex Crichton
1301b100ca std: Update backtrace crate dependency
This commit updates the `backtrace` crate from 0.3.34 to 0.3.35. The
[included set of changes][changes] for this update mostly includes some
gimli-related improvements (not relevant for the standard library) but
critically includes a fix for rust-lang/backtrace-rs#230. The standard
library will not aqcuire a session-local lock whenever a backtrace is
generated on Windows to allow external synchronization with the
`backtrace` crate itself, allowing `backtrace` to be safely used while
other threads may be panicking.

[changes]: https://github.com/rust-lang/backtrace-rs/compare/0.3.34...0.3.35
2019-08-19 06:13:18 -07:00
Simon Sapin
a92c29b238 Update hashbrown to 0.5.0 2019-08-16 18:08:35 +02:00
Alex Crichton
3d2b6e79db Attempt to fix backtrace tests on i686-msvc
Some fixes for i686-msvc and Windows have landed on the `backtrace`
crate but hadn't made their way here yet. Let's update that and see if
it passes CI.
2019-07-31 10:59:32 -07:00
Alex Crichton
dc50a633f3 std: Use native #[thread_local] TLS on wasm
This commit moves `thread_local!` on WebAssembly targets to using the
`#[thread_local]` attribute in LLVM. This was recently implemented
upstream and is [in the process of being documented][dox]. This change
only takes affect if modules are compiled with `+atomics` which is
currently unstable and a pretty esoteric method of compiling wasm
artifacts.

This "new power" of the wasm toolchain means that the old
`wasm-bindgen-threads` feature of the standard library can be removed
since it should now be possible to create a fully functioning threaded
wasm module without intrusively dealing with libstd symbols or
intrinsics. Yay!

[dox]: https://github.com/WebAssembly/tool-conventions/pull/116
2019-07-25 11:17:07 -07:00
gnzlbg
77c14a5c5f Update the stdarch submodule 2019-07-15 14:05:28 +02:00
Ralf Jung
e5f840ecb5 make sure we use cfg-if as a std dependency 2019-06-14 11:01:28 +02:00
Alex Crichton
8eb7f36a3b std: Remove internal definitions of cfg_if! macro
This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the `cfg-if` crate on crates.io, allowing us to use it
from there!
2019-06-10 10:58:44 -07:00
Mazdak Farrokhzad
06a1df4954
Rollup merge of #61603 - Goirad:increase-sgx-heapsize, r=alexcrichton
Increases heap size available during testing for SGX

PR [61540](https://github.com/rust-lang/rust/pull/61540) causes at least one test to fail when run for the SGX platform due to lack of memory. This PR increases the heapsize available during tests, which is a good thing regardless of the status of that PR.
2019-06-07 16:48:08 +02:00
Dario Gonzalez
9a49841961 increase max heapsize available during sgx tests 2019-06-06 14:13:16 -07:00
varkor
a31848350b Update compiler_builtins 2019-06-06 21:27:07 +01:00
Alex Crichton
fa1b6add09 std: Update dependency on backtrace
Discovered in #61416 an accidental regression in libstd's backtrace
behavior is that it previously attempted to consult libbacktrace and
would then fall back to `dladdr` if libbacktrace didn't report anything.
The `backtrace` crate, however, did not do this, so that's now been
fixed!

Changes: https://github.com/rust-lang/backtrace-rs/compare/0.3.25...0.3.27

Closes #61416
2019-06-04 18:45:39 -07:00
Amanieu d'Antras
a386a9edcc Bump hashbrown to 0.4.0
Fixes #61357
2019-06-01 10:29:23 +01:00
Alex Crichton
d1040fe329 std: Depend on backtrace crate from crates.io
This commit removes all in-tree support for generating backtraces in
favor of depending on the `backtrace` crate on crates.io. This resolves
a very longstanding piece of duplication where the standard library has
long contained the ability to generate a backtrace on panics, but the
code was later extracted and duplicated on crates.io with the
`backtrace` crate. Since that fork each implementation has seen various
improvements one way or another, but typically `backtrace`-the-crate has
lagged behind libstd in one way or another.

The goal here is to remove this duplication of a fairly critical piece
of code and ensure that there's only one source of truth for generating
backtraces between the standard library and the crate on crates.io.
Recently I've been working to bring the `backtrace` crate on crates.io
up to speed with the support in the standard library which includes:

* Support for `StackWalkEx` on MSVC to recover inline frames with
  debuginfo.
* Using `libbacktrace` by default on MinGW targets.
* Supporting `libbacktrace` on OSX as an option.
* Ensuring all the requisite support in `backtrace`-the-crate compiles
  with `#![no_std]`.
* Updating the `libbacktrace` implementation in `backtrace`-the-crate to
  initialize the global state with the correct filename where necessary.

After reviewing the code in libstd the `backtrace` crate should be at
exact feature parity with libstd today. The backtraces generated should
have the same symbols and same number of frames in general, and there's
not known divergence from libstd currently.

Note that one major difference between libstd's backtrace support and
the `backtrace` crate is that on OSX the crates.io crate enables the
`coresymbolication` feature by default. This feature, however, uses
private internal APIs that aren't published for OSX. While they provide
more accurate backtraces this isn't appropriate for libstd distributed
as a binary, so libstd's dependency on the `backtrace` crate explicitly
disables this feature and forces OSX to use `libbacktrace` as a
symbolication strategy.

The long-term goal of this refactoring is to eventually move us towards
a world where we can drop `libbacktrace` entirely and simply use Gimli
and the surrounding crates for backtrace support. That's still aways off
but hopefully will much more easily enabled by having the source of
truth for backtraces live in crates.io!

Procedurally if we go forward with this I'd like to transfer the
`backtrace-rs` crate to the rust-lang GitHub organization as well, but I
figured I'd hold off on that until we get closer to merging.
2019-05-25 17:09:45 -07:00
Alex Crichton
e59f0cc0d3 Bump compiler-builtins to 0.1.15
This commit bumps the `compiler-builtins` dependency to 0.1.15 which
expects to have the source for `compiler-rt` provided externally if the
`c` feature is enabled. This then plumbs through the necessary support
in the build system to ensure that if the `llvm-project` directory is
checked out and present that we enable the `c` feature of
`compiler-builtins` and compile in all the C intrinsics.
2019-05-22 07:46:36 -07:00
Alex Crichton
3c9790e429 Update the compiler_builtins crate
This updates to 0.1.13 for `compiler_builtins`, published to fix a few
issues. The feature changes here are updated because `compiler_builtins`
no longer enables the `c` feature by default but we want to do so
through our build still.

Closes #60747
Closes #60782
2019-05-17 07:17:15 -07:00
David Tolnay
08cd34e4fc
Switch to SPDX 2.1 license expression
According to the Cargo Reference:
https://doc.rust-lang.org/cargo/reference/manifest.html

> This is an SPDX 2.1 license expression for this package. Currently
> crates.io will validate the license provided against a whitelist of
> known license and exception identifiers from the SPDX license list
> 2.4. Parentheses are not currently supported.
>
> Multiple licenses can be separated with a `/`, although that usage
> is deprecated. Instead, use a license expression with AND and OR
> operators to get more explicit semantics.
2019-05-09 15:40:01 -07:00
Alex Crichton
7e8035593d std: Update compiler-builtins crate
Pulls in a fix for ensuring that wasm targets have code in
compiler-builtins for `ldexp` which LLVM can generate references to.
2019-05-08 06:59:24 -07:00
Amanieu d'Antras
e7f162fdd8 Update hashbrown to 0.3.0 2019-04-24 06:54:14 +08:00
Amanieu d'Antras
ae388773e1 Update hashbrown to 0.2.2 2019-04-24 06:54:14 +08:00
Amanieu d'Antras
5253366e19 Update hashbrown to 0.2.1 2019-04-24 06:54:14 +08:00
Amanieu d'Antras
1fa7a21534 Make libstd depend on the hashbrown crate 2019-04-24 06:54:14 +08:00
Alex Crichton
1bf04c9ad7 std: Upgrade compiler_builtins to fix wasi linkage
Turns out we needed to exclude a number of math functions on the
`wasm32-unknown-wasi` target, and this was fixed in 0.1.9 of
compiler-builtins and this is pulling in the fix to libstd's own build.
2019-04-04 11:24:53 -07:00
Petr Hosek
86d1678403 Support using LLVM's libunwind as the unwinder implementation
This avoids the dependency on host libraries such as libgcc_s which
may be undesirable in some deployment environments where these aren't
available.
2019-04-03 11:21:40 -07:00
Alex Crichton
ace71240d2 Add a new wasm32-unknown-wasi target
This commit adds a new wasm32-based target distributed through rustup,
supported in the standard library, and implemented in the compiler. The
`wasm32-unknown-wasi` target is intended to be a WebAssembly target
which matches the [WASI proposal recently announced.][LINK]. In summary
the WASI target is an effort to define a standard set of syscalls for
WebAssembly modules, allowing WebAssembly modules to not only be
portable across architectures but also be portable across environments
implementing this standard set of system calls.

The wasi target in libstd is still somewhat bare bones. This PR does not
fill out the filesystem, networking, threads, etc. Instead it only
provides the most basic of integration with the wasi syscalls, enabling
features like:

* `Instant::now` and `SystemTime::now` work
* `env::args` is hooked up
* `env::vars` will look up environment variables
* `println!` will print to standard out
* `process::{exit, abort}` should be hooked up appropriately

None of these APIs can work natively on the `wasm32-unknown-unknown`
target, but with the assumption of the WASI set of syscalls we're able
to provide implementations of these syscalls that engines can implement.
Currently the primary engine implementing wasi is [wasmtime], but more
will surely emerge!

In terms of future development of libstd, I think this is something
we'll probably want to discuss. The purpose of the WASI target is to
provide a standardized set of syscalls, but it's *also* to provide a
standard C sysroot for compiling C/C++ programs. This means it's
intended that functions like `read` and `write` are implemented for this
target with a relatively standard definition and implementation. It's
unclear, therefore, how we want to expose file descriptors and how we'll
want to implement system primitives. For example should `std::fs::File`
have a libc-based file descriptor underneath it? The raw wasi file
descriptor? We'll see! Currently these details are all intentionally
hidden and things we can change over time.

A `WasiFd` sample struct was added to the standard library as part of
this commit, but it's not currently used. It shows how all the wasi
syscalls could be ergonomically bound in Rust, and they offer a possible
implementation of primitives like `std::fs::File` if we bind wasi file
descriptors exactly.

Apart from the standard library, there's also the matter of how this
target is integrated with respect to its C standard library. The
reference sysroot, for example, provides managment of standard unix file
descriptors and also standard APIs like `open` (as opposed to the
relative `openat` inspiration for the wasi ssycalls). Currently the
standard library relies on the C sysroot symbols for operations such as
environment management, process exit, and `read`/`write` of stdio fds.
We want these operations in Rust to be interoperable with C if they're
used in the same process. Put another way, if Rust and C are linked into
the same WebAssembly binary they should work together, but that requires
that the same C standard library is used.

We also, however, want the `wasm32-unknown-wasi` target to be
usable-by-default with the Rust compiler without requiring a separate
toolchain to get downloaded and configured. With that in mind, there's
two modes of operation for the `wasm32-unknown-wasi` target:

1. By default the C standard library is statically provided inside of
   `liblibc.rlib` distributed as part of the sysroot. This means that
   you can `rustc foo.wasm --target wasm32-unknown-unknown` and you're
   good to go, a fully workable wasi binary pops out. This is
   incompatible with linking in C code, however, which may be compiled
   against a different sysroot than the Rust code was previously
   compiled against. In this mode the default of `rust-lld` is used to
   link binaries.

2. For linking with C code, the `-C target-feature=-crt-static` flag
   needs to be passed. This takes inspiration from the musl target for
   this flag, but the idea is that you're no longer using the provided
   static C runtime, but rather one will be provided externally. This
   flag is intended to also get coupled with an external `clang`
   compiler configured with its own sysroot. Therefore you'll typically
   use this flag with `-C linker=/path/to/clang-script-wrapper`. Using
   this mode the Rust code will continue to reference standard C
   symbols, but the definition will be pulled in by the linker configured.

Alright so that's all the current state of this PR. I suspect we'll
definitely want to discuss this before landing of course! This PR is
coupled with libc changes as well which I'll be posting shortly.

[LINK]:
[wasmtime]:
2019-03-29 15:58:17 -07:00
Jethro Beekman
f229422cc1 SGX target: fix std unit tests 2019-03-25 11:31:19 -07:00
Taiki Endo
93b6d9e086 libstd => 2018 2019-02-28 04:06:15 +09:00
Ralf Jung
1e4ab1eca6 update stdsimd 2019-02-14 16:20:58 +01:00
Ralf Jung
a707a85530 fixed for libstd build 2019-02-14 16:20:58 +01:00
Yu Ding
d04f5208ba Bound sgx target_env with fortanix as target_vendor
Signed-off-by: Yu Ding <dingelish@gmail.com>
2018-12-31 16:32:56 -08:00
Alex Crichton
8d500572fa std: Use backtrace-sys from crates.io
This commit switches the standard library to using the `backtrace-sys`
crate from crates.io instead of duplicating the logic here in the Rust
repositor with the `backtrace-sys`'s crate's logic.

Eventually this will hopefully be a good step towards using the
`backtrace` crate directly from crates.io itself, but we're not quite
there yet! Hopefully this is a small incremental first step we can take.
2018-12-24 08:32:57 -08:00
Jethro Beekman
dcb5db80b2 Add std::os::fortanix_sgx module 2018-12-20 10:09:52 +05:30
Alex Crichton
fcc8bb41e9 std: Use rustc_demangle from crates.io
No more need to duplicate the demangling routine between crates.io and
the standard library, we can use the exact same one!
2018-12-14 15:15:53 -08:00