authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-27 22:52:30-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-27 22:55:00-07:00
logdff45c266e6c6103ab324c4771a21d5b52ef85ba
treefa0217d5f98dde74d2476d92d3fecf6f617e78a7
parent420b7713d4e58bdb28992bca1a4de108317cfd31

wasi.c: report no environment variables available

I moved part of the compiler that checks environment variables to the standard library, so it doesn't have access to `build_options.only_c` anymore, which means some environment variable checks are leaking into the zig1.wasm build of zig. This logic still makes it return "no environment variables found" though.

1 files changed, 5 insertions(+), 3 deletions(-)

stage1/wasi.c+5-3
......@@ -662,13 +662,15 @@ uint32_t wasi_snapshot_preview1_fd_filestat_set_times(uint32_t fd, uint64_t atim
662662}
663663
664664uint32_t wasi_snapshot_preview1_environ_sizes_get(uint32_t environ_size, uint32_t environ_buf_size) {
665 (void)environ_size;
666 (void)environ_buf_size;
665 uint8_t *const m = *wasm_memory;
666 uint32_t *environ_size_ptr = (uint32_t *)&m[environ_size];
667 uint32_t *environ_buf_size_ptr = (uint32_t *)&m[environ_buf_size];
667668#if LOG_TRACE
668669 fprintf(stderr, "wasi_snapshot_preview1_environ_sizes_get()\n");
669670#endif
670671
671 panic("unimplemented");
672 *environ_size_ptr = 0;
673 *environ_buf_size_ptr = 0;
672674 return wasi_errno_success;
673675}
674676