The package rpms/mold.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/mold.git/commit/?id=7305f40d49167...
https://src.fedoraproject.org/cgit/rpms/mold.git/commit/?id=76391c452693f....
Change:
+ExclusiveArch: x86_64 aarch64
+%ifarch x86_64
Thanks.
Full change:
============
commit 7305f40d491672b03a3f9b41b6b3a0628d7508b1
Author: Christoph Erhardt <erhardt(a)cs.fau.de>
Date: Tue Jan 25 22:28:04 2022 +0100
Don't build on i686
mold 1.0.2 on i686 is broken with a failing assertion:
elf/../mold.h:315: std::pair<T*, bool>
mold::ConcurrentMap<T>::insert(std::string_view, mold::u64, const T&)
[with T = mold::elf::SectionFragment<mold::elf::I386>; std::string_view
= std::basic_string_view<char>; mold::u64 = long long unsigned int]:
Assertion `__builtin_popcount(nbuckets) == 1' failed.
Since 32-bit i686 is no longer supported by Fedora anyway, it doesn't
matter for us.
diff --git a/mold.spec b/mold.spec
index e6fb886..e56c342 100644
--- a/mold.spec
+++ b/mold.spec
@@ -22,8 +22,8 @@ Patch1: bundled_lib_system_flags.patch
# Fix for failed assertion on aarch64
Patch2: 0001-Fix-out-of-bounds-error-on-aarch64-with-_GLIBCXX_ASS.patch
-# mold can currently produce native binaries for these architectures only
-ExclusiveArch: x86_64 %{ix86} aarch64
+# mold can currently produce native binaries for x86 and aarch64 only
+ExclusiveArch: x86_64 aarch64
BuildRequires: cmake
BuildRequires: gcc
commit 9b2eab61f395faee81768a4ac43d8b29677209a8
Author: Christoph Erhardt <erhardt(a)cs.fau.de>
Date: Tue Jan 25 21:59:42 2022 +0100
Make build dependency on glibc-static(x86-32) Koji-compatible
diff --git a/mold.spec b/mold.spec
index d6fac75..e6fb886 100644
--- a/mold.spec
+++ b/mold.spec
@@ -45,7 +45,7 @@ BuildRequires: zlib-devel
BuildRequires: clang
BuildRequires: glibc-static
%ifarch x86_64
-BuildRequires: glibc-static(x86-32)
+BuildRequires: /usr/lib/libc.a
%endif
%if 0%{?fedora}
BuildRequires: libdwarf-tools
commit 255706739846610a63dedf3199cd05b23bf9cf66
Author: Christoph Erhardt <erhardt(a)cs.fau.de>
Date: Tue Jan 25 21:54:40 2022 +0100
Move libdwarf-tools build dependency into the correct place
diff --git a/mold.spec b/mold.spec
index 8f77e35..d6fac75 100644
--- a/mold.spec
+++ b/mold.spec
@@ -36,9 +36,6 @@ BuildRequires: gcc-toolset-10-toolchain
%if 0%{!?el7} && 0%{!?el8}
BuildRequires: gcc-c++ >= 10
%endif
-%if 0%{?fedora}
-BuildRequires: libdwarf-tools
-%endif
BuildRequires: mimalloc-devel
BuildRequires: openssl-devel
BuildRequires: xxhash-devel
@@ -50,6 +47,9 @@ BuildRequires: glibc-static
%ifarch x86_64
BuildRequires: glibc-static(x86-32)
%endif
+%if 0%{?fedora}
+BuildRequires: libdwarf-tools
+%endif
BuildRequires: libstdc++-static
Requires(post): %{_sbindir}/alternatives
commit 76391c452693f12dc833516647f21a6f9cd4f9d7
Author: Christoph Erhardt <erhardt(a)cs.fau.de>
Date: Tue Jan 25 19:46:31 2022 +0100
Initial import (fedora#2036468).
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..306fe31
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/mold-1.0.2.tar.gz
diff --git a/0001-Fix-out-of-bounds-error-on-aarch64-with-_GLIBCXX_ASS.patch
b/0001-Fix-out-of-bounds-error-on-aarch64-with-_GLIBCXX_ASS.patch
new file mode 100644
index 0000000..be1412e
--- /dev/null
+++ b/0001-Fix-out-of-bounds-error-on-aarch64-with-_GLIBCXX_ASS.patch
@@ -0,0 +1,42 @@
+From 03ba8f93255055adaf69984c17bcfea3b22340db Mon Sep 17 00:00:00 2001
+Message-Id:
<03ba8f93255055adaf69984c17bcfea3b22340db.1642970958.git.github(a)sicherha.de>
+From: Christoph Erhardt <github(a)sicherha.de>
+Date: Sun, 23 Jan 2022 21:42:21 +0100
+Subject: [PATCH] Fix out-of-bounds error on aarch64 with `_GLIBCXX_ASSERTIONS`
+ enabled
+
+While an iterator may point beyond the last element of a `std::span`, a
+pointer may not.
+
+Fixes #298.
+
+Signed-off-by: Christoph Erhardt <github(a)sicherha.de>
+---
+ elf/arch-arm64.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/elf/arch-arm64.cc b/elf/arch-arm64.cc
+index aba86330..c608ae49 100644
+--- a/elf/arch-arm64.cc
++++ b/elf/arch-arm64.cc
+@@ -574,7 +574,7 @@ static void create_thunks(Context<E> &ctx,
OutputSection<E> &osec) {
+ thunk.offset = offset;
+
+ // Scan relocations between B and C to collect symbols that need thunks.
+- tbb::parallel_for_each(&members[b], &members[c],
[&](InputSection<E> *isec) {
++ tbb::parallel_for_each(members.begin() + b, members.begin() + c,
[&](InputSection<E> *isec) {
+ std::span<ElfRel<E>> rels = isec->get_rels(ctx);
+ isec->range_extn.resize(rels.size());
+
+@@ -619,7 +619,7 @@ static void create_thunks(Context<E> &ctx,
OutputSection<E> &osec) {
+ }
+
+ // Scan relocations again to fix symbol offsets in the last thunk.
+- tbb::parallel_for_each(&members[b], &members[c],
[&](InputSection<E> *isec) {
++ tbb::parallel_for_each(members.begin() + b, members.begin() + c,
[&](InputSection<E> *isec) {
+ std::span<ElfRel<E>> rels = isec->get_rels(ctx);
+
+ for (i64 i = 0; i < rels.size(); i++) {
+--
+2.34.1
+
diff --git a/bundled_lib_system_flags.patch b/bundled_lib_system_flags.patch
new file mode 100644
index 0000000..e5704e0
--- /dev/null
+++ b/bundled_lib_system_flags.patch
@@ -0,0 +1,30 @@
+From 06537164083e0af844224651bf7e7c7340a47675 Mon Sep 17 00:00:00 2001
+Message-Id:
<06537164083e0af844224651bf7e7c7340a47675.1642950243.git.github(a)sicherha.de>
+From: Christoph Erhardt <github(a)sicherha.de>
+Date: Sun, 23 Jan 2022 14:28:45 +0100
+Subject: [PATCH] Pass `CXXFLAGS` to bundled tbb
+
+This makes work easier for distributions that specify custom hardened
+compiler flags.
+
+Signed-off-by: Christoph Erhardt <github(a)sicherha.de>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index e2d7cd97..913ac97a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -147,7 +147,7 @@ $(MIMALLOC_LIB):
+
+ $(TBB_LIB):
+ mkdir -p out/tbb
+- (cd out/tbb; cmake -G'Unix Makefiles' -DBUILD_SHARED_LIBS=OFF -DTBB_TEST=OFF
-DCMAKE_CXX_FLAGS=-D__TBB_DYNAMIC_LOAD_ENABLED=0 -DTBB_STRICT=OFF ../../third-party/tbb)
++ (cd out/tbb; cmake -G'Unix Makefiles' -DBUILD_SHARED_LIBS=OFF -DTBB_TEST=OFF
-DCMAKE_CXX_FLAGS="$(CXXFLAGS) -D__TBB_DYNAMIC_LOAD_ENABLED=0" -DTBB_STRICT=OFF
../../third-party/tbb)
+ $(MAKE) -C out/tbb tbb
+ (cd out/tbb; ln -sf *_relwithdebinfo libs)
+
+--
+2.34.1
+
diff --git a/mold.spec b/mold.spec
new file mode 100644
index 0000000..8f77e35
--- /dev/null
+++ b/mold.spec
@@ -0,0 +1,125 @@
+Name: mold
+Version: 1.0.2
+Release: 1%{?dist}
+Summary: A Modern Linker
+
+License: AGPLv3+
+URL:
https://github.com/rui314/mold
+Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
+
+# The bundled build system for tbb tries to strip all Werror from the
+# CFLAGS/CXXFLAGS when not building in strict mode (mold doesn't use strict
+# mode). We don't want that because it causes the "Werror=format-security"
+# option to become "=format-security" and break the build. (similar to a patch
+# in the Fedora tbb package)
+Patch0: tbb-strip-werror.patch
+
+# Pass the system's CXXFLAGS and CFLAGS to the bundled libraries to ensure they
+# are built with all the Fedora hardening flags and with PIE (otherwise the
+# linker errors linking non-PIE code with PIE code).
+Patch1: bundled_lib_system_flags.patch
+
+# Fix for failed assertion on aarch64
+Patch2: 0001-Fix-out-of-bounds-error-on-aarch64-with-_GLIBCXX_ASS.patch
+
+# mold can currently produce native binaries for these architectures only
+ExclusiveArch: x86_64 %{ix86} aarch64
+
+BuildRequires: cmake
+BuildRequires: gcc
+%if 0%{?el7}
+BuildRequires: devtoolset-10-toolchain
+%endif
+%if 0%{?el8}
+BuildRequires: gcc-toolset-10-toolchain
+%endif
+%if 0%{!?el7} && 0%{!?el8}
+BuildRequires: gcc-c++ >= 10
+%endif
+%if 0%{?fedora}
+BuildRequires: libdwarf-tools
+%endif
+BuildRequires: mimalloc-devel
+BuildRequires: openssl-devel
+BuildRequires: xxhash-devel
+BuildRequires: zlib-devel
+
+# The following packages are only required for executing the tests
+BuildRequires: clang
+BuildRequires: glibc-static
+%ifarch x86_64
+BuildRequires: glibc-static(x86-32)
+%endif
+BuildRequires: libstdc++-static
+
+Requires(post): %{_sbindir}/alternatives
+Requires(preun): %{_sbindir}/alternatives
+
+# API-incompatible with older tbb 2020.3 currently shipped by Fedora:
+#
https://bugzilla.redhat.com/show_bug.cgi?id=2036372
+Provides: bundled(tbb) = 2021.3
+
+%define build_args PREFIX=%{_prefix} LIBDIR=%{_libdir} CC=gcc CXX=g++
CFLAGS="%{build_cflags}" CXXFLAGS="%{build_cxxflags}"
LDFLAGS="%{build_ldflags}" STRIP=echo SYSTEM_MIMALLOC=1 SYSTEM_XXHASH=1
+
+%description
+mold is a multi-threaded, high-performance linker that is several times faster
+than the industry-standard ones, namely, GNU ld, GNU gold or LLVM lld. It is
+developed as a drop-in replacement for these linkers and command-line compatible
+with them with a few exceptions.
+
+%prep
+%autosetup -p1
+rm -r third-party/{mimalloc,xxhash}
+
+%build
+%if 0%{?el7}
+. /opt/rh/devtoolset-10/enable
+%endif
+%if 0%{?el8}
+. /opt/rh/gcc-toolset-10/enable
+%endif
+%make_build %{build_args}
+
+%install
+%make_install %{build_args}
+# Overwrite absolute symlink with relative symlink
+ln -srf %{buildroot}%{_bindir}/mold %{buildroot}%{_libexecdir}/mold/ld
+chmod +x %{buildroot}%{_libdir}/mold/mold-wrapper.so
+
+%post
+if [ "$1" = 1 ]; then
+ %{_sbindir}/alternatives --install %{_bindir}/ld ld %{_bindir}/ld.mold 1
+fi
+
+%postun
+if [ "$1" = 0 ]; then
+ %{_sbindir}/alternatives --remove ld %{_bindir}/ld.mold
+fi
+
+%check
+%if 0%{?el7}
+. /opt/rh/devtoolset-10/enable
+%endif
+%if 0%{?el8}
+. /opt/rh/gcc-toolset-10/enable
+%endif
+%make_build %{build_args} test
+
+%files
+%license LICENSE
+%ghost %{_bindir}/ld
+%{_bindir}/mold
+%{_bindir}/ld.mold
+%{_bindir}/ld64.mold
+%{_libdir}/mold
+%{_libdir}/mold/mold-wrapper.so
+%{_libexecdir}/mold
+%{_libexecdir}/mold/ld
+%{_mandir}/man1/mold.1*
+
+%changelog
+* Sun Jan 23 2022 Christoph Erhardt <fedora(a)sicherha.de> - 1.0.2-1
+- Bump version to 1.0.2.
+
+* Sat Jan 01 2022 Christoph Erhardt <fedora(a)sicherha.de> - 1.0.1-1
+- Initial package for version 1.0.1.
diff --git a/sources b/sources
new file mode 100644
index 0000000..59c74a6
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+SHA512 (mold-1.0.2.tar.gz) =
27f6664e63c76c32a6e3ec8bfc4b204138926001f5431be94da9ce47a5d9d3b51aa634c5cd6df45be660d52ac0507f7b7eec17134e35db402db5747d2ecc3715
diff --git a/tbb-strip-werror.patch b/tbb-strip-werror.patch
new file mode 100644
index 0000000..fe489ea
--- /dev/null
+++ b/tbb-strip-werror.patch
@@ -0,0 +1,16 @@
+diff --git a/third-party/tbb/cmake/compilers/GNU.cmake
b/third-party/tbb/cmake/compilers/GNU.cmake
+index 902fa786..9c364803 100644
+--- a/third-party/tbb/cmake/compilers/GNU.cmake
++++ b/third-party/tbb/cmake/compilers/GNU.cmake
+@@ -44,11 +44,6 @@ endif()
+ set(TBB_COMMON_LINK_LIBS dl)
+ endif()
+
+-# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if
TBB_STRICT is disabled.
+-if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
+- tbb_remove_compile_flag(-Werror)
+-endif()
+-
+ if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL Intel)
+ # gcc 6.0 and later have -flifetime-dse option that controls elimination of stores
done outside the object lifetime
+ set(TBB_DSE_FLAG
$<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},6.0>>:-flifetime-dse=1>)