From ed862b95b2fb9fd14b26c43c53589d45e0f28246 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 9 Aug 2022 10:36:40 +0200 Subject: [PATCH 1/2] 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 4e6f6a1af1..7400dc17f3 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 9a0f8f9bd3..cd6937e390 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 }} From 4fb6506debb851ac062b3b46b46aaa3ac1a17321 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Wed, 10 Aug 2022 09:47:42 +0200 Subject: [PATCH 2/2] meson: Downgrade efi-ld warning The warning isn't that serious and mostly there to inform the user that lld/mold cannot build efi binaries. It is also better to build test with fatal meson warnings. --- .github/workflows/build_test.sh | 13 ++----------- src/boot/efi/meson.build | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_test.sh b/.github/workflows/build_test.sh index 7400dc17f3..b60db29efc 100755 --- a/.github/workflows/build_test.sh +++ b/.github/workflows/build_test.sh @@ -122,19 +122,10 @@ ninja --version for args in "${ARGS[@]}"; do SECONDS=0 - # meson fails with - # src/boot/efi/meson.build:52: WARNING: Not using lld as efi-ld, falling back to bfd - # src/boot/efi/meson.build:52:16: ERROR: Fatal warnings enabled, aborting - # when LINKER is set to lld so let's just not turn meson warnings into errors with lld - # to make sure that the build systemd can pick up the correct efi-ld linker automatically. - # The install_tag feature introduced in 0.60 causes meson to fail with fatal-meson-warnings # "Project targeting '>= 0.53.2' but tried to use feature introduced in '0.60.0': install_tag arg in custom_target" # It can be safely removed from the CI since it isn't actually used anywhere to test anything. find . -type f -name meson.build -exec sed -i '/install_tag/d' '{}' '+' - 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 @@ -151,8 +142,8 @@ for args in "${ARGS[@]}"; do 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 + -Dnobody-group=nogroup -Dcryptolib="${CRYPTOLIB:?}" \ + $args build; then cat build/meson-logs/meson-log.txt fatal "meson failed with $args" diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index 95785dfd5d..efe056c225 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -60,7 +60,7 @@ efi_ld = get_option('efi-ld') if efi_ld == 'auto' efi_ld = cc.get_linker_id().split('.')[1] if efi_ld not in ['bfd', 'gold'] - warning('Not using @0@ as efi-ld, falling back to bfd'.format(efi_ld)) + message('Not using @0@ as efi-ld, falling back to bfd'.format(efi_ld)) efi_ld = 'bfd' endif endif