@@ -1362,6 +1362,7 @@ struct CodeGen {
|
||||
bool strip_debug_symbols;
|
||||
bool want_h_file;
|
||||
bool have_pub_main;
|
||||
bool have_c_main;
|
||||
bool have_pub_panic;
|
||||
bool link_libc;
|
||||
Buf *libc_lib_dir;
|
||||
|
||||
@@ -2911,7 +2911,12 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package,
|
||||
} else if (buf_eql_str(proto_name, "panic")) {
|
||||
g->have_pub_panic = true;
|
||||
}
|
||||
} else if (proto_node->data.fn_proto.visib_mod == VisibModExport && buf_eql_str(proto_name, "main") &&
|
||||
g->link_libc)
|
||||
{
|
||||
g->have_c_main = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4726,7 +4726,9 @@ void codegen_add_root_code(CodeGen *g, Buf *src_dir, Buf *src_basename, Buf *sou
|
||||
assert(g->root_out_name);
|
||||
assert(g->out_type != OutTypeUnknown);
|
||||
|
||||
if (!g->is_test_build && g->have_pub_main && (g->out_type == OutTypeObj || g->out_type == OutTypeExe)) {
|
||||
if (!g->is_test_build && g->zig_target.os != ZigLLVM_UnknownOS && !g->have_c_main &&
|
||||
((g->have_pub_main && g->out_type == OutTypeObj) || g->out_type == OutTypeExe))
|
||||
{
|
||||
g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g), "bootstrap.zig");
|
||||
}
|
||||
if (!g->omit_zigrt) {
|
||||
|
||||
Reference in New Issue
Block a user