Skip to content

Commit 4b4acd4

Browse files
committed
Adds Sanitizer MLIR 20 Builds
Enable RTTI for undefined sanitizer builds
1 parent 3c05531 commit 4b4acd4

File tree

5 files changed

+34
-220
lines changed

5 files changed

+34
-220
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -7,109 +7,36 @@ on:
77

88
jobs:
99
build-x64-linux:
10-
timeout-minutes: 360
11-
env:
12-
VCPKG_DEP_LIST: x64-linux
13-
VCPKG_FEATURE_FLAGS: -binarycaching
14-
runs-on: [self-hosted, linux, X64, dep-builder]
10+
runs-on: [self-hosted, linux, '${{matrix.arch}}', dep-builder]
1511
strategy:
1612
fail-fast: false
1713
matrix:
18-
osversion: [ubuntu-22.04]
19-
stdlib: [libc++, stdlibc++]
20-
sanitizer: [null, 'Address', 'Thread', 'Undefined']
14+
arch: ['x64', 'arm64']
15+
stdlib: ['libcxx', 'libstdcxx']
16+
sanitizer: ['none', 'address', 'thread', 'undefined']
2117
steps:
2218
- uses: AutoModality/action-clean@v1
2319
- uses: actions/checkout@v2
2420
with:
2521
submodules: 'recursive'
26-
- name: Set output vars to the actual tag name
27-
id: vars
28-
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
29-
- name: Build Docker
30-
id: builddocker
31-
working-directory: ${{ github.workspace }}/docker/
32-
run: docker build -t nes_clang_build_${{ matrix.osversion }} -f Dockerfile-${{ matrix.osversion }} .
3322
- name: Build Clang
3423
id: installdeps
3524
run: |
36-
echo "${{ matrix.stdlib }}"
37-
docker run -v ${{ github.workspace }}:/build_dir -e ENABLE_SANITIZER=${{ matrix.sanitizer || '' }} -e STDLIB=${{ matrix.stdlib }} --rm nes_clang_build_${{ matrix.osversion }} \
38-
./build_dir/build_ubuntu-x64.sh
25+
docker run -v ccache:/ccache -e CCACHE_DIR=/ccache -v ${{ github.workspace }}:/build_dir -e ENABLE_SANITIZER=${{ matrix.sanitizer }} -e STDLIB=${{ matrix.stdlib }} -e ARCH=${{ matrix.arch }} --rm nebulastream/nes-development-base:libcxx_enumerate ./build_dir/build_llvm.sh
3926
- name: Compress artifacts
4027
id: compressdeps
4128
run: |
42-
7z a nes-llvm-20-${{ matrix.osversion }}-${{ matrix.stdlib }}-X64-${{ matrix.sanitizer || 'None' }}.7z clang -mx9 -aoa
29+
ZSTD_CLEVEL=19 ZSTD_NBTHREADS=0 tar --zstd -cf nes-llvm-20-${{ matrix.arch }}-${{ matrix.sanitizer }}-${{ matrix.stdlib }}.tar.zstd clang
4330
- name: Release
4431
uses: softprops/action-gh-release@v1
4532
id: createrelease
4633
with:
4734
files: |
48-
nes-llvm-20-${{ matrix.osversion }}-${{ matrix.stdlib }}-X64-${{ matrix.sanitizer || 'None' }}.7z
35+
nes-llvm-20-${{ matrix.arch }}-${{ matrix.sanitizer }}-${{ matrix.stdlib }}.tar.zstd
4936
- name: Clean build artifacts
5037
id: cleanbuildartifacts
5138
if: always()
5239
run: |
5340
rm -rf llvm-project
5441
rm -rf .git
5542
rm -rf clang
56-
- name: Remove docker image
57-
id: removedockerimage
58-
if: always()
59-
run: |
60-
test -n "$(docker image ls -q nes_clang_build_${{ matrix.osversion }})" && \
61-
docker image rm $(docker image ls -q nes_clang_build_${{ matrix.osversion }}) || \
62-
true
63-
64-
build-arm-linux:
65-
env:
66-
VCPKG_DEP_LIST: arm64-linux
67-
VCPKG_FEATURE_FLAGS: -binarycaching
68-
runs-on: [self-hosted, linux, ARM64, dep-builder]
69-
strategy:
70-
matrix:
71-
osversion: [ubuntu-22.04]
72-
stdlib: [libc++, stdlibc++]
73-
sanitizer: [null, 'Address', 'Thread', 'Undefined']
74-
steps:
75-
- uses: AutoModality/action-clean@v1
76-
- uses: actions/checkout@v2
77-
with:
78-
submodules: 'recursive'
79-
- name: Set output vars to the actual tag name
80-
id: vars
81-
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
82-
- name: Build Docker
83-
id: builddocker
84-
working-directory: ${{ github.workspace }}/docker/
85-
run: docker build -t nes_clang_build_${{ matrix.osversion }} -f Dockerfile-${{ matrix.osversion }} .
86-
- name: Build Clang
87-
id: installdeps
88-
run: |
89-
docker run -v ${{ github.workspace }}:/build_dir -e ENABLE_SANITIZER=${{ matrix.sanitizer || '' }} -e STDLIB=${{ matrix.stdlib }} --rm nes_clang_build_${{ matrix.osversion }} \
90-
./build_dir/build_ubuntu-arm64.sh
91-
- name: Compress artifacts
92-
id: compressdeps
93-
run: |
94-
7z a nes-llvm-20-${{ matrix.osversion }}-${{ matrix.stdlib }}-arm64-${{ matrix.sanitizer || 'None' }}.7z clang -mx9 -aoa
95-
- name: Release
96-
uses: softprops/action-gh-release@v1
97-
id: createrelease
98-
with:
99-
files: |
100-
nes-llvm-20-${{ matrix.osversion }}-${{ matrix.stdlib }}-arm64-${{ matrix.sanitizer || 'None' }}.7z
101-
- name: Clean build artifacts
102-
id: cleanbuildartifacts
103-
if: always()
104-
run: |
105-
rm -rf clang
106-
rm -rf llvm-project
107-
rm -rf .git
108-
- name: Remove docker image
109-
id: removedockerimage
110-
if: always()
111-
run: |
112-
test -n "$(docker image ls -q nes_clang_build_${{ matrix.osversion }})" && \
113-
docker image rm $(docker image ls -q nes_clang_build_${{ matrix.osversion }}) || \
114-
true
115-

