Skip to content

rewriter: support the 6 x86 param regs for post condition functions #1666

rewriter: support the 6 x86 param regs for post condition functions

rewriter: support the 6 x86 param regs for post condition functions #1666

Workflow file for this run

name: CI
on:
push:
branches:
- main
- github-actions*
pull_request:
jobs:
test-on-pkru-enabled-host:
runs-on: self-hosted
continue-on-error: ${{ matrix.ia2-tracer == 'ON' }}
strategy:
fail-fast: true
matrix:
build-type: [Release, Debug]
c_compiler: [clang, gcc]
linker: [lld, bfd]
ia2-debug: [ON, OFF]
ia2-tracer: [ON, OFF]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build
run: |
LLVM_DIR=`llvm-config --cmakedir`
Clang_DIR=`realpath $LLVM_DIR/../clang`
rm -rf build
mkdir build
pushd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_FLAGS="-fuse-ld=${{ matrix.linker }}" \
-DClang_DIR=$Clang_DIR \
-DLLVM_DIR=$LLVM_DIR \
-DLLVM_EXTERNAL_LIT=$HOME/.local/bin/lit \
-DIA2_DEBUG=${{ matrix.ia2-debug }} \
-DIA2_TRACER=${{ matrix.ia2-tracer }} \
-G Ninja
ninja
popd
- name: Check
run: |
pushd build
ninja -v check
popd
build-nginx:
runs-on: self-hosted
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build nginx
run: |
LLVM_DIR=`llvm-config --cmakedir`
Clang_DIR=`realpath $LLVM_DIR/../clang`
pushd external/nginx
IA2_CMAKE_FLAGS="
-DCMAKE_BUILD_TYPE=Release
-DClang_DIR=$Clang_DIR
-DLLVM_DIR=$LLVM_DIR" \
./reconfigure
pushd build/nginx
make
popd
popd
aarch64-wip-test:
runs-on: ubuntu-latest
steps:
- name: Install dep packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: |
gcc-aarch64-linux-gnu
g++-aarch64-linux-gnu
libc6-arm64-cross
libc6-dev-arm64-cross
clang-15
pkg-config
cmake
ninja-build
llvm-15-dev
libclang-15-dev
zlib1g-dev
libcapstone-dev
version: 1.0 # version of cache to load
- name: Check out code
uses: actions/checkout@v4
- name: Cache built QEMU
id: cache-qemu
uses: actions/cache@v4
with:
path: qemu/build
key: ${{ runner.os }}-qemu
- name: Check out QEMU
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: immunant/qemu
path: ${{ github.workspace }}/qemu
- name: Build QEMU
if: steps.cache-qemu.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}/qemu
run: ./build.sh
- name: Cache built Clang
id: cache-clang
uses: actions/cache@v4
with:
path: |
llvm-project/build/bin
llvm-project/build/lib/clang
key: ${{ runner.os }}-clang-2
- name: Cache built runtime libraries
id: cache-rtlibs
uses: actions/cache@v4
with:
path: |
build-rtlibs/compiler-rt/lib/linux
build-rtlibs/lib
build-rtlibs/include
key: ${{ runner.os }}-rtlibs
# cloning llvm is required if we need to build rtlibs, but the cached clang would already be in the directory that git wants to create
- name: Move cached clang out of the way of git clone
if: steps.cache-clang.outputs.cache-hit == 'true' && steps.cache-rtlibs.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
mv llvm-project llvm-project-built
# if we need to build either clang or rtlibs, clone our LLVM fork
- name: Check out LLVM
if: steps.cache-clang.outputs.cache-hit != 'true' || steps.cache-rtlibs.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: immunant/llvm-project
ref: fw/instrument-llvm-ir
path: ${{ github.workspace }}/llvm-project
- name: Build Clang
if: steps.cache-clang.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}/llvm-project
run: |
# first free up space used by unnecessary host tool cache to make room to build clang
df -h /
cd /opt
find . -maxdepth 1 -mindepth 1 '!' -path ./containerd '!' -path ./actionarchivecache \
'!' -path ./runner '!' -path ./runner-cache -exec rm -rf '{}' ';'
df -h /
cd -
./build.sh
# free up space used by libs; our desired clang binary statically links them
rm -rf build/lib/*.a
# if clang was cached, move it into the git tree to the same location as it would be built
- name: Move cached Clang
if: steps.cache-clang.outputs.cache-hit == 'true' && steps.cache-rtlibs.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
mkdir -p llvm-project
mv llvm-project-built/* llvm-project/
- name: Build runtime libraries
if: steps.cache-rtlibs.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}/llvm-project
run: |
./cross-build-rtlibs.sh
mv build-rtlibs ../
# move rtlibs into the git tree to where IA2 build expects them
- name: Move cached runtime libraries
working-directory: ${{ github.workspace }}/llvm-project
run: |
mv ../build-rtlibs ./
- name: Test ARM build
run: |
LLVM_DIR=`llvm-config-15 --cmakedir`
Clang_DIR=`realpath $LLVM_DIR/../clang`
mkdir build
pushd build
rtlibs_dir="$(pwd)/../llvm-project/build-rtlibs"
cross_link_flags="-B${rtlibs_dir}/compiler-rt/lib/linux -L${rtlibs_dir}/lib \
--rtlib=compiler-rt --unwindlib=libunwind"
cross_flags="-isystem /usr/aarch64-linux-gnu/include --gcc-toolchain=/usr \
-march=armv8.5-a+memtag -ffixed-x18 --rtlib=compiler-rt --stdlib=libc++ \
-I${rtlibs_dir}/include/c++/v1"
export LDFLAGS="-L/usr/aarch64-linux-gnu/lib"
cmake .. \
-DCMAKE_CROSSCOMPILING_EMULATOR=${{ github.workspace }}/qemu/build/qemu-aarch64 \
-DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64-toolchain.cmake \
-DCMAKE_C_COMPILER=`pwd`/../llvm-project/build/bin/clang-19 \
-DCMAKE_CXX_COMPILER=`pwd`/../llvm-project/build/bin/clang-19 \
-DCMAKE_OBJCOPY=/usr/bin/llvm-objcopy-15 \
-DCMAKE_C_FLAGS="$cross_flags" \
-DCMAKE_CXX_FLAGS="$cross_flags" \
-DCMAKE_EXE_LINKER_FLAGS="$cross_link_flags -lm -Wl,-rpath-link,${rtlibs_dir}/lib" \
-DCMAKE_SHARED_LINKER_FLAGS="$cross_link_flags -Wl,-rpath,${rtlibs_dir}/lib" \
-DClang_DIR=$Clang_DIR \
-DCLANG_EXE=`which clang-15` \
-DLLVM_DIR=$LLVM_DIR \
-G Ninja
ninja -v check
popd