diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2fdc5d591..83d3aa5d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,8 +16,8 @@ jobs: - name: Install LLVM tools (Windows) shell: bash run: | - curl -fsSLO https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe - 7z x LLVM-10.0.0-win64.exe -y -o"llvm" + curl -fsSLO https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/LLVM-14.0.0-win64.exe + 7z x LLVM-14.0.0-win64.exe -y -o"llvm" echo "$(pwd)/llvm/bin" >> $GITHUB_PATH echo "CC=$(pwd)/llvm/bin/clang.exe" >> $GITHUB_ENV echo "AR=$(pwd)/llvm/bin/llvm-ar.exe" >> $GITHUB_ENV @@ -35,8 +35,8 @@ jobs: - name: Install LLVM tools (MacOS) shell: bash run: | - curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz | tar xJf - - export CLANG_DIR=`pwd`/clang+llvm-10.0.0-x86_64-apple-darwin/bin + curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-apple-darwin.tar.xz | tar xJf - + export CLANG_DIR=`pwd`/clang+llvm-14.0.0-x86_64-apple-darwin/bin echo "$CLANG_DIR" >> $GITHUB_PATH echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV @@ -46,8 +46,8 @@ jobs: - name: Install LLVM tools (Linux) shell: bash run: | - curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz | tar xJf - - export CLANG_DIR=`pwd`/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin + curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz | tar xJf - + export CLANG_DIR=`pwd`/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04/bin echo "$CLANG_DIR" >> $GITHUB_PATH echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV diff --git a/expected/wasm32-wasi/defined-symbols.txt b/expected/wasm32-wasi/defined-symbols.txt index ba995bae2..69242c75d 100644 --- a/expected/wasm32-wasi/defined-symbols.txt +++ b/expected/wasm32-wasi/defined-symbols.txt @@ -146,7 +146,6 @@ __log2f_data __log_data __logf_data __lseek -__main_argc_argv __main_void __math_divzero __math_divzerof @@ -170,7 +169,6 @@ __ofl_lock __ofl_unlock __optpos __optreset -__original_main __overflow __p1evll __pio2_hi diff --git a/expected/wasm32-wasi/undefined-symbols.txt b/expected/wasm32-wasi/undefined-symbols.txt index 7a659e776..b9cdb3432 100644 --- a/expected/wasm32-wasi/undefined-symbols.txt +++ b/expected/wasm32-wasi/undefined-symbols.txt @@ -58,6 +58,7 @@ __imported_wasi_snapshot_preview1_sock_send __imported_wasi_snapshot_preview1_sock_shutdown __letf2 __lttf2 +__main_argc_argv __netf2 __stack_pointer __subtf3 @@ -65,4 +66,3 @@ __trunctfdf2 __trunctfsf2 __unordtf2 __wasm_call_ctors -main diff --git a/libc-bottom-half/crt/crt1-command.c b/libc-bottom-half/crt/crt1-command.c index 93279fbed..706ab97e6 100644 --- a/libc-bottom-half/crt/crt1-command.c +++ b/libc-bottom-half/crt/crt1-command.c @@ -1,15 +1,15 @@ #include #include extern void __wasm_call_ctors(void); -extern int __original_main(void); +extern int __main_void(void); extern void __wasm_call_dtors(void); __attribute__((export_name("_start"))) void _start(void) { - // Call `__original_main` which will either be the application's zero-argument - // `__original_main` function or a libc routine which calls `__main_void`. - // TODO: Call `main` directly once we no longer have to support old compilers. - int r = __original_main(); + // Call `__main_void` which will either be the application's zero-argument + // `__main_void` function or a libc routine which obtains the command-line + // arguments and calls `__main_argv_argc`. + int r = __main_void(); // If main exited successfully, just return, otherwise call `exit`. if (r != 0) { diff --git a/libc-bottom-half/crt/crt1.c b/libc-bottom-half/crt/crt1.c index 5e164dddb..b3906dc5f 100644 --- a/libc-bottom-half/crt/crt1.c +++ b/libc-bottom-half/crt/crt1.c @@ -1,6 +1,6 @@ #include extern void __wasm_call_ctors(void); -extern int __original_main(void); +extern int __main_void(void); extern void __wasm_call_dtors(void); __attribute__((export_name("_start"))) @@ -8,10 +8,10 @@ void _start(void) { // The linker synthesizes this to call constructors. __wasm_call_ctors(); - // Call `__original_main` which will either be the application's zero-argument - // `__original_main` function or a libc routine which calls `__main_void`. - // TODO: Call `main` directly once we no longer have to support old compilers. - int r = __original_main(); + // Call `__main_void` which will either be the application's zero-argument + // `__main_void` function or a libc routine which obtains the command-line + // arguments and calls `__main_argv_argc`. + int r = __main_void(); // Call atexit functions, destructors, stdio cleanup, etc. __wasm_call_dtors(); diff --git a/libc-bottom-half/sources/__main_argc_argv.c b/libc-bottom-half/sources/__main_argc_argv.c deleted file mode 100644 index decaa2d1e..000000000 --- a/libc-bottom-half/sources/__main_argc_argv.c +++ /dev/null @@ -1,10 +0,0 @@ -// New compilers define `__main_argc_argv`. If that doesn't exist, we -// may get called here. Old compilers define `main` expecting an -// argv/argc, so call that. -// TODO: Remove this layer when we no longer have to support old compilers. -int __wasilibc_main(int argc, char *argv[]) asm("main"); - -__attribute__((weak, nodebug)) -int __main_argc_argv(int argc, char *argv[]) { - return __wasilibc_main(argc, argv); -} diff --git a/libc-bottom-half/sources/__original_main.c b/libc-bottom-half/sources/__original_main.c deleted file mode 100644 index 73564d46f..000000000 --- a/libc-bottom-half/sources/__original_main.c +++ /dev/null @@ -1,10 +0,0 @@ -// Old compilers define `__original_main`. If that doesn't exist, we -// get called here. New compilers define `__main_void`. If that doesn't -// exist, we'll try something else. -// TODO: Remove this layer when we no longer have to support old compilers. -int __main_void(void); - -__attribute__((weak)) -int __original_main(void) { - return __main_void(); -}