authorgravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2021-06-15 09:28:19+09:00
committergravatar for takeshi@tetrate.ioTakeshi Yoneda <takeshi@tetrate.io> 2021-06-15 09:28:19+09:00
log1795472eb71a52d37d73dcf4cac82af44f6ddc3c
treeffa609cdfa71c2eaabcae497aab40497cf8b858e
parentbc64664a0cb3dab4374e1053fb765872765f848c

cleanup, and disable threading completely.

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

1 files changed, 9 insertions(+), 12 deletions(-)

src/libcxx.zig+9-12
...@@ -139,9 +139,8 @@ pub fn buildLibCXX(comp: *Compilation) !void {...@@ -139,9 +139,8 @@ pub fn buildLibCXX(comp: *Compilation) !void {
139 }139 }
140140
141 if (target.os.tag == .wasi) {141 if (target.os.tag == .wasi) {
142 try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");142 // WASI doesn't support thread yet.
143 try cflags.append("-D_LIBCPP_HAS_NO_THREADS");143 try cflags.append("-D_LIBCPP_HAS_NO_THREADS");
144 try cflags.append("-D_LIBCPP_ABI_VERSION=2");
145 try cflags.append("-fno-exceptions");144 try cflags.append("-fno-exceptions");
146 }145 }
147146
...@@ -253,29 +252,27 @@ pub fn buildLibCXXABI(comp: *Compilation) !void {...@@ -253,29 +252,27 @@ pub fn buildLibCXXABI(comp: *Compilation) !void {
253 var cflags = std.ArrayList([]const u8).init(arena);252 var cflags = std.ArrayList([]const u8).init(arena);
254253
255 if (target.os.tag == .wasi) {254 if (target.os.tag == .wasi) {
256 if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_thread_atexit.cpp"))255 // WASI doesn't support thread yet.
257 continue;256 if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_thread_atexit.cpp") or
258257 std.mem.startsWith(u8, cxxabi_src, "src/cxa_exception.cpp") or
259 if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_exception.cpp"))258 std.mem.startsWith(u8, cxxabi_src, "src/cxa_personality.cpp"))
260 continue;259 continue;
261260 try cflags.append("-D_LIBCXXABI_HAS_NO_THREADS");
262 if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_personality.cpp"))261 // Also, exception is not supported yet.
263 continue;
264
265 try cflags.append("-fno-exceptions");262 try cflags.append("-fno-exceptions");
266 } else {263 } else {
267 try cflags.append("-DHAVE___CXA_THREAD_ATEXIT_IMPL");264 try cflags.append("-DHAVE___CXA_THREAD_ATEXIT_IMPL");
268 try cflags.append("-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS");
269 }265 }
270266
271 try cflags.append("-D_LIBCPP_DISABLE_EXTERN_TEMPLATE");267 try cflags.append("-D_LIBCPP_DISABLE_EXTERN_TEMPLATE");
268 try cflags.append("-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS");
272 try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY");269 try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY");
273 try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");270 try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");
274 try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");271 try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
275 try cflags.append("-fvisibility=hidden");272 try cflags.append("-fvisibility=hidden");
276 try cflags.append("-fvisibility-inlines-hidden");273 try cflags.append("-fvisibility-inlines-hidden");
277274
278 if (target.abi.isMusl() or target.os.tag == .wasi) {275 if (target.abi.isMusl()) {
279 try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");276 try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");
280 }277 }
281278