Skip to content

Commit 4e6295a

Browse files
committed
[rust] update RwLock definition in libunwind to match std
1 parent 2a2ea6b commit 4e6295a

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

libunwind/src/UnwindRustSgx.h

+5-15
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,14 @@
2222

2323
// We have to use RWLock from rust repo, it is defined in:
2424
// src/libstd/sys/sgx/rwlock.rs.
25-
// rwlock.rs has compile time check to ensure sizeof(RWLock) = 144.
25+
// rwlock.rs has a compile time check to ensure the size and alignment matches
26+
// the Rust definition.
2627
typedef struct {
27-
unsigned char opaque[144];
28+
void *opaque;
2829
} RWLock;
2930

30-
// The below is obtained by printing initialized bytes
31-
// for RWLock in rust repo: src/libstd/sys/sgx/rwlock.rs.
32-
#define RWLOCK_INIT { { \
33-
/* 0x00 */ 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
34-
/* 0x10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
35-
/* 0x20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
36-
/* 0x30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
37-
/* 0x40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
38-
/* 0x50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
39-
/* 0x60 */ 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
40-
/* 0x70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
41-
/* 0x80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \
42-
} }
31+
#define RWLOCK_INIT \
32+
{ (void *)0 }
4333

4434
// These are the functions exposed by SGX-Rust.
4535
// The rust changes are available at:

0 commit comments

Comments
 (0)