Skip to content

Commit 8061b46

Browse files
committed
[WIP]
1 parent b34c701 commit 8061b46

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

example/mini_core_hello_world.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
extern_types,
77
naked_functions,
88
thread_local,
9-
repr_simd
9+
repr_simd,
10+
start
1011
)]
1112
#![no_core]
1213
#![allow(dead_code, non_camel_case_types, internal_features)]
@@ -40,8 +41,8 @@ trait Termination {
4041
impl Termination for () {
4142
fn report(self) -> i32 {
4243
unsafe {
43-
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
44-
assert_eq!(*NUM_REF as i32, 44);
44+
//NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
45+
//assert_eq!(*NUM_REF as i32, 42);
4546
}
4647
0
4748
}
@@ -97,12 +98,13 @@ enum Ordering {
9798
Greater = 1,
9899
}
99100

100-
#[lang = "start"]
101-
fn start<T: Termination + 'static>(
102-
main: fn() -> T,
101+
//#[lang = "start"]
102+
#[start]
103+
fn start(
104+
//main: fn() -> T,
103105
argc: isize,
104106
argv: *const *const u8,
105-
_sigpipe: u8,
107+
//_sigpipe: u8,
106108
) -> isize {
107109
if argc == 3 {
108110
unsafe {
@@ -162,7 +164,7 @@ fn main() {
162164
take_unique(Unique { pointer: unsafe { NonNull(1 as *mut ()) }, _marker: PhantomData });
163165
take_f32(0.1);
164166

165-
call_return_u128_pair();
167+
//call_return_u128_pair();
166168

167169
bool_struct_in_11(bool_11 {
168170
field0: true,
@@ -184,15 +186,17 @@ fn main() {
184186
assert_eq!(slice_ptr as usize % 4, 0);
185187

186188
unsafe {
187-
printf("Hello %s\n\0" as *const str as *const i8, "printf\0" as *const str as *const i8);
189+
//printf("Hello %s\n\0" as *const str as *const i8, "printf\0" as *const str as *const i8);
188190

189191
let hello: &[u8] = b"Hello\0" as &[u8; 6];
190192
let ptr: *const i8 = hello as *const [u8] as *const i8;
191193
puts(ptr);
192194

193195
let world: Box<&str> = Box::new("World!\0");
194196
puts(*world as *const str as *const i8);
195-
world as Box<dyn SomeTrait>;
197+
//world as Box<dyn SomeTrait>;
198+
199+
return;
196200

197201
assert_eq!(intrinsics::bitreverse(0b10101000u8), 0b00010101u8);
198202

src/main_shim.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use rustc_span::{DUMMY_SP, Ident};
66

77
use crate::prelude::*;
88

9+
// FIXME handle wasi __main_void
10+
911
/// Create the `main` function which will initialize the rust runtime and call
1012
/// users main function.
1113
pub(crate) fn maybe_create_entry_wrapper(

0 commit comments

Comments
 (0)