diff --git a/0002-Enable-mold-links-through-whitelist.patch b/0002-Enable-mold-links-through-whitelist.patch new file mode 100644 index 0000000000000000000000000000000000000000..328443f6faf014d2c282da89cd29c4000b224d0c --- /dev/null +++ b/0002-Enable-mold-links-through-whitelist.patch @@ -0,0 +1,142 @@ +From dac9247d8988d13ea8902532168fccc09de60cda Mon Sep 17 00:00:00 2001 +From: yinchuang +Date: Mon, 17 Feb 2025 20:28:24 +0800 +Subject: [PATCH] Enable mold links through whitelist + +Signed-off-by: yinchuang +--- + check_pkg_in_whitelist | 5 +++ + macros | 8 +++- + pkg_enable_mold_whitelist | 89 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 101 insertions(+), 1 deletion(-) + create mode 100755 check_pkg_in_whitelist + create mode 100644 pkg_enable_mold_whitelist + +diff --git a/check_pkg_in_whitelist b/check_pkg_in_whitelist +new file mode 100755 +index 0000000..63d6ebb +--- /dev/null ++++ b/check_pkg_in_whitelist +@@ -0,0 +1,5 @@ ++#!/bin/sh ++ ++if grep -Fxq $2 $1;then ++ echo "-fuse-ld=mold" ++fi +diff --git a/macros b/macros +index 7e393a4..a69e9d7 100644 +--- a/macros ++++ b/macros +@@ -75,7 +75,13 @@ + # flag when linking. + %_clang_extra_ldflags %{?_lto_cflags} + +-%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] ++ ++# Due to the stability of mold, we chose to use the whitelist to enable mold. ++%_use_mold %(%{_rpmconfigdir}/%{_vendor}/check_pkg_in_whitelist %{_rpmconfigdir}/%{_vendor}/pkg_enable_mold_whitelist %name) ++# User can override this variable to switch linker. ++%_ld_use %_use_mold ++ ++%build_ldflags %{_ld_use} -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] + + %set_build_cc \ + CC=%{__cc}; export CC ; \ +diff --git a/pkg_enable_mold_whitelist b/pkg_enable_mold_whitelist +new file mode 100644 +index 0000000..d81427a +--- /dev/null ++++ b/pkg_enable_mold_whitelist +@@ -0,0 +1,89 @@ ++wxGTK3 ++webkit2gtk3 ++uboot-tools ++tog-pegasus ++texlive-base ++tensorflow ++stratovirt ++squid ++sqlite ++samba ++rust ++rpm-ostree ++R-language ++qt6-qtwebengine ++qt6-qttools ++qt6-qtquick3d ++qt6-qtdeclarative ++qt6-qtbase ++qt6-qt3d ++qt5-qtwebkit ++qt5-qtwebengine ++qt5-qtdeclarative ++qt5-qtbase ++qt ++qpid-proton ++qpdf ++pytorch ++python-scikit-learn ++python-ruff ++python-qt5 ++python-lxml ++python3 ++PyQt4 ++proj ++postgresql ++poco ++php ++pcs ++pcp ++openmpi ++openjfx11 ++openjdk-latest ++openjdk-21 ++openjdk-17 ++openjdk-11 ++openjdk-1.8.0 ++opengauss-server ++openblas ++oneDNN ++numpy ++nodejs ++net-snmp ++netavark ++mvapich2 ++mstflint ++mpich ++mariadb ++lz4-java ++llvm-mlir ++llvm-bolt ++llvm ++libqmi ++kuasar ++ksh ++kata-containers ++hwinfo ++hdf5 ++hbase ++hadoop ++guile ++grpc ++greatsql ++gperftools ++google-noto-emoji-fonts ++gettext ++geos ++gdb ++firefox ++festival ++erlang ++emacs ++eclipse ++dpdk ++Cython ++ComputeLibrary ++clang ++bazel ++bacula ++adwaita-qt +-- +2.25.1 + diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index 9397e68bc404687098e0f114b8dfb30da1bd5790..77c0bc6f8241ef4ba7a0504581fadf218d8eecaf 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 31 -Release: 19 +Release: 20 License: GPL+ AND MIT Summary: specific rpm configuration files URL: https://gitee.com/src-openeuler/openEuler-rpm-config @@ -61,6 +61,7 @@ Source303: fix-libtool-from-moving-options-after-libs Source500: config.guess Source501: config.sub Patch0001: 0001-support-sw_64-arch.patch +Patch0002: 0002-Enable-mold-links-through-whitelist.patch # BRPs Source700: brp-chrpath @@ -166,6 +167,8 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kabi.sh install -p -m 755 -t %{buildroot}%{rpmvdir} kmodtool install -p -m 755 -t %{buildroot}%{rpmvdir} find-requires* install -p -m 755 -t %{buildroot}%{rpmvdir} find-provides* +install -p -m 755 -t %{buildroot}%{rpmvdir} check_pkg_in_whitelist +install -p -m 644 -t %{buildroot}%{rpmvdir} pkg_enable_mold_whitelist mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ macros.perl macros.python macros.go macros.forge macros.kmp macros.shell-completions @@ -183,6 +186,8 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %dir %{rpmvdir} %{rpmvdir}/macros %{rpmvdir}/rpmrc +%{rpmvdir}/pkg_enable_mold_whitelist +%{rpmvdir}/check_pkg_in_whitelist %{_rpmconfigdir}/brp-* %{rpmvdir}/config.* %{rpmvdir}/find-provides.nbdkit @@ -202,6 +207,9 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %{rpmvdir}/find-requires.ksyms %changelog +* Tue Mar 04 2025 hugel - 31-20 +- Enable mold links through whitelist to improve package build time + * Tue Feb 25 2025 Funda Wang - 31-19 - fix golang-vendor-provides script for kubernetes - move kabi and kmod attr into system-rpm-config so that it could be used when building kernel