build_ubuntu-x64.sh renamed to build_llvm.sh

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,49 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
1615
set -o xtrace
1716
cd /build_dir/llvm-project
1817
rm -rf ./build
1918
mkdir build
2019

20+
capitalize() {
21+
if [ -z "$1" ]; then
22+
return 1
23+
fi
24+
25+
local first_char rest
26+
first_char=$(echo "${1:0:1}" | tr '[:lower:]' '[:upper:]')
27+
rest="${1:1}"
28+
echo "${first_char}${rest}"
29+
}
30+
2131
CXX_FLAGS=""
2232
LDFLAGS=""
2333
ADDITIONAL_FLAGS=""
24-
if [ "$STDLIB" == "libc++" ]; then
34+
if [ "$STDLIB" == "libcxx" ]; then
2535
CXXFLAGS="-stdlib=libc++ -std=c++23"
2636
LDFLAGS="-lc++"
27-
elif [ "$STDLIB" == "stdlibc++" ]; then
37+
elif [ "$STDLIB" == "libstdcxx" ]; then
2838
CXXFLAGS="-std=c++23"
2939
LDFLAGS=""
3040
else
3141
echo "Error: STDLIB env not set to either libc++ or stdlibc++."
3242
exit 1
3343
fi
3444

35-
if [ ! -z ${ENABLE_SANITIZER+x} ]; then
36-
ADDITIONAL_FLAGS="${ADDITIONAL_FLAGS} -DLLVM_USE_SANITIZER=${ENABLE_SANITIZER}"
45+
46+
if [ "${ARCH}" = "arm64" ]; then
47+
ADDITIONAL_FLAGS="${ADDITIONAL_FLAGS} -DLLVM_TARGETS_TO_BUILD=AArch64"
48+
else
49+
ADDITIONAL_FLAGS="${ADDITIONAL_FLAGS} -DLLVM_TARGETS_TO_BUILD=X86"
50+
fi
51+
52+
if [ ! "${ENABLE_SANITIZER}" = "none" ]; then
53+
ADDITIONAL_FLAGS="${ADDITIONAL_FLAGS} -DLLVM_USE_SANITIZER=$(capitalize ${ENABLE_SANITIZER})"
54+
fi
55+
56+
if [ "${ENABLE_SANITIZER}" = "undefined" ]; then
57+
ADDITIONAL_FLAGS="${ADDITIONAL_FLAGS} -DLLVM_ENABLE_RTTI=ON"
3758
fi
3859

3960
if [ ! -z "${CXXFLAGS}" ]; then
@@ -46,21 +67,16 @@ fi
4667

4768
cmake -G Ninja -S llvm -B build -DCMAKE_BUILD_TYPE=Release \
4869
-DLLVM_ENABLE_PROJECTS="mlir" \
49-
-DBOOTSTRAP_LLVM_ENABLE_LTO=ON \
5070
-DLLVM_INCLUDE_EXAMPLES=OFF \
5171
-DLLVM_INCLUDE_TESTS=OFF \
5272
-DLLVM_INCLUDE_BENCHMARKS=OFF \
73+
-DLLVM_INCLUDE_TOOLS=OFF \
5374
-DLLVM_BUILD_EXAMPLES=OFF \
54-
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
5575
-DLLVM_OPTIMIZED_TABLEGEN=ON \
5676
-DCMAKE_INSTALL_PREFIX="/build_dir/clang" \
57-
-DLLVM_TARGETS_TO_BUILD="X86" \
5877
-DLLVM_BUILD_TOOLS=ON \
59-
-DLLVM_ENABLE_TERMINFO=OFF \
6078
-DLLVM_ENABLE_Z3_SOLVER=OFF \
6179
${ADDITIONAL_FLAGS}
6280

6381
cmake --build build --target install -j$(nproc)
6482

65-
66-

build_ubuntu-arm64.sh

Lines changed: 0 additions & 63 deletions
This file was deleted.

docker/Dockerfile-ubuntu-22.04

Lines changed: 0 additions & 41 deletions
This file was deleted.

docker/entrypoint-build.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)