* Remove support for `__original_main`.
This was used in old LLVM versions. Recent LLVM versions all emit either
`__main_void` or `__main_argv_argc`, so we can use those directly.
* Update the CI to use LLVM 14.0.0.
- 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
- 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
- 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
__log_data
__logf_data
__lseek
-__main_argc_argv
__main_void
__math_divzero
__math_divzerof
__ofl_unlock
__optpos
__optreset
-__original_main
__overflow
__p1evll
__pio2_hi
__imported_wasi_snapshot_preview1_sock_shutdown
__letf2
__lttf2
+__main_argc_argv
__netf2
__stack_pointer
__subtf3
__trunctfsf2
__unordtf2
__wasm_call_ctors
-main
#include <wasi/api.h>
#include <stdlib.h>
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) {
#include <wasi/api.h>
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")))
// 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();
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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();
-}