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,28 @@ 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
71+ libcxx-runtimes: libcxx;libcxxabi{{#if (ieq compiler 'apple-clang')}};compiler-rt{{/if}}
6972 llvm-hash: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
7073 llvm-build-preset-prefix: {{#if optimized-debug}}debwithopt{{else}}{{{lowercase build-type}}}{{/if}}
7174 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}}
75+ llvm-sanitizer: {{#if (eq compiler 'gcc')}}{{else if ubsan}}-UBSan2 {{else if asan}}-ASan2 {{else if msan}}-MSan{{/if}}
7376 llvm-build-preset: {{{ llvm-build-preset-prefix }}}-{{{ llvm-build-preset-os }}}
7477 llvm-compiler-version: {{#if (or (contains version '*') (contains version '^'))}}{{else}}-{{{ version }}}{{/if}}
7578 llvm-archive-basename: llvm-{{{ lowercase os }}}-{{{ compiler }}}{{{ llvm-compiler-version }}}-{{{ llvm-build-preset-prefix }}}{{{ llvm-sanitizer }}}-{{{ substr llvm-hash 0 7 }}}
7679 llvm-root: ../third-party/llvm-project/install
7780 llvm-archive-extension: {{#if (ieq os 'windows') }}7z{{else}}tar.bz2{{/if}}
7881 llvm-archive-filename: {{{ llvm-archive-basename }}}.{{{ llvm-archive-extension }}}
7982 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}}
83+ llvm-enable-assertions: {{#if (ieq use-libcxx 'true')}}ON{{else}}OFF{{/if}}
84+ common-flags: -gz=zstd {{#if msan }}-fsanitize-memory-track-origins {{/if}}
85+ common-ccflags: {{{ ccflags }}} {{{ common-flags }}}
86+ common-cxxflags: {{{ cxxflags }}} {{#if (ieq use-libcxx 'true') }}-nostdinc++ -isystem{{{ libcxx-path }}}/include/c++/v1{{/if}}
87+ common-ldflags: {{{ ldflags }}} {{#if (ieq use-libcxx 'true') }}-nostdlib++ -L{{{ libcxx-path }}}/lib -lc++abi -lc++ -Wl,-rpath,{{{ libcxx-path }}}/lib {{/if}}{{#if ubsan }}-fsanitize=undefined {{/if}}{{#if asan }}-fsanitize=address {{/if}}{{#if msan }}-fsanitize=memory {{/if}}
88+ mrdocs-flags: {{#if (and (eq compiler 'gcc') (not asan)) }}-static{{/if}}
89+ mrdocs-ccflags: {{{ common-ccflags }}} {{{ mrdocs-flags }}}
90+ mrdocs-cxxflags: {{{ common-cxxflags }}} {{{ mrdocs-flags }}}
8491 mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
8592 mrdocs-release-package-artifact: release-packages-{{{ lowercase os }}}
8693 output-file : matrix.json
@@ -198,6 +205,16 @@ jobs:
198205 with :
199206 apt-get : ${{ matrix.install }}
200207
208+ - name : Install LLVM packages
209+ if : matrix.use-libcxx == 'true' && matrix.compiler == 'clang'
210+ env :
211+ DEBIAN_FRONTEND : ' noninteractive'
212+ TZ : ' Etc/UTC'
213+ run : |
214+ echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" >> /etc/apt/sources.list
215+ apt-get update
216+ apt-get install -y libclang-21-dev
217+
201218 - name : Resolve LLVM Root
202219 id : resolve-llvm-root
203220 run : |
@@ -224,6 +241,42 @@ jobs:
224241 fi
225242 echo -E "third-party-dir=$third_party_dir" >> $GITHUB_OUTPUT
226243
244+ - name : Install libc++
245+ id : install_libcxx
246+ uses :
alandefreitas/cpp-actions/[email protected] 247+ if : matrix.use-libcxx == 'true'
248+ with :
249+ cmake-version : ' >=3.26'
250+ source-dir : ../third-party/llvm-project/runtimes
251+ git-repository : https://github.com/llvm/llvm-project.git
252+ git-tag : llvmorg-21.1.0
253+ download-dir : ../third-party/llvm-project
254+ build-dir : ${sourceDir}/runtimes/build
255+ build-type : ${{ matrix.build-type }}
256+ extra-args : |
257+ -D LLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
258+ -D LLVM_OPTIMIZED_TABLEGEN=ON
259+ -D LLVM_ENABLE_LIBCXX=OFF
260+ -D LLVM_ENABLE_PROJECT=""
261+ -D LLVM_ENABLE_RUNTIMES="${{ matrix.libcxx-runtimes }}"
262+ -D LLVM_ENABLE_PIC=ON
263+ -D LIBCXXABI_USE_LLVM_UNWINDER=OFF
264+
265+ cc : ${{ steps.setup-cpp.outputs.cc }}
266+ cxx : ${{ steps.setup-cpp.outputs.cxx }}
267+ ccflags : -gz=zstd
268+ cxxflags : -gz=zstd
269+ generator : Ninja
270+ install : true
271+ install-prefix : ${{ matrix.libcxx-path }}
272+ run-tests : false
273+ trace-commands : true
274+
275+ - name : Remove libcxx build-dir
276+ if : steps.install_libcxx.outcome == 'success'
277+ run : |
278+ rm -r ../third-party/llvm-project/runtimes
279+
227280 - name : Cached LLVM Binaries
228281 id : llvm-cache
229282 uses : actions/cache@v4
@@ -277,13 +330,18 @@ jobs:
277330 build-dir : ${sourceDir}/llvm/build
278331 preset : ${{ matrix.llvm-build-preset }}
279332 build-type : ${{ matrix.build-type }}
280- # The LLVM_USE_SANITIZER option doesn't support GCC.
281333 extra-args : |
282- -DLLVM_USE_SANITIZER=${{ matrix.llvm-sanitizer-config }}
334+ -D LLVM_ENABLE_ASSERTIONS=${{ matrix.llvm-enable-assertions }}
335+ -D LLVM_USE_SANITIZER="${{ matrix.llvm-sanitizer-config }}"
336+ -D LLVM_OPTIMIZED_TABLEGEN=ON
337+ -D LLVM_COMPILER_CHECKED=ON
338+ _D LLVM_BUILD_TOOLS=OFF
339+ -D CMAKE_C_FLAGS="${{ matrix.common-ccflags }}"
340+ -D CMAKE_CXX_FLAGS="${{ matrix.common-cxxflags }}"
341+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
342+ -D CMAKE_EXE_LINKER_FLAGS="${{ matrix.common-ldflags }}"
283343 cc : ${{ steps.setup-cpp.outputs.cc }}
284344 cxx : ${{ steps.setup-cpp.outputs.cxx }}
285- ccflags : -gz=zstd
286- cxxflags : -gz=zstd
287345 generator : Ninja
288346 install : true
289347 install-prefix : ${sourceDir}/../install
@@ -293,7 +351,7 @@ jobs:
293351 - name : Remove LLVM build-dir
294352 if : steps.install_llvm.outcome == 'success'
295353 run : |
296- rm -r ../third-party/llvm-project/llvm/llvm/build
354+ rm -r ../third-party/llvm-project/llvm
297355
298356 - name : Install Duktape
299357 uses :
alandefreitas/cpp-actions/[email protected] @@ -306,8 +364,8 @@ jobs:
306364 build-dir : ${sourceDir}/build
307365 cc : ${{ steps.setup-cpp.outputs.cc }}
308366 cxx : ${{ steps.setup-cpp.outputs.cxx }}
309- ccflags : ${{ matrix.ccflags }}
310- cxxflags : ${{ matrix.cxxflags }}
367+ ccflags : ${{ matrix.common- ccflags }}
368+ cxxflags : ${{ matrix.common- cxxflags }}
311369 build-type : ${{ matrix.build-type }}
312370 shared : false
313371 install : true
@@ -325,11 +383,12 @@ jobs:
325383 build-dir : ${sourceDir}/build
326384 cc : ${{ steps.setup-cpp.outputs.cc }}
327385 cxx : ${{ steps.setup-cpp.outputs.cxx }}
328- ccflags : ${{ matrix.ccflags }}
329- cxxflags : ${{ matrix.cxxflags }}
386+ ccflags : ${{ matrix.common- ccflags }}
387+ cxxflags : ${{ matrix.common- cxxflags }}
330388 build-type : Release
331389 shared : false
332390 extra-args : |
391+ -D CMAKE_SHARED_LINKER_FLAGS="${{ matrix.common-ldflags }}"
333392 -D LIBXML2_WITH_PROGRAMS=ON
334393 -D LIBXML2_WITH_FTP=OFF
335394 -D LIBXML2_WITH_HTTP=OFF
@@ -388,11 +447,11 @@ jobs:
388447 install-prefix : .local
389448 extra-args : |
390449 -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
450+ -D CMAKE_EXE_LINKER_FLAGS=" ${{ matrix.common-ldflags }}"
451+ -D LLVM_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
452+ -D Clang_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/llvm-project/install"
453+ -D duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
454+ -D Duktape_ROOT=" ${{ steps.resolve-third-party-dir.outputs.third-party-dir }}/duktape/install"
396455 ${{ runner.os == 'Windows' && '-D libxml2_ROOT=../third-party/libxml2/install' || '' }}
397456 ${{ runner.os == 'Windows' && '-D LibXml2_ROOT=../third-party/libxml2/install' || '' }}
398457 export-compile-commands : true
0 commit comments