Skip to content

Commit

Permalink
Rollup merge of rust-lang#73866 - Goirad:fix-entry-improper-ctypes, r…
Browse files Browse the repository at this point in the history
…=davidtwco

Obviate #[allow(improper_ctypes_definitions)]

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`.

cc @jethrogb
  • Loading branch information
Manishearth committed Jul 14, 2020
2 parents ac01a53 + 9448ed4 commit 80a162e
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 80a162e

Please sign in to comment.