From eb6ce47d4f75d545aaeed94ebe90c8dfbf43a576 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 27 Jul 2022 16:38:09 +0100 Subject: [PATCH] ci: Use mold for x86-64 and AArch64 builds mold is a fancy new linker that's really fast. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6877 Signed-off-by: Daniel Stone Reviewed-by: Eric Engestrom Reviewed-by: David Heidelberg Part-of: --- .gitlab-ci/container/build-mold.sh | 11 +++++++++++ .gitlab-ci/container/container_pre_build.sh | 3 ++- .gitlab-ci/container/debian/arm_build.sh | 11 +++++++++++ .gitlab-ci/container/debian/x86_build.sh | 3 +++ .gitlab-ci/container/fedora/x86_build.sh | 4 ++++ .gitlab-ci/image-tags.yml | 3 ++- .gitlab-ci/meson/build.sh | 12 ++++++++++-- 7 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 .gitlab-ci/container/build-mold.sh diff --git a/.gitlab-ci/container/build-mold.sh b/.gitlab-ci/container/build-mold.sh new file mode 100644 index 00000000000..f8541f6f82c --- /dev/null +++ b/.gitlab-ci/container/build-mold.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -ex + +export MOLD_VERSION="1.4.1" +git clone -b v"$MOLD_VERSION" --single-branch --depth 1 https://github.com/rui314/mold.git +cd mold +make +make install +cd .. +rm -rf mold diff --git a/.gitlab-ci/container/container_pre_build.sh b/.gitlab-ci/container/container_pre_build.sh index e5d54f36450..468d81fa778 100755 --- a/.gitlab-ci/container/container_pre_build.sh +++ b/.gitlab-ci/container/container_pre_build.sh @@ -17,7 +17,8 @@ export PATH=$CCACHE_PATH:$PATH export CC="${CCACHE_PATH}/gcc" export CXX="${CCACHE_PATH}/g++" -# Force linkers to gold, since it's so much faster for building. We can't use +# When not using the mold linker (e.g. unsupported architecture), force +# linkers to gold, since it's so much faster for building. We can't use # lld because we're on old debian and it's buggy. ming fails meson builds # with it with "meson.build:21:0: ERROR: Unable to determine dynamic linker" find /usr/bin -name \*-ld -o -name ld | \ diff --git a/.gitlab-ci/container/debian/arm_build.sh b/.gitlab-ci/container/debian/arm_build.sh index e462c62ec45..45608a0a453 100644 --- a/.gitlab-ci/container/debian/arm_build.sh +++ b/.gitlab-ci/container/debian/arm_build.sh @@ -8,8 +8,15 @@ sed -i -e 's/http:\/\/deb/https:\/\/deb/g' /etc/apt/sources.list echo 'deb https://deb.debian.org/debian buster main' >/etc/apt/sources.list.d/buster.list apt-get update +# Ephemeral packages (installed for this script and removed again at +# the end) +STABLE_EPHEMERAL=" \ + libssl-dev \ + " + apt-get -y install \ ${EXTRA_LOCAL_PACKAGES} \ + ${STABLE_EPHEMERAL} \ abootimg \ autoconf \ automake \ @@ -68,8 +75,12 @@ arch=armhf . .gitlab-ci/container/container_pre_build.sh +. .gitlab-ci/container/build-mold.sh + # dependencies where we want a specific version EXTRA_MESON_ARGS= . .gitlab-ci/container/build-libdrm.sh +apt-get purge -y $STABLE_EPHEMERAL + . .gitlab-ci/container/container_post_build.sh diff --git a/.gitlab-ci/container/debian/x86_build.sh b/.gitlab-ci/container/debian/x86_build.sh index d9dcb760b78..8037e275752 100644 --- a/.gitlab-ci/container/debian/x86_build.sh +++ b/.gitlab-ci/container/debian/x86_build.sh @@ -12,6 +12,7 @@ STABLE_EPHEMERAL=" \ autotools-dev \ bzip2 \ libtool \ + libssl-dev \ python3-pip \ " @@ -58,6 +59,8 @@ export XORG_RELEASES=https://xorg.freedesktop.org/releases/individu export XORGMACROS_VERSION=util-macros-1.19.0 +. .gitlab-ci/container/build-mold.sh + wget $XORG_RELEASES/util/$XORGMACROS_VERSION.tar.bz2 tar -xvf $XORGMACROS_VERSION.tar.bz2 && rm $XORGMACROS_VERSION.tar.bz2 cd $XORGMACROS_VERSION; ./configure; make install; cd .. diff --git a/.gitlab-ci/container/fedora/x86_build.sh b/.gitlab-ci/container/fedora/x86_build.sh index b11b7ca064d..5f5f25496f5 100644 --- a/.gitlab-ci/container/fedora/x86_build.sh +++ b/.gitlab-ci/container/fedora/x86_build.sh @@ -8,10 +8,12 @@ EPHEMERAL=" autoconf automake bzip2 + cmake git libtool pkgconfig(epoxy) pkgconfig(gbm) + pkgconfig(openssl) unzip wget xz @@ -83,6 +85,8 @@ tar -xvf $XORGMACROS_VERSION.tar.bz2 && rm $XORGMACROS_VERSION.tar.bz2 cd $XORGMACROS_VERSION; ./configure; make install; cd .. rm -rf $XORGMACROS_VERSION +. .gitlab-ci/container/build-mold.sh + . .gitlab-ci/container/build-libdrm.sh . .gitlab-ci/container/build-wayland.sh diff --git a/.gitlab-ci/image-tags.yml b/.gitlab-ci/image-tags.yml index 458e8e7be82..a88b345f63e 100644 --- a/.gitlab-ci/image-tags.yml +++ b/.gitlab-ci/image-tags.yml @@ -4,6 +4,7 @@ variables: DEBIAN_X86_BUILD_IMAGE_PATH: "debian/x86_build" DEBIAN_BUILD_TAG: "2022-08-22-drop-llvm9" + DEBIAN_BUILD_TAG: "2022-08-23-mold" DEBIAN_X86_BUILD_MINGW_IMAGE_PATH: "debian/x86_build-mingw" DEBIAN_BUILD_MINGW_TAG: "2022-08-17-bump" @@ -14,7 +15,7 @@ variables: DEBIAN_X86_TEST_GL_TAG: "2022-08-17-bump" DEBIAN_X86_TEST_VK_TAG: "2022-08-17-bump" - FEDORA_X86_BUILD_TAG: "2022-08-17-bump" + FEDORA_X86_BUILD_TAG: "2022-08-23-mold" KERNEL_ROOTFS_TAG: "2022-08-17-bump" WINDOWS_X64_VS_PATH: "windows/x64_vs" diff --git a/.gitlab-ci/meson/build.sh b/.gitlab-ci/meson/build.sh index ab7f31c1d61..79783e6f4ca 100755 --- a/.gitlab-ci/meson/build.sh +++ b/.gitlab-ci/meson/build.sh @@ -79,7 +79,15 @@ meson _build --native-file=native.file \ ${EXTRA_OPTION} cd _build meson configure -ninja +if command -V mold &> /dev/null ; then + mold --run ninja +else + ninja +fi LC_ALL=C.UTF-8 meson test --num-processes ${FDO_CI_CONCURRENT:-4} --print-errorlogs ${MESON_TEST_ARGS} -ninja install +if command -V mold &> /dev/null ; then + mold --run ninja install +else + ninja install +fi cd ..