Disable undesired attempts at opening file descriptors

When building for a web target, there is no stderr. However, the abort
implementation in the current CXXABI runtime is implemented with writes
to stderr.

Since the constructors for default objects call abort,
these are rightfully not optimised out from the compiler. However, it is
hardly sensible in my opinion to have to include a whole WASI runtime
implementation in the browser just to handle more informative aborts by default.

To prevent this, compile the cxxabi runtime with NDEBUG and CXXABI_BAREMETAL
flags.

This is not enough though, as the compiler will still try to instantiate
__libcpp_verbose_abort from the stdcxx library. To prevent the compiler
from instantiating __libcpp_verbose_abort, clean fix for this is to consistently
set _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT=0 in the __availability header.
This requires forking or patching LLVM.
pull/418/head
InfiniteSnow 1 year ago
parent af429ed157
commit 564d239939

@ -185,6 +185,7 @@ build/compiler-rt.BUILT: build/llvm.BUILT
# $(3): the name of the target being built for
# $(4): extra compiler flags to pass
LIBCXX_CMAKE_FLAGS = \
-DNDEBUG=1 \
-DCMAKE_C_COMPILER_WORKS=ON \
-DCMAKE_CXX_COMPILER_WORKS=ON \
-DCMAKE_AR=$(BUILD_PREFIX)/bin/ar \
@ -205,7 +206,8 @@ LIBCXX_CMAKE_FLAGS = \
-DLIBCXX_ENABLE_SHARED:BOOL=$(2) \
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY:BOOL=OFF \
-DLIBCXX_ENABLE_EXCEPTIONS:BOOL=OFF \
-DLIBCXX_ENABLE_FILESYSTEM:BOOL=ON \
-DLIBCXX_ENABLE_FILESYSTEM:BOOL=OFF \
-DLIBCXXABI_BAREMETAL=1\
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL=OFF \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=$(LLVM_PROJ_DIR)/libcxxabi/include \

Loading…
Cancel
Save