4242 latest-factors : |
4343 msvc Optimized-Debug
4444 gcc UBSan Coverage
45- clang UBSan ASan
45+ clang UBSan ASan MSan
4646 apple-clang UBSan ASan
4747 factors : ' '
4848 runs-on : |
@@ -66,21 +66,26 @@ jobs:
6666 clang: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev g++-14=14.2.0-4ubuntu2~24.04
6767 msvc: ''
6868 extra-values : |
69+ use-libcxx: {{#if (and (ieq compiler 'clang') (or ubsan asan msan)) }}true{{else}}false{{/if}}
70+ libcxx-path: /usr/local/libcxx
6971 llvm-hash: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
7072 llvm-build-preset-prefix: {{#if optimized-debug}}debwithopt{{else}}{{{lowercase build-type}}}{{/if}}
7173 llvm-build-preset-os: {{#if (ieq os 'windows') }}win{{else}}unix{{/if}}
72- llvm-sanitizer: {{#if (eq compiler 'gcc')}}{{else if ubsan}}-UBSan{{else if asan}}-ASan{{else if msan}}-MSan{{/if}}
74+ llvm-sanitizer: {{#if (eq compiler 'gcc')}}{{else if ubsan}}-UBSan-2 {{else if asan}}-ASan-2 {{else if msan}}-MSan{{/if}}
7375 llvm-build-preset: {{{ llvm-build-preset-prefix }}}-{{{ llvm-build-preset-os }}}
7476 llvm-compiler-version: {{#if (or (contains version '*') (contains version '^'))}}{{else}}-{{{ version }}}{{/if}}
7577 llvm-archive-basename: llvm-{{{ lowercase os }}}-{{{ compiler }}}{{{ llvm-compiler-version }}}-{{{ llvm-build-preset-prefix }}}{{{ llvm-sanitizer }}}-{{{ substr llvm-hash 0 7 }}}
7678 llvm-root: ../third-party/llvm-project/install
7779 llvm-archive-extension: {{#if (ieq os 'windows') }}7z{{else}}tar.bz2{{/if}}
7880 llvm-archive-filename: {{{ llvm-archive-basename }}}.{{{ llvm-archive-extension }}}
7981 llvm-sanitizer-config: {{#if (and (ne compiler 'clang') (ne compiler 'apple-clang'))}}{{else if ubsan}}Undefined{{else if asan}}Address{{else if msan}}MemoryWithOrigins{{/if}}
80- mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}{{#if (and (eq compiler 'clang') msan) }}-fsanitize-memory-track-origins{{/if}}
81- mrdocs-ccflags: {{{ ccflags }}} {{{ mrdocs-flags }}}
82- mrdocs-cxxflags: {{{ cxxflags }}} {{{ mrdocs-flags }}}
83- mrdocs-linkflags: {{#if asan }}-fsanitize=address{{/if}}
82+ common-flags: -gz=zstd {{#if msan }}-fsanitize-memory-track-origins {{/if}}
83+ common-ccflags: {{{ ccflags }}} {{{ common-flags }}}
84+ common-cxxflags: {{{ cxxflags }}} {{#if (ieq use-libcxx 'true') }}-nostdinc++ -isystem{{{ libcxx-path }}}/include/c++/v1{{/if}}
85+ common-ldflags: {{{ ldflags }}} {{#if (ieq use-libcxx 'true') }}-nostdlib++ -L{{{ libcxx-path }}}/lib -lc++abi -lc++ -Wl,-rpath,{{{ libcxx-path }}}/lib {{/if}}
86+ mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}
87+ mrdocs-ccflags: {{{ common-ccflags }}} {{{ mrdocs-flags }}}
88+ mrdocs-cxxflags: {{{ common-cxxflags }}} {{{ mrdocs-flags }}}
8489 mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
8590 mrdocs-release-package-artifact: release-packages-{{{ lowercase os }}}
8691 output-file : matrix.json
@@ -198,6 +203,16 @@ jobs:
198203 with :
199204 apt-get : ${{ matrix.install }}
200205
206+ - name : Install LLVM packages
207+ if : matrix.use-libcxx == 'true'
208+ env :
209+ DEBIAN_FRONTEND : ' noninteractive'
210+ TZ : ' Etc/UTC'
211+ run : |
212+ echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" >> /etc/apt/sources.list
213+ apt-get update
214+ apt-get install -y libclang-21-dev
215+
201216 - name : Resolve LLVM Root
202217 id : resolve-llvm-root
203218 run : |
@@ -224,6 +239,42 @@ jobs:
224239 fi
225240 echo -E "third-party-dir=$third_party_dir" >> $GITHUB_OUTPUT
226241
242+ - name : Install libc++
243+ id : install_libcxx
244+ uses :
alandefreitas/cpp-actions/[email protected] 245+ if : matrix.use-libcxx == 'true'
246+ with :
247+ cmake-version : ' >=3.26'
248+ source-dir : ../third-party/llvm-project/runtimes
249+ git-repository : https://github.com/llvm/llvm-project.git
250+ git-tag : llvmorg-21.1.0
251+ download-dir : ../third-party/llvm-project
252+ build-dir : ${sourceDir}/runtimes/build
253+ build-type : ${{ matrix.build-type }}
254+ extra-args : |
255+ -D LLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
256+ -D LLVM_OPTIMIZED_TABLEGEN=ON
257+ -D LLVM_ENABLE_LIBCXX=OFF
258+ -D LLVM_ENABLE_PROJECT=""
259+ -D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
260+ -D LLVM_ENABLE_PIC=ON
261+ -D LIBCXXABI_USE_LLVM_UNWINDER=OFF
262+
263+ cc : ${{ steps.setup-cpp.outputs.cc }}
264+ cxx : ${{ steps.setup-cpp.outputs.cxx }}
265+ ccflags : -gz=zstd
266+ cxxflags : -gz=zstd
267+ generator : Ninja
268+ install : true
269+ install-prefix : ${{ matrix.libcxx-path }}
270+ run-tests : false
271+ trace-commands : true
272+
273+ - name : Remove libcxx build-dir
274+ if : steps.install_libcxx.outcome == 'success'
275+ run : |
276+ rm -r ../third-party/llvm-project/runtimes
277+
227278 - name : Cached LLVM Binaries
228279 id : llvm-cache
229280 uses : actions/cache@v4
@@ -277,13 +328,16 @@ jobs:
277328 build-dir : ${sourceDir}/llvm/build
278329 preset : ${{ matrix.llvm-build-preset }}
279330 build-type : ${{ matrix.build-type }}
280- # The LLVM_USE_SANITIZER option doesn't support GCC.
281331 extra-args : |
282- -DLLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
332+ -D LLVM_USE_SANITIZER="${{ matrix.llvm-sanitizer-config }}"
333+ -D LLVM_OPTIMIZED_TABLEGEN=ON
334+ -D LLVM_COMPILER_CHECKED=ON
335+ -D CMAKE_C_FLAGS="${{ matrix.common-ccflags }}"
336+ -D CMAKE_CXX_FLAGS="${{ matrix.common-cxxflags }}"
337+ -D CMAKE_EXE_LINKER_FLAGS="${{ matrix.common-ldflags }}"
338+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
283339 cc : ${{ steps.setup-cpp.outputs.cc }}
284340 cxx : ${{ steps.setup-cpp.outputs.cxx }}
285- ccflags : -gz=zstd
286- cxxflags : -gz=zstd
287341 generator : Ninja
288342 install : true
289343 install-prefix : ${sourceDir}/../install
@@ -293,7 +347,7 @@ jobs:
293347 - name : Remove LLVM build-dir
294348 if : steps.install_llvm.outcome == 'success'
295349 run : |
296- rm -r ../third-party/llvm-project/llvm/llvm/build
350+ rm -r ../third-party/llvm-project/llvm
297351
298352 - name : Install Duktape
299353 uses :
alandefreitas/cpp-actions/[email protected] @@ -306,8 +360,8 @@ jobs:
306360 build-dir : ${sourceDir}/build
307361 cc : ${{ steps.setup-cpp.outputs.cc }}
308362 cxx : ${{ steps.setup-cpp.outputs.cxx }}
309- ccflags : ${{ matrix.ccflags }}
310- cxxflags : ${{ matrix.cxxflags }}
363+ ccflags : ${{ matrix.common- ccflags }}
364+ cxxflags : ${{ matrix.common- cxxflags }}
311365 build-type : ${{ matrix.build-type }}
312366 shared : false
313367 install : true
@@ -325,11 +379,12 @@ jobs:
325379 build-dir : ${sourceDir}/build
326380 cc : ${{ steps.setup-cpp.outputs.cc }}
327381 cxx : ${{ steps.setup-cpp.outputs.cxx }}
328- ccflags : ${{ matrix.ccflags }}
329- cxxflags : ${{ matrix.cxxflags }}
382+ ccflags : ${{ matrix.common- ccflags }}
383+ cxxflags : ${{ matrix.common- cxxflags }}
330384 build-type : Release
331385 shared : false
332386 extra-args : |
387+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
333388 -D LIBXML2_WITH_PROGRAMS=ON
334389 -D LIBXML2_WITH_FTP=OFF
335390 -D LIBXML2_WITH_HTTP=OFF
@@ -388,11 +443,11 @@ jobs:
388443 install-prefix : .local
389444 extra-args : |
390445 -D MRDOCS_BUILD_DOCS=OFF
391- -D CMAKE_EXE_LINKER_FLAGS=${{ matrix.mrdocs-linkflags }}
392- -D LLVM_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
393- -D Clang_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install
394- -D duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
395- -D Duktape_ROOT=${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install
446+ -D CMAKE_EXE_LINKER_FLAGS=" ${{ matrix.common-ldflags }}"
447+ -D LLVM_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
448+ -D Clang_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
449+ -D duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
450+ -D Duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
396451 ${{ runner.os == 'Windows' && '-D libxml2_ROOT=../third-party/libxml2/install' || '' }}
397452 ${{ runner.os == 'Windows' && '-D LibXml2_ROOT=../third-party/libxml2/install' || '' }}
398453 export-compile-commands : true
0 commit comments