authorgravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2021-07-06 20:49:57+09:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-07-11 00:06:47+02:00
logb9e896d7b076e59d6f6dd9b0bad9697875d1f6e4
treeaf131c1a7fae17493b84fee0102dac7bd3a9689f
parent2d855745f91852af92ad970feef96e55919993d3

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

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>

2 files changed, 0 insertions(+), 39 deletions(-)

lib/libc/wasi/libc-bottom-half/crt/crt1.c deleted-24
......@@ -1,24 +0,0 @@
1#include <wasi/api.h>
2extern void __wasm_call_ctors(void);
3extern int __original_main(void);
4extern void __wasm_call_dtors(void);
5
6__attribute__((export_name("_start")))
7void _start(void) {
8 // The linker synthesizes this to call constructors.
9 __wasm_call_ctors();
10
11 // Call `__original_main` which will either be the application's zero-argument
12 // `__original_main` function or a libc routine which calls `__main_void`.
13 // TODO: Call `main` directly once we no longer have to support old compilers.
14 int r = __original_main();
15
16 // Call atexit functions, destructors, stdio cleanup, etc.
17 __wasm_call_dtors();
18
19 // If main exited successfully, just return, otherwise call
20 // `__wasi_proc_exit`.
21 if (r != 0) {
22 __wasi_proc_exit(r);
23 }
24}
src/wasi_libc.zig-15
......@@ -9,7 +9,6 @@ const target_util = @import("target.zig");
99const musl = @import("musl.zig");
1010
1111pub const CRTFile = enum {
12 crt1_o,
1312 crt1_reactor_o,
1413 crt1_command_o,
1514 libc_a,
......@@ -71,19 +70,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
7170 const arena = &arena_allocator.allocator;
7271
7372 switch (crt_file) {
74 .crt1_o => {
75 var args = std.ArrayList([]const u8).init(arena);
76 try addCCArgs(comp, arena, &args, false);
77 try addLibcBottomHalfIncludes(comp, arena, &args);
78 return comp.build_crt_file("crt1", .Obj, &[1]Compilation.CSourceFile{
79 .{
80 .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
81 "libc", try sanitize(arena, crt1_src_file),
82 }),
83 .extra_flags = args.items,
84 },
85 });
86 },
8773 .crt1_reactor_o => {
8874 var args = std.ArrayList([]const u8).init(arena);
8975 try addCCArgs(comp, arena, &args, false);
......@@ -1151,7 +1137,6 @@ const libc_top_half_src_files = [_][]const u8{
11511137 "wasi/libc-top-half/sources/arc4random.c",
11521138};
11531139
1154const crt1_src_file = "wasi/libc-bottom-half/crt/crt1.c";
11551140const crt1_command_src_file = "wasi/libc-bottom-half/crt/crt1-command.c";
11561141const crt1_reactor_src_file = "wasi/libc-bottom-half/crt/crt1-reactor.c";
11571142