Skip to content

Commit

Permalink
Obviate #[allow(improper_ctypes_definitions)]
Browse files Browse the repository at this point in the history
Modifies the return type for `fn entry` so that allowing
improper_ctypes_definitions is no longer necessary. This change is
derived from a similar pattern in `libstd/sys/sgx/abi/usercalls/raw.rs`
with `UsercallReturn`.
  • Loading branch information
Goirad committed Jun 29, 2020
1 parent 9f3c96b commit 9448ed4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libstd/sys/sgx/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub mod usercalls;
#[cfg(not(test))]
global_asm!(include_str!("entry.S"));

#[repr(C)]
struct EntryReturn(u64, u64);

#[cfg(not(test))]
#[no_mangle]
unsafe extern "C" fn tcs_init(secondary: bool) {
Expand Down Expand Up @@ -56,16 +59,15 @@ unsafe extern "C" fn tcs_init(secondary: bool) {
// able to specify this
#[cfg(not(test))]
#[no_mangle]
#[allow(improper_ctypes_definitions)]
extern "C" fn entry(p1: u64, p2: u64, p3: u64, secondary: bool, p4: u64, p5: u64) -> (u64, u64) {
extern "C" fn entry(p1: u64, p2: u64, p3: u64, secondary: bool, p4: u64, p5: u64) -> EntryReturn {
// FIXME: how to support TLS in library mode?
let tls = Box::new(tls::Tls::new());
let _tls_guard = unsafe { tls.activate() };

if secondary {
super::thread::Thread::entry();

(0, 0)
EntryReturn(0, 0)
} else {
extern "C" {
fn main(argc: isize, argv: *const *const u8) -> isize;
Expand Down

0 comments on commit 9448ed4

Please sign in to comment.