From 22049b6571c64af9c6b350ae8761ddbccebde7f6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 28 Jan 2018 19:56:29 +0800 Subject: standalone_miri - Up to attempting to run `hello` --- src/trans/codegen_mmir.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/trans/codegen_mmir.cpp b/src/trans/codegen_mmir.cpp index b3b73cdb..9ab406e0 100644 --- a/src/trans/codegen_mmir.cpp +++ b/src/trans/codegen_mmir.cpp @@ -147,24 +147,23 @@ namespace { if( is_executable ) { - m_of << "fn main(i32, *const *const i8): i32 {\n"; - m_of << "\t0: {\n"; + m_of << "fn ::main#(i32, *const *const i8): i32 {\n"; auto c_start_path = m_resolve.m_crate.get_lang_item_path_opt("mrustc-start"); if( c_start_path == ::HIR::SimplePath() ) { - m_of << "\tlet m: fn();"; + m_of << "\tlet m: fn();\n"; m_of << "\t0: {\n"; - m_of << "\t\tASSIGN m = " << Trans_Mangle( ::HIR::GenericPath(m_resolve.m_crate.get_lang_item_path(Span(), "mrustc-main")) ) << "\n"; - m_of << "\t\tCALL RETURN = " << Trans_Mangle(::HIR::GenericPath(c_start_path)) << "(m, arg1, arg2) goto 1 else 1;\n"; + m_of << "\t\tASSIGN m = &" << ::HIR::GenericPath(m_resolve.m_crate.get_lang_item_path(Span(), "mrustc-main")) << ";\n"; + m_of << "\t\tCALL RETURN = " << ::HIR::GenericPath(m_resolve.m_crate.get_lang_item_path(Span(), "start")) << "(m, arg1, arg2) goto 1 else 1\n"; } else { m_of << "\t0: {\n"; - m_of << "\t\tCALL RETURN = " << Trans_Mangle(::HIR::GenericPath(c_start_path)) << "(arg1, arg2) goto 1 else 1;\n"; + m_of << "\t\tCALL RETURN = " << ::HIR::GenericPath(c_start_path) << "(arg1, arg2) goto 1 else 1;\n"; } m_of << "\t}\n"; m_of << "\t1: {\n"; - m_of << "\t\tRETURN}\n"; + m_of << "\t\tRETURN\n"; m_of << "\t}\n"; m_of << "}\n"; } -- cgit v1.2.3