wasi-libc: remove crt1.o as it's not WASI ABI compatible

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda 2021-07-06 20:49:57 +09:00 committed by Jakub Konka
parent 2d855745f9
commit b9e896d7b0
2 changed files with 0 additions and 39 deletions

View File

@ -1,24 +0,0 @@
#include <wasi/api.h>
extern void __wasm_call_ctors(void);
extern int __original_main(void);
extern void __wasm_call_dtors(void);
__attribute__((export_name("_start")))
void _start(void) {
// The linker synthesizes this to call constructors.
__wasm_call_ctors();
// Call `__original_main` which will either be the application's zero-argument
// `__original_main` function or a libc routine which calls `__main_void`.
// TODO: Call `main` directly once we no longer have to support old compilers.
int r = __original_main();
// Call atexit functions, destructors, stdio cleanup, etc.
__wasm_call_dtors();
// If main exited successfully, just return, otherwise call
// `__wasi_proc_exit`.
if (r != 0) {
__wasi_proc_exit(r);
}
}

View File

@ -9,7 +9,6 @@ const target_util = @import("target.zig");
const musl = @import("musl.zig");
pub const CRTFile = enum {
crt1_o,
crt1_reactor_o,
crt1_command_o,
libc_a,
@ -71,19 +70,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
const arena = &arena_allocator.allocator;
switch (crt_file) {
.crt1_o => {
var args = std.ArrayList([]const u8).init(arena);
try addCCArgs(comp, arena, &args, false);
try addLibcBottomHalfIncludes(comp, arena, &args);
return comp.build_crt_file("crt1", .Obj, &[1]Compilation.CSourceFile{
.{
.src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
"libc", try sanitize(arena, crt1_src_file),
}),
.extra_flags = args.items,
},
});
},
.crt1_reactor_o => {
var args = std.ArrayList([]const u8).init(arena);
try addCCArgs(comp, arena, &args, false);
@ -1151,7 +1137,6 @@ const libc_top_half_src_files = [_][]const u8{
"wasi/libc-top-half/sources/arc4random.c",
};
const crt1_src_file = "wasi/libc-bottom-half/crt/crt1.c";
const crt1_command_src_file = "wasi/libc-bottom-half/crt/crt1-command.c";
const crt1_reactor_src_file = "wasi/libc-bottom-half/crt/crt1-reactor.c";