diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-24 18:25:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-24 18:25:44 +0100 |
| commit | bea83213f3cf0293b0c7707ff1ddcdb6519e0d64 (patch) | |
| tree | 41f0d77e46cd6cab8053116270c68401061b4539 /src | |
| parent | 8348f8338859d6267ef52d4671d98e8a4cf76a6f (diff) | |
| parent | 6abba95045e28e768a2b553f6b0cd2f04a71bfe0 (diff) | |
| download | rust-bea83213f3cf0293b0c7707ff1ddcdb6519e0d64.tar.gz rust-bea83213f3cf0293b0c7707ff1ddcdb6519e0d64.zip | |
Rollup merge of #57803 - jethrogb:jb/sgx-unwind-version, r=alexcrichton
Several changes to libunwind for SGX target Two fixes: * #34978 bites again! * __rust_alloc are actually private symbols. Add new public versions. Also, these ones are `extern "C"`. Upstream changes (https://github.com/fortanix/llvm-project/pull/2, https://github.com/fortanix/llvm-project/pull/3): * b7357de Avoid too new relocation types being emitted * 0feefe5 Use new symbol names to call Rust allocator Fixes https://github.com/fortanix/rust-sgx/issues/65
Diffstat (limited to 'src')
| -rw-r--r-- | src/ci/docker/dist-various-2/Dockerfile | 2 | ||||
| -rw-r--r-- | src/libstd/sys/sgx/rwlock.rs | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ci/docker/dist-various-2/Dockerfile b/src/ci/docker/dist-various-2/Dockerfile index 906255533ad..952c1ba2ccb 100644 --- a/src/ci/docker/dist-various-2/Dockerfile +++ b/src/ci/docker/dist-various-2/Dockerfile @@ -32,7 +32,7 @@ RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc COPY dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/ # We pass the commit id of the port of LLVM's libunwind to the build script. # Any update to the commit id here, should cause the container image to be re-built from this point on. -RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "bbe23902411be88d7388f381becefadd6e3ef819" +RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "13fad13f8ea83a8da58d04a5faa45943151b3398" COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/libstd/sys/sgx/rwlock.rs b/src/libstd/sys/sgx/rwlock.rs index 47874158ed9..43ceae7d33b 100644 --- a/src/libstd/sys/sgx/rwlock.rs +++ b/src/libstd/sys/sgx/rwlock.rs @@ -1,3 +1,4 @@ +use alloc::{self, Layout}; use num::NonZeroUsize; use slice; use str; @@ -147,6 +148,7 @@ impl RWLock { self.__write_unlock(rguard, wguard); } + // only used by __rust_rwlock_unlock below #[inline] unsafe fn unlock(&self) { let rguard = self.readers.lock(); @@ -164,6 +166,7 @@ impl RWLock { const EINVAL: i32 = 22; +// used by libunwind port #[no_mangle] pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RWLock) -> i32 { if p.is_null() { @@ -190,6 +193,8 @@ pub unsafe extern "C" fn __rust_rwlock_unlock(p: *mut RWLock) -> i32 { return 0; } +// the following functions are also used by the libunwind port. They're +// included here to make sure parallel codegen and LTO don't mess things up. #[no_mangle] pub unsafe extern "C" fn __rust_print_err(m: *mut u8, s: i32) { if s < 0 { @@ -206,6 +211,16 @@ pub unsafe extern "C" fn __rust_abort() { ::sys::abort_internal(); } +#[no_mangle] +pub unsafe extern "C" fn __rust_c_alloc(size: usize, align: usize) -> *mut u8 { + alloc::alloc(Layout::from_size_align_unchecked(size, align)) +} + +#[no_mangle] +pub unsafe extern "C" fn __rust_c_dealloc(ptr: *mut u8, size: usize, align: usize) { + alloc::dealloc(ptr, Layout::from_size_align_unchecked(size, align)) +} + #[cfg(test)] mod tests { |
