Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
Update llvm & wasi-libc
Browse files Browse the repository at this point in the history
Enable LTO
Add Asterius CI job
  • Loading branch information
TerrorJack committed Dec 2, 2020
1 parent 6ad31ed commit b368b8b
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 19 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/asterius.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Asterius

on:
- push
- pull_request

jobs:

build:
name: build
runs-on: ubuntu-20.04
steps:

- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: build
run: |
podman run \
--network host \
--pull always \
--rm \
--volume $(pwd):$(pwd) \
--workdir $(pwd) \
debian:sid-slim \
./asterius_build.sh
- name: upload-artifact
uses: actions/upload-artifact@v2
with:
name: dist-asterius
path: dist
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
url = https://github.com/llvm/llvm-project
[submodule "src/wasi-libc"]
path = src/wasi-libc
url = https://github.com/CraneStation/wasi-libc
url = https://github.com/TerrorJack/wasi-libc
[submodule "src/config"]
path = src/config
url = https://git.savannah.gnu.org/git/config.git
30 changes: 14 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,12 @@ build/llvm.BUILT:
-DCMAKE_INSTALL_PREFIX=$(PREFIX) \
-DLLVM_TARGETS_TO_BUILD=WebAssembly \
-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasi \
-DLLVM_ENABLE_PROJECTS="lld;clang;clang-tools-extra" \
-DLLVM_ENABLE_PROJECTS="lld;clang" \
-DDEFAULT_SYSROOT=$(PREFIX)/share/wasi-sysroot \
-DLLVM_INSTALL_BINUTILS_SYMLINKS=TRUE \
$(LLVM_PROJ_DIR)/llvm
DESTDIR=$(DESTDIR) ninja $(NINJA_FLAGS) -v -C build/llvm \
install-clang \
install-clang-format \
install-clang-tidy \
install-clang-apply-replacements \
install-lld \
install-llvm-ranlib \
install-llvm-strip \
Expand Down Expand Up @@ -99,16 +96,17 @@ build/compiler-rt.BUILT: build/llvm.BUILT
-DCMAKE_CXX_COMPILER_WORKS=ON \
-DCMAKE_AR=$(BUILD_PREFIX)/bin/ar \
-DCMAKE_MODULE_PATH=$(ROOT_DIR)/cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasi-sdk.cmake \
-DCOMPILER_RT_BAREMETAL_BUILD=On \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
-DCOMPILER_RT_HAS_FPIC_FLAG=OFF \
-DCOMPILER_RT_ENABLE_IOS=OFF \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=On \
-DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=OFF \
-DWASI_SDK_PREFIX=$(BUILD_PREFIX) \
-DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DCMAKE_C_FLAGS="-Oz -flto $(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \
-DCOMPILER_RT_OS_DIR=wasi \
-DCMAKE_INSTALL_PREFIX=$(PREFIX)/lib/clang/$(CLANG_VERSION)/ \
Expand All @@ -129,12 +127,12 @@ LIBCXX_CMAKE_FLAGS = \
-DCMAKE_STAGING_PREFIX=$(PREFIX)/share/wasi-sysroot \
-DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DLIBCXX_ENABLE_THREADS:BOOL=OFF \
-DLIBCXX_HAS_PTHREAD_API:BOOL=OFF \
-DLIBCXX_ENABLE_THREADS:BOOL=ON \
-DLIBCXX_HAS_PTHREAD_API:BOOL=ON \
-DLIBCXX_HAS_EXTERNAL_THREAD_API:BOOL=OFF \
-DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \
-DLIBCXX_HAS_WIN32_THREAD_API:BOOL=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DLIBCXX_ENABLE_SHARED:BOOL=OFF \
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY:BOOL=OFF \
-DLIBCXX_ENABLE_EXCEPTIONS:BOOL=OFF \
Expand All @@ -150,8 +148,8 @@ build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/wasi-libc.BUI
# Do the build.
mkdir -p build/libcxx
cd build/libcxx && cmake -G Ninja $(LIBCXX_CMAKE_FLAGS) \
-DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DCMAKE_C_FLAGS="-Oz -flto $(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DCMAKE_CXX_FLAGS="-Oz -flto $(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DLIBCXX_LIBDIR_SUFFIX=$(ESCAPE_SLASH)/wasm32-wasi \
$(LLVM_PROJ_DIR)/libcxx
ninja $(NINJA_FLAGS) -v -C build/libcxx
Expand All @@ -169,15 +167,15 @@ LIBCXXABI_CMAKE_FLAGS = \
-DLIBCXXABI_ENABLE_EXCEPTIONS:BOOL=OFF \
-DLIBCXXABI_ENABLE_SHARED:BOOL=OFF \
-DLIBCXXABI_SILENT_TERMINATE:BOOL=ON \
-DLIBCXXABI_ENABLE_THREADS:BOOL=OFF \
-DLIBCXXABI_HAS_PTHREAD_API:BOOL=OFF \
-DLIBCXXABI_ENABLE_THREADS:BOOL=ON \
-DLIBCXXABI_HAS_PTHREAD_API:BOOL=ON \
-DLIBCXXABI_HAS_EXTERNAL_THREAD_API:BOOL=OFF \
-DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \
-DLIBCXXABI_HAS_WIN32_THREAD_API:BOOL=OFF \
-DLIBCXXABI_ENABLE_PIC:BOOL=OFF \
-DCXX_SUPPORTS_CXX11=ON \
-DLLVM_COMPILER_CHECKED=ON \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DLIBCXXABI_LIBCXX_PATH=$(LLVM_PROJ_DIR)/libcxx \
-DLIBCXXABI_LIBCXX_INCLUDES=$(BUILD_PREFIX)/share/wasi-sysroot/include/c++/v1 \
-DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \
Expand All @@ -191,8 +189,8 @@ build/libcxxabi.BUILT: build/libcxx.BUILT build/llvm.BUILT
# Do the build.
mkdir -p build/libcxxabi
cd build/libcxxabi && cmake -G Ninja $(LIBCXXABI_CMAKE_FLAGS) \
-DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DCMAKE_C_FLAGS="-Oz -flto $(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DCMAKE_CXX_FLAGS="-Oz -flto $(DEBUG_PREFIX_MAP) --sysroot=$(BUILD_PREFIX)/share/wasi-sysroot" \
-DLIBCXXABI_LIBDIR_SUFFIX=$(ESCAPE_SLASH)/wasm32-wasi \
$(LLVM_PROJ_DIR)/libcxxabi
ninja $(NINJA_FLAGS) -v -C build/libcxxabi
Expand Down
14 changes: 14 additions & 0 deletions asterius_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -euo pipefail

apt update
apt full-upgrade -y
apt install -y \
build-essential \
cmake \
git \
ninja-build \
python3

make package
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 23679 files
2 changes: 1 addition & 1 deletion src/wasi-libc

0 comments on commit b368b8b

Please sign in to comment.