From 81e960eb748fdb37d1d61da262ec343e2fdb2511 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 16 May 2019 13:56:56 -0400 Subject: improvements to build-lib use case of WebAssembly * build-exe does include the startup code that supplies _start for the wasm32-freestanding target. Previously this did not occur because of logic excluding "freestanding". * build-lib for wasm32-freestanding target gets linked by LLD. To avoid infinite recursion, compiler_rt and zig libc are built as objects rather than libraries. - no "lib" prefix and ".wasm" extension instead of ".a". Rather than build-lib foo.zig producing "libfoo.a", now it produces "foo.wasm". * go back to using `.o` extension for webassembly objects * zig libc only provides _start symbol for wasm when linking libc. --- src/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index ecdee4e9e5..7e7c1432e9 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8548,7 +8548,7 @@ static void gen_root_source(CodeGen *g) { } report_errors_and_maybe_exit(g); - if (!g->is_test_build && g->zig_target->os != OsFreestanding && + if (!g->is_test_build && (g->zig_target->os != OsFreestanding || target_is_wasm(g->zig_target)) && g->zig_target->os != OsUefi && !g->have_c_main && !g->have_winmain && !g->have_winmain_crt_startup && ((g->have_pub_main && g->out_type == OutTypeObj) || g->out_type == OutTypeExe)) -- cgit v1.2.3