From ed862b95b2fb9fd14b26c43c53589d45e0f28246 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 9 Aug 2022 10:36:40 +0200 Subject: [PATCH] ci: Add mold to build tests --- .github/workflows/build_test.sh | 15 +++++++++++++-- .github/workflows/build_test.yml | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test.sh b/.github/workflows/build_test.sh index 4e6f6a1af1b..7400dc17f30 100755 --- a/.github/workflows/build_test.sh +++ b/.github/workflows/build_test.sh @@ -45,6 +45,7 @@ PACKAGES=( libxkbcommon-dev libxtables-dev libzstd-dev + mold mount net-tools perl @@ -134,11 +135,21 @@ for args in "${ARGS[@]}"; do if [[ "$LINKER" != lld ]]; then additional_meson_args="--fatal-meson-warnings" fi + + # mold < 1.1 does not support LTO. + if dpkg --compare-versions "$(dpkg-query --showformat='${Version}' --show mold)" ge 1.1; then + fatal "Newer mold version detected, please remove this workaround." + elif [[ "$args" == *"-Db_lto=true"* ]]; then + LD="gold" + else + LD="$LINKER" + fi + info "Checking build with $args" # shellcheck disable=SC2086 if ! AR="$AR" \ - CC="$CC" CC_LD="$LINKER" CFLAGS="-Werror" \ - CXX="$CXX" CXX_LD="$LINKER" CXXFLAGS="-Werror" \ + CC="$CC" CC_LD="$LD" CFLAGS="-Werror" \ + CXX="$CXX" CXX_LD="$LD" CXXFLAGS="-Werror" \ meson -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true --werror \ -Dnobody-group=nogroup $additional_meson_args \ -Dcryptolib="${CRYPTOLIB:?}" $args build; then diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 9a0f8f9bd32..cd6937e3902 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -27,7 +27,7 @@ jobs: env: - { COMPILER: "gcc", COMPILER_VERSION: "11", LINKER: "bfd", CRYPTOLIB: "gcrypt" } - { COMPILER: "gcc", COMPILER_VERSION: "12", LINKER: "gold", CRYPTOLIB: "openssl" } - - { COMPILER: "clang", COMPILER_VERSION: "13", LINKER: "gold", CRYPTOLIB: "gcrypt" } + - { COMPILER: "clang", COMPILER_VERSION: "13", LINKER: "mold", CRYPTOLIB: "gcrypt" } - { COMPILER: "clang", COMPILER_VERSION: "14", LINKER: "lld", CRYPTOLIB: "openssl" } - { COMPILER: "clang", COMPILER_VERSION: "15", LINKER: "bfd", CRYPTOLIB: "auto" } env: ${{ matrix.env }}