From c4919c02900e3ad09c584a0bd103698feeae34f1 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 15 May 2023 09:35:29 +0000 Subject: [PATCH 1/2] [wasm] Remove implicit _WASI_EMULATED_X macro definition in ClangImporter --- lib/ClangImporter/ClangImporter.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index 3ebdc3ee4f279..c82af4b32686d 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -663,10 +663,6 @@ importer::getNormalInvocationArguments( } if (triple.isOSWASI()) { - invocationArgStrs.insert(invocationArgStrs.end(), - {"-D_WASI_EMULATED_MMAN", - "-D_WASI_EMULATED_SIGNAL", - "-D_WASI_EMULATED_PROCESS_CLOCKS"}); SmallString<128> buffer; if (auto path = getWasiLibcModuleMapPath(searchPathOpts, triple, buffer)) { invocationArgStrs.push_back((Twine("-fmodule-map-file=") + *path).str()); From 5efd963e65e826c95d99b61a083673f8a71ee8fe Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 22 May 2023 15:52:48 +0000 Subject: [PATCH 2/2] [wasm] Enable wasi-libc emulation by default in SwiftWASILibc --- stdlib/public/Platform/SwiftWASILibc.h.gyb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/stdlib/public/Platform/SwiftWASILibc.h.gyb b/stdlib/public/Platform/SwiftWASILibc.h.gyb index 86fc25b24c833..c051627f2b7c0 100644 --- a/stdlib/public/Platform/SwiftWASILibc.h.gyb +++ b/stdlib/public/Platform/SwiftWASILibc.h.gyb @@ -105,6 +105,20 @@ headers = [ ] }% +// FIXME?(katei): +// Those emulations are now enabled by default to have compatibility +// with other platforms as much as possible without any extra modification. +// But we should consider moving them into their own submodules. +#ifndef _WASI_EMULATED_MMAN +# define _WASI_EMULATED_MMAN +#endif +#ifndef _WASI_EMULATED_SIGNAL +# define _WASI_EMULATED_SIGNAL +#endif +#ifndef _WASI_EMULATED_PROCESS_CLOCKS +# define _WASI_EMULATED_PROCESS_CLOCKS +#endif + % for header in headers: #if __has_include(<${header}>) #include <${header}>