tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

wasi-sdk.patch (4542B)


      1 diff --git a/llvm_version_major.sh b/llvm_version_major.sh
      2 index 2e5d973..93fe9b0 100755
      3 --- a/llvm_version_major.sh
      4 +++ b/llvm_version_major.sh
      5 @@ -1,4 +1,4 @@
      6 #/bin/bash
      7 LLVM_PROJ_DIR=${1:-./src/llvm-project}
      8 -MAJOR=`grep "set(LLVM_VERSION_MAJOR" $LLVM_PROJ_DIR/llvm/CMakeLists.txt | awk '{print substr($2, 1, length($2) - 1)}'`
      9 +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)}'`
     10 echo $MAJOR
     11 diff --git a/Makefile b/Makefile
     12 index d2ccff6..95f395b 100644
     13 --- a/Makefile
     14 +++ b/Makefile
     15 @@ -178,6 +178,7 @@ LIBCXX_CMAKE_FLAGS = \
     16     -DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \
     17     -DLIBCXXABI_HAS_WIN32_THREAD_API:BOOL=OFF \
     18     -DLIBCXXABI_ENABLE_PIC:BOOL=OFF \
     19 +    -DLIBCXXABI_USE_LLVM_UNWINDER:BOOL=OFF \
     20     -DWASI_SDK_PREFIX=$(BUILD_PREFIX) \
     21     -DUNIX:BOOL=ON \
     22     --debug-trycompile
     23 diff --git a/src/wasi-libc/Makefile b/src/wasi-libc/Makefile
     24 index f350ecb..3b73115 100644
     25 --- a/src/wasi-libc/Makefile
     26 +++ b/src/wasi-libc/Makefile
     27 @@ -305,7 +305,7 @@ ASMFLAGS += --target=$(TARGET_TRIPLE)
     28 # TODO: Add -fno-signaling-nans when the compiler supports it.
     29 CFLAGS += -fno-trapping-math
     30 # Add all warnings, but disable a few which occur in third-party code.
     31 -CFLAGS += -Wall -Wextra -Werror \
     32 +CFLAGS += -Wall -Wextra \
     33   -Wno-null-pointer-arithmetic \
     34   -Wno-unused-parameter \
     35   -Wno-sign-compare \
     36 @@ -639,7 +639,7 @@ check-symbols: startup_files libc
     37 	for undef_sym in $$("$(NM)" --undefined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libc-*.a "$(SYSROOT_LIB)"/*.o \
     38 	    |grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \
     39 	    grep -q '\<'$$undef_sym'\>' "$(DEFINED_SYMBOLS)" || echo $$undef_sym; \
     40 -	done | grep -v "^__mul" > "$(UNDEFINED_SYMBOLS)"
     41 +	done | grep -E -v "^__mul|__indirect_function_table" > "$(UNDEFINED_SYMBOLS)"
     42 	grep '^_*imported_wasi_' "$(UNDEFINED_SYMBOLS)" \
     43 	    > "$(SYSROOT_LIB)/libc.imports"
     44 
     45 @@ -671,10 +671,21 @@ check-symbols: startup_files libc
     46 	@#
     47 	@# TODO: Filter out __NO_MATH_ERRNO_ and a few __*WIDTH__ that are new to clang 14.
     48 	@# TODO: Filter out __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* that are new to clang 16.
     49 +	@# TODO: Filter out __FPCLASS_* that are new to clang 17.
     50 +	@# TODO: Filter out __FLT128_* that are new to clang 18.
     51 +	@# TODO: Filter out __MEMORY_SCOPE_* that are new to clang 18.
     52 +	@# TODO: Filter out __GCC_(CON|DE)STRUCTIVE_SIZE that are new to clang 19.
     53 +	@# TODO: Filter out __STDC_EMBED_* that are new to clang 19.
     54 +	@# TODO: Filter out __*_NORM_MAX__ that are new to clang 19.
     55 +	@# TODO: Filter out __*INT*_C() that are new to clang 20.
     56 	@# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it
     57 	@# for older versions.
     58 	@# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to
     59 	@# clang 16 for -mcpu=generic.
     60 +	@# TODO: Undefine __wasm_multivalue__ and __wasm_reference_types__, that are new to
     61 +	@# clang 19 for -mcpu=generic.
     62 +	@# TODO: Undefine __wasm_nontrapping_fptoint__, __wasm_bulk_memory__ and
     63 +	@# __wasm_bulk_memory_opt__, that are new to clang 20.
     64 	@# TODO: As of clang 16, __GNUC_VA_LIST is #defined without a value.
     65 	$(CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \
     66 	    -isystem $(SYSROOT_INC) \
     67 @@ -691,6 +701,11 @@ check-symbols: startup_files libc
     68 	    -U__clang_wide_literal_encoding__ \
     69 	    -U__wasm_mutable_globals__ \
     70 	    -U__wasm_sign_ext__ \
     71 +	    -U__wasm_multivalue__ \
     72 +	    -U__wasm_reference_types__ \
     73 +	    -U__wasm_nontrapping_fptoint__ \
     74 +	    $(if $(filter-out wasm32-wasi-threads,$(TARGET_TRIPLE)),-U__wasm_bulk_memory__) \
     75 +	    -U__wasm_bulk_memory_opt__ \
     76 	    -U__GNUC__ \
     77 	    -U__GNUC_MINOR__ \
     78 	    -U__GNUC_PATCHLEVEL__ \
     79 @@ -702,6 +717,13 @@ check-symbols: startup_files libc
     80 	    | sed -e 's/__GNUC_VA_LIST $$/__GNUC_VA_LIST 1/' \
     81 	    | grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \
     82 	    | grep -v '^#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_\(1\|2\|4\|8\)' \
     83 +	    | grep -v '^#define __FPCLASS_' \
     84 +	    | grep -v '^#define __FLT128_' \
     85 +	    | grep -v '^#define __MEMORY_SCOPE_' \
     86 +	    | grep -v '^#define __GCC_\(CON\|DE\)STRUCTIVE_SIZE' \
     87 +	    | grep -v '^#define __STDC_EMBED_' \
     88 +	    | grep -v '^#define __\(DBL\|FLT\|LDBL\)_NORM_MAX__' \
     89 +	    | grep -v '^#define __U\?INT.*_C(' \
     90 	    > "$(SYSROOT_SHARE)/predefined-macros.txt"
     91 
     92 	# Check that the computed metadata matches the expected metadata.