Skip to content

Commit 3a261b0

Browse files
authored
Adjust Makefile for LLVM trunk (16) as of 2022-11-08 (#344)
llvm/llvm-project@1e4e243 enabled sign-ext and mutable-globals by default, which adds corresponding __wasm_-prefixed #defines. llvm/llvm-project@9e95699 changed the definition of __GNUC_VA_LIST to match that of GCC headers, leaving it without a value.
1 parent 8b7148f commit 3a261b0

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ check-symbols: startup_files libc
650650
@# TODO: Filter out __NO_MATH_ERRNO_ and a few __*WIDTH__ that are new to clang 14.
651651
@# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it
652652
@# for older versions.
653+
@# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to
654+
@# clang 16 for -mcpu=generic.
655+
@# TODO: As of clang 16, __GNUC_VA_LIST is #defined without a value.
653656
$(CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \
654657
-isystem $(SYSROOT_INC) \
655658
-std=gnu17 \
@@ -663,6 +666,8 @@ check-symbols: startup_files libc
663666
-U__clang_version__ \
664667
-U__clang_literal_encoding__ \
665668
-U__clang_wide_literal_encoding__ \
669+
-U__wasm_mutable_globals__ \
670+
-U__wasm_sign_ext__ \
666671
-U__GNUC__ \
667672
-U__GNUC_MINOR__ \
668673
-U__GNUC_PATCHLEVEL__ \
@@ -672,6 +677,7 @@ check-symbols: startup_files libc
672677
-U__BITINT_MAXWIDTH__ \
673678
-U__FLT_EVAL_METHOD__ -Wno-builtin-macro-redefined \
674679
| sed -e 's/__[[:upper:][:digit:]]*_ATOMIC_\([[:upper:][:digit:]_]*\)_LOCK_FREE/__compiler_ATOMIC_\1_LOCK_FREE/' \
680+
| sed -e 's/__GNUC_VA_LIST $$/__GNUC_VA_LIST 1/' \
675681
| grep -v '^#define __FLT16_' \
676682
| grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \
677683
> "$(SYSROOT_SHARE)/predefined-macros.txt"

expected/wasm32-wasi/posix/predefined-macros.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,8 +3099,6 @@
30993099
#define __wasm__ 1
31003100
#define __wasm_atomics__ 1
31013101
#define __wasm_bulk_memory__ 1
3102-
#define __wasm_mutable_globals__ 1
3103-
#define __wasm_sign_ext__ 1
31043102
#define _tolower(a) ((a)|0x20)
31053103
#define _toupper(a) ((a)&0x5f)
31063104
#define acos(x) __tg_real_complex(acos, (x))

0 commit comments

Comments
 (0)