diff --git a/enable_mold_whitelist b/enable_mold_whitelist new file mode 100644 index 0000000000000000000000000000000000000000..e671fa21003edf3ddb398f016195c9a1e321efe4 --- /dev/null +++ b/enable_mold_whitelist @@ -0,0 +1 @@ +clang diff --git a/macros b/macros index 7e393a4b2185d8033976fe7cd1c3de70f7c65178..c9cd0762e6c68cdd8962955054b47eda1044852e 100644 --- a/macros +++ b/macros @@ -75,7 +75,17 @@ # 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}" : "" ] +%_enable_mold %{lua:\ + for line in io.lines(rpm.expand("/usr/lib/rpm/%{_vendor}/enable_mold_whitelist"))\ + do\ + if string.match(line, "^"..rpm.expand("%{name}").."$") then\ + print("-fuse-ld=mold")\ + break\ + end\ + end\ +} + +%build_ldflags -Wl,-z,relro %{_enable_mold} %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_ldflags}" : "" ] %set_build_cc \ CC=%{__cc}; export CC ; \ diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index 3d22bc95c6ce54e6a4c79d475eea569976a49c8f..bccd329802bfb148a43b2293870ddc400a71c511 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -3,7 +3,7 @@ Name: %{vendor}-rpm-config Version: 31 -Release: 13 +Release: 14 License: GPL+ Summary: specific rpm configuration files URL: https://gitee.com/src-openeuler/openEuler-rpm-config @@ -144,7 +144,7 @@ rm -f generic-rpm-config.yaml %install mkdir -p %{buildroot}%{rpmvdir} -install -p -m 644 -t %{buildroot}%{rpmvdir} macros rpmrc +install -p -m 644 -t %{buildroot}%{rpmvdir} macros rpmrc enbale_mold_whitelist install -p -m 755 -t %{buildroot}%{rpmvdir} config.* install -p -m 755 -t %{buildroot}%{_rpmconfigdir} brp-* install -p -m 644 -t %{buildroot}%{_rpmconfigdir} generic-* @@ -169,6 +169,7 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %dir %{rpmvdir} %{rpmvdir}/macros %{rpmvdir}/rpmrc +%{rpmvdir}/enbale_mold_whitelist %{_rpmconfigdir}/brp-* %{rpmvdir}/config.* %{rpmvdir}/find-provides.nbdkit @@ -186,6 +187,9 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir %{rpmvdir}/find-requires.ksyms %changelog +* Sun Feb 09 2025 yinchuang - 31-14 +- Enable mold links through whitelist + * Fri Jan 17 2025 Funda Wang - 31-13 - split out fortify level definition for supporting build with FORTIFY_SOURCE=3 in the future