about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2018-12-25Auto merge of #56926 - alexcrichton:update-stdsimd, r=TimNNbors-15/+15
Update the stdsimd submodule This brings in a few updates: * Update wasm intrinsic naming for atomics * Update and reimplement most simd128 wasm intrinsics * Other misc improvements here and there, including a small start to AVX-512 intrinsics
2018-12-24Rollup merge of #56978 - jethrogb:jb/sgx-os-mod, r=joshtriplettMazdak Farrokhzad-55/+271
Add `std::os::fortanix_sgx` module This PR adds the `std::os::sgx` module to expose platform-specific APIs behind the `sgx_platform` feature gate. Depends on https://github.com/rust-lang/rust/pull/56972 to be able to meaningfully build `std::os` documentation for non-standard targets. Tracking issue: https://github.com/rust-lang/rust/issues/56975
2018-12-23Rollup merge of #56979 - VardhanThigle:Vardhan/rust-sgx-unwind-support, ↵kennytm-6/+139
r=alexcrichton Adding unwinding support for x86_64_fortanix_unknown_sgx target. Unwinding support is provided by our port of LLVM's libunwind which is available from https://github.com/fortanix/libunwind/tree/release_50. libunwind requires support for rwlock and printing to stderr, which is only provided by `std` for this target. This poses two problems: 1) how to expose the `std` functionality to C and 2) dependency inversion. ### Exposing `std` For exposing the functionality we chose to expose the following symbols: * __rust_rwlock_rdlock * __rust_rwlock_wrlock * __rust_rwlock_unlock * __rust_print_err * __rust_abort Also, the following are needed from `alloc`: * __rust_alloc * __rust_dealloc #### Rust RWLock in C In `libunwind`, RWLock is initialized as a templated static variable: ```c pthread_rwlock_t DwarfFDECache<A>::_lock = PTHREAD_RWLOCK_INITIALIZER; ``` I don't know of a good way to use the Rust sys::rwlock::RWLock type and initializer there. We could have a static global variable in Rust, but that doesn't work with the templating. The variable needs to be initialized statically, since this target doesn't support the .init section. Currently, I just used a byte array and standard C array initialization. The mapping between this C type and the Rust type needs to be manually maintained. There is a compile-time check and a unit test to make sure the Rust versions of these C definitions match the actual Rust type. If any reviewer knows of a better solution, please do tell. ### Dependency inversion issue `std` depends on `panic_unwind` which depends on `libunwind`, and `libunwind` depends on `std`. This is not normally supported by Rust's linking system. Therefore we use raw C exports from `std` *and* `libunwind.a` is linked last in the target `post_link_objects` instead of being built as part of the Rust `libunwind`. Currently, all C exports are defined in `src/libstd/sys/sgx/rwlock.rs` to overcome LTO issues. Only the `__rust_rwlock_*` definitions *need* to live there for privacy reasons. Once again, if any reviewer knows of a better solution, please do tell. r? @alexcrichton
2018-12-21Auto merge of #56779 - adrian-budau:master, r=alexcrichtonbors-28/+77
On musl targets assume certain symbols exist (like pipe2 and accept4). This fixes #56675. I don't know if this is the best solution, or if I should also add some tests so I'm waiting for some feedback. Thanks!
2018-12-21Properly report ENOSYS by modifying errnoAdrian Budau-22/+18
2018-12-21Auto merge of #56813 - oli-obk:main_đź§¶, r=pnkfelixbors-26/+0
Always run rustc in a thread cc @ishitatsuyuki @eddyb r? @pnkfelix [Previously](https://github.com/rust-lang/rust/pull/48575) we moved to only producing threads when absolutely necessary. Even before we opted to only create threads in some cases, which [is unsound](https://github.com/rust-lang/rust/pull/48575#issuecomment-380635967) due to the way we use thread local storage.
2018-12-20Fix typo in commentAdrian Budau-1/+1
2018-12-20Fix pipe2 and accept4 on static linked executables on linux (like musl).Adrian Budau-27/+80
2018-12-20Add `std::os::fortanix_sgx` moduleJethro Beekman-54/+255
2018-12-19Adding unwinding support for x86_64_fortanix_unknown_sgx target.Vardhan Thigle-6/+139
2018-12-19Revert "Remove some dead code from `sgx`"Jethro Beekman-0/+15
This reverts commit 134661917bf4b086b027a2c58219d50ba57a1453.
2018-12-19SGX target: fix docs buildJethro Beekman-2/+2
2018-12-17Update the stdsimd submoduleAlex Crichton-15/+15
This brings in a few updates: * Update wasm intrinsic naming for atomics * Update and reimplement most simd128 wasm intrinsics * Other misc improvements here and there, including a small start to AVX-512 intrinsics
2018-12-14Remove dead codeOliver Scherer-26/+0
2018-12-14Auto merge of #56818 - kennytm:rollup-2, r=kennytmbors-22/+0
Rollup of 14 pull requests (first batch) Successful merges: - #56562 (Update libc version required by rustc) - #56609 (Unconditionally emit the target-cpu LLVM attribute.) - #56637 (rustdoc: Fix local reexports of proc macros) - #56658 (Add non-panicking `maybe_new_parser_from_file` variant) - #56695 (Fix irrefutable matches on integer ranges) - #56699 (Use a `newtype_index!` within `Symbol`.) - #56702 ([self-profiler] Add column for percent of total time) - #56708 (Remove some unnecessary feature gates) - #56709 (Remove unneeded extra chars to reduce search-index size) - #56744 (specialize: remove Boxes used by Children::insert) - #56748 (Update panic message to be clearer about env-vars) - #56749 (x86: Add the `adx` target feature to whitelist) - #56756 (Disable btree pretty-printers on older gdbs) - #56789 (rustc: Add an unstable `simd_select_bitmask` intrinsic) r? @ghost
2018-12-14Rollup merge of #56708 - oli-obk:stability_internal_const_fn, r=alexcrichtonkennytm-22/+0
Remove some unnecessary feature gates fixes #56585 cc @jethrogb
2018-12-14Auto merge of #56568 - notriddle:master, r=alexcrichtonbors-52/+209
Remove dependency on shell32.dll Closes #56510 if it works on MinGW (I've only tested it on MSVC).
2018-12-14Auto merge of #56490 - faern:add-checked-add-to-instant, r=alexcrichtonbors-162/+103
Add checked_add method to Instant time type Appending functionality to the already opened topic of `checked_add` on time types over at #55940. Doing checked addition between an `Instant` and a `Duration` is important to reliably determine a future instant. We could use this in the `parking_lot` crate to compute an instant when in the future to wake a thread up without risking a panic.
2018-12-13Fix dur2intervals import on cloudabiLinus Färnstrand-5/+9
2018-12-13Fix checked_add/sub for sys/sgx/time.rsLinus Färnstrand-11/+7
2018-12-13Add checked_sub for Instant and SystemTimeLinus Färnstrand-85/+61
2018-12-13Add checked_add method to Instant time typeLinus Färnstrand-72/+37
2018-12-12Bump to 1.33.0Alex Crichton-1/+1
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-11std: Depend directly on crates.io cratesAlex Crichton-1/+1
Ever since we added a Cargo-based build system for the compiler the standard library has always been a little special, it's never been able to depend on crates.io crates for runtime dependencies. This has been a result of various limitations, namely that Cargo doesn't understand that crates from crates.io depend on libcore, so Cargo tries to build crates before libcore is finished. I had an idea this afternoon, however, which lifts the strategy from #52919 to directly depend on crates.io crates from the standard library. After all is said and done this removes a whopping three submodules that we need to manage! The basic idea here is that for any crate `std` depends on it adds an *optional* dependency on an empty crate on crates.io, in this case named `rustc-std-workspace-core`. This crate is overridden via `[patch]` in this repository to point to a local crate we write, and *that* has a `path` dependency on libcore. Note that all `no_std` crates also depend on `compiler_builtins`, but if we're not using submodules we can publish `compiler_builtins` to crates.io and all crates can depend on it anyway! The basic strategy then looks like: * The standard library (or some transitive dep) decides to depend on a crate `foo`. * The standard library adds ```toml [dependencies] foo = { version = "0.1", features = ['rustc-dep-of-std'] } ``` * The crate `foo` has an optional dependency on `rustc-std-workspace-core` * The crate `foo` has an optional dependency on `compiler_builtins` * The crate `foo` has a feature `rustc-dep-of-std` which activates these crates and any other necessary infrastructure in the crate. A sample commit for `dlmalloc` [turns out to be quite simple][commit]. After that all `no_std` crates should largely build "as is" and still be publishable on crates.io! Notably they should be able to continue to use stable Rust if necessary, since the `rename-dependency` feature of Cargo is soon stabilizing. As a proof of concept, this commit removes the `dlmalloc`, `libcompiler_builtins`, and `libc` submodules from this repository. Long thorns in our side these are now gone for good and we can directly depend on crates.io! It's hoped that in the long term we can bring in other crates as necessary, but for now this is largely intended to simply make it easier to manage these crates and remove submodules. This should be a transparent non-breaking change for all users, but one possible stickler is that this almost for sure breaks out-of-tree `std`-building tools like `xargo` and `cargo-xbuild`. I think it should be relatively easy to get them working, however, as all that's needed is an entry in the `[patch]` section used to build the standard library. Hopefully we can work with these tools to solve this problem! [commit]: https://github.com/alexcrichton/dlmalloc-rs/commit/28ee12db813a3b650a7c25d1c36d2c17dcb88ae3
2018-12-11Use iterators instead of raw offsets in Windows argument parserMichael Howell-49/+45
2018-12-11Remove some dead code from `sgx`Oliver Scherer-15/+0
2018-12-11Remove unnecessary feature gates from const fnsOliver Scherer-7/+0
2018-12-10Fix iterator nitsMichael Howell-18/+7
2018-12-10Fix nitMichael Howell-4/+6
Rewrite it to not use `if let`.
2018-12-10Fix nitsMichael Howell-3/+10
Add comments explaining how we test this, and use a slice for debugging instead of a clone of the iterator.
2018-12-10Fix poorly-transcribed test caseMichael Howell-3/+3
2018-12-10Fix nitpicksMichael Howell-23/+21
Switch to vec::IntoIter as our backing double-ended iterator. Fix incorrect comment.
2018-12-10Remove dependency on shell32.dll #56510Michael Howell-41/+206
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-12/+12
2018-12-07Auto merge of #56581 - kennytm:rollup, r=kennytmbors-1/+1
Rollup of 7 pull requests Successful merges: - #56000 (Add Armv8-M Mainline targets) - #56250 (Introduce ptr::hash for references) - #56434 (Improve query cycle errors for parallel queries) - #56516 (Replace usages of `..i + 1` ranges with `..=i`.) - #56555 (Send textual profile data to stderr, not stdout) - #56561 (Fix bug in from_key_hashed_nocheck) - #56574 (Fix a stutter in the docs for slice::exact_chunks) Failed merges: r? @ghost
2018-12-07SGX target: implement command-line arguments and environment variablesJethro Beekman-25/+70
2018-12-07SGX target: implement timeJethro Beekman-3/+9
2018-12-07SGX target: implement networkingJethro Beekman-53/+167
2018-12-07SGX target: implement streamsJethro Beekman-28/+134
2018-12-07SGX target: implement synchronization primitives and threadingJethro Beekman-76/+828
2018-12-07SGX target: implement user memory managementJethro Beekman-5/+500
2018-12-07SGX target: add thread local storageJethro Beekman-17/+277
2018-12-07Add x86_64-fortanix-unknown-sgx target to libstd and dependenciesJethro Beekman-0/+2807
The files src/libstd/sys/sgx/*.rs are mostly copied/adapted from the wasm target. This also updates the dlmalloc submodule to the very latest version.
2018-12-07Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrumkennytm-1/+1
Replace usages of `..i + 1` ranges with `..=i`. Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-06Change sys::Thread::new to take the thread entry as Box<dyn FnBox() + 'static>ĚŁJethro Beekman-5/+10
2018-12-06Update compiler_builtins and remove wasm f32<->f64 math conversionsJethro Beekman-67/+14
2018-12-06Refactor net::each_addr/lookup_host to forward error from resolveJethro Beekman-86/+178
2018-12-06Refactor stderr_prints_nothing into a more modular functionJethro Beekman-10/+14
2018-12-06Rollup merge of #56525 - udoprog:linux-current-exe, r=alexcrichtonPietro Albini-5/+8
Avoid extra copy and syscall in std::env::current_exe
2018-12-05Rollup merge of #56497 - ljedrz:cleanup_libstd_const_lifetimes, r=kennytmPietro Albini-148/+148
cleanup: remove static lifetimes from consts in libstd