Fix SGX RWLock representation for UnsafeCell niche fix
This commit is contained in:
parent
3e047229ef
commit
1b12232b8f
@ -48,7 +48,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 "53b586346f2c7870e20b170decdc30729d97c42b"
|
||||
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "5125c169b30837208a842f85f7ae44a83533bd0e"
|
||||
|
||||
COPY dist-various-2/build-wasi-toolchain.sh /tmp/
|
||||
RUN /tmp/build-wasi-toolchain.sh
|
||||
|
@ -10,10 +10,10 @@ pub struct RWLock {
|
||||
writer: SpinMutex<WaitVariable<bool>>,
|
||||
}
|
||||
|
||||
// Below is to check at compile time, that RWLock has size of 128 bytes.
|
||||
// Check at compile time that RWLock size matches C definition (see test_c_rwlock_initializer below)
|
||||
#[allow(dead_code)]
|
||||
unsafe fn rw_lock_size_assert(r: RWLock) {
|
||||
mem::transmute::<RWLock, [u8; 128]>(r);
|
||||
mem::transmute::<RWLock, [u8; 144]>(r);
|
||||
}
|
||||
|
||||
impl RWLock {
|
||||
@ -210,15 +210,17 @@ mod tests {
|
||||
// be changed too.
|
||||
#[test]
|
||||
fn test_c_rwlock_initializer() {
|
||||
#[rustfmt::skip]
|
||||
const RWLOCK_INIT: &[u8] = &[
|
||||
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0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0x0, 0x0, 0x0,
|
||||
/* 0x60 */ 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
/* 0x70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
/* 0x80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
];
|
||||
|
||||
#[inline(never)]
|
||||
@ -239,7 +241,7 @@ mod tests {
|
||||
zero_stack();
|
||||
let mut init = MaybeUninit::<RWLock>::zeroed();
|
||||
rwlock_new(&mut init);
|
||||
assert_eq!(mem::transmute::<_, [u8; 128]>(init.assume_init()).as_slice(), RWLOCK_INIT)
|
||||
assert_eq!(mem::transmute::<_, [u8; 144]>(init.assume_init()).as_slice(), RWLOCK_INIT)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user