mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
5c802c5d6b
Submitted upstream at https://github.com/WebAssembly/wasi-libc/pull/512 Differential Revision: https://phabricator.services.mozilla.com/D216243
86 lines
4.0 KiB
Diff
86 lines
4.0 KiB
Diff
diff --git a/llvm_version_major.sh b/llvm_version_major.sh
|
|
index 2e5d973..93fe9b0 100755
|
|
--- a/llvm_version_major.sh
|
|
+++ b/llvm_version_major.sh
|
|
@@ -1,4 +1,4 @@
|
|
#/bin/bash
|
|
LLVM_PROJ_DIR=${1:-./src/llvm-project}
|
|
-MAJOR=`grep "set(LLVM_VERSION_MAJOR" $LLVM_PROJ_DIR/llvm/CMakeLists.txt | awk '{print substr($2, 1, length($2) - 1)}'`
|
|
+MAJOR=`(grep "set(LLVM_VERSION_MAJOR" $LLVM_PROJ_DIR/llvm/CMakeLists.txt || grep "set(LLVM_VERSION_MAJOR" $LLVM_PROJ_DIR/cmake/Modules/LLVMVersion.cmake) | awk '{print substr($2, 1, length($2) - 1)}'`
|
|
echo $MAJOR
|
|
diff --git a/Makefile b/Makefile
|
|
index d2ccff6..95f395b 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -178,6 +178,7 @@ LIBCXX_CMAKE_FLAGS = \
|
|
-DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \
|
|
-DLIBCXXABI_HAS_WIN32_THREAD_API:BOOL=OFF \
|
|
-DLIBCXXABI_ENABLE_PIC:BOOL=OFF \
|
|
+ -DLIBCXXABI_USE_LLVM_UNWINDER:BOOL=OFF \
|
|
-DWASI_SDK_PREFIX=$(BUILD_PREFIX) \
|
|
-DUNIX:BOOL=ON \
|
|
--debug-trycompile
|
|
diff --git a/src/wasi-libc/Makefile b/src/wasi-libc/Makefile
|
|
index f350ecb..3b73115 100644
|
|
--- a/src/wasi-libc/Makefile
|
|
+++ b/src/wasi-libc/Makefile
|
|
@@ -305,7 +305,7 @@ ASMFLAGS += --target=$(TARGET_TRIPLE)
|
|
# TODO: Add -fno-signaling-nans when the compiler supports it.
|
|
CFLAGS += -fno-trapping-math
|
|
# Add all warnings, but disable a few which occur in third-party code.
|
|
-CFLAGS += -Wall -Wextra -Werror \
|
|
+CFLAGS += -Wall -Wextra \
|
|
-Wno-null-pointer-arithmetic \
|
|
-Wno-unused-parameter \
|
|
-Wno-sign-compare \
|
|
@@ -639,7 +639,7 @@ check-symbols: startup_files libc
|
|
for undef_sym in $$("$(NM)" --undefined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libc-*.a "$(SYSROOT_LIB)"/*.o \
|
|
|grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \
|
|
grep -q '\<'$$undef_sym'\>' "$(DEFINED_SYMBOLS)" || echo $$undef_sym; \
|
|
- done | grep -v "^__mul" > "$(UNDEFINED_SYMBOLS)"
|
|
+ done | grep -E -v "^__mul|__indirect_function_table" > "$(UNDEFINED_SYMBOLS)"
|
|
grep '^_*imported_wasi_' "$(UNDEFINED_SYMBOLS)" \
|
|
> "$(SYSROOT_LIB)/libc.imports"
|
|
|
|
@@ -671,10 +671,18 @@ check-symbols: startup_files libc
|
|
@#
|
|
@# TODO: Filter out __NO_MATH_ERRNO_ and a few __*WIDTH__ that are new to clang 14.
|
|
@# TODO: Filter out __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* that are new to clang 16.
|
|
+ @# TODO: Filter out __FPCLASS_* that are new to clang 17.
|
|
+ @# TODO: Filter out __FLT128_* that are new to clang 18.
|
|
+ @# TODO: Filter out __MEMORY_SCOPE_* that are new to clang 18.
|
|
+ @# TODO: Filter out __GCC_(CON|DE)STRUCTIVE_SIZE that are new to clang 19.
|
|
+ @# TODO: Filter out __STDC_EMBED_* that are new to clang 19.
|
|
+ @# TODO: Filter out __*_NORM_MAX__ that are new to clang 19.
|
|
@# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it
|
|
@# for older versions.
|
|
@# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to
|
|
@# clang 16 for -mcpu=generic.
|
|
+ @# TODO: Undefine __wasm_multivalue__ and __wasm_reference_types__, that are new to
|
|
+ @# clang 19 for -mcpu=generic.
|
|
@# TODO: As of clang 16, __GNUC_VA_LIST is #defined without a value.
|
|
$(CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \
|
|
-isystem $(SYSROOT_INC) \
|
|
@@ -691,6 +698,8 @@ check-symbols: startup_files libc
|
|
-U__clang_wide_literal_encoding__ \
|
|
-U__wasm_mutable_globals__ \
|
|
-U__wasm_sign_ext__ \
|
|
+ -U__wasm_multivalue__ \
|
|
+ -U__wasm_reference_types__ \
|
|
-U__GNUC__ \
|
|
-U__GNUC_MINOR__ \
|
|
-U__GNUC_PATCHLEVEL__ \
|
|
@@ -702,6 +712,12 @@ check-symbols: startup_files libc
|
|
| sed -e 's/__GNUC_VA_LIST $$/__GNUC_VA_LIST 1/' \
|
|
| grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \
|
|
| grep -v '^#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_\(1\|2\|4\|8\)' \
|
|
+ | grep -v '^#define __FPCLASS_' \
|
|
+ | grep -v '^#define __FLT128_' \
|
|
+ | grep -v '^#define __MEMORY_SCOPE_' \
|
|
+ | grep -v '^#define __GCC_\(CON\|DE\)STRUCTIVE_SIZE' \
|
|
+ | grep -v '^#define __STDC_EMBED_' \
|
|
+ | grep -v '^#define __\(DBL\|FLT\|LDBL\)_NORM_MAX__' \
|
|
> "$(SYSROOT_SHARE)/predefined-macros.txt"
|
|
|
|
# Check that the computed metadata matches the expected metadata.
|