diff --git a/0001-Use-system-compatible-include-path-for-xxhash.h.patch b/0001-Use-system-compatible-include-path-for-xxhash.h.patch new file mode 100644 index 0000000000000000000000000000000000000000..59fce9d030fddccfe630c8f54dbee41c5b2241fc --- /dev/null +++ b/0001-Use-system-compatible-include-path-for-xxhash.h.patch @@ -0,0 +1,38 @@ +From 6a6bbbe9c627ad7fccecca34f39637e9342c254f Mon Sep 17 00:00:00 2001 +From: jchzhou +Date: Tue, 27 Sep 2022 20:28:51 +0800 +Subject: [PATCH] Use system-compatible include path for + +--- + Makefile | 1 + + mold.h | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 148235d..ce3f1f8 100644 +--- a/Makefile ++++ b/Makefile +@@ -59,6 +59,7 @@ CXXFLAGS = -O2 + + MOLD_CXXFLAGS := -std=c++20 -fno-exceptions -fno-unwind-tables \ + -fno-asynchronous-unwind-tables \ ++ -Ithird-party -Ithird-party/xxhash \ + -Wno-sign-compare -Wno-unused-function \ + -DMOLD_VERSION=\"$(VERSION)\" -DLIBDIR="\"$(LIBDIR)\"" + +diff --git a/mold.h b/mold.h +index b1b859b..c8dbfcf 100644 +--- a/mold.h ++++ b/mold.h +@@ -32,7 +32,7 @@ + #endif + + #define XXH_INLINE_ALL 1 +-#include "third-party/xxhash/xxhash.h" ++#include + + #ifdef NDEBUG + # define unreachable() __builtin_unreachable() +-- +2.37.3 + diff --git a/mold-1.7.0.tar.gz b/mold-1.7.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c0e3e64629dc0b8fbf23eba32dc376beee597f8b Binary files /dev/null and b/mold-1.7.0.tar.gz differ diff --git a/mold.spec b/mold.spec new file mode 100644 index 0000000000000000000000000000000000000000..879e191b5a2df593083b70aefb414f2a942d6c69 --- /dev/null +++ b/mold.spec @@ -0,0 +1,79 @@ +Name: mold +Version: 1.7.0 +Release: 1 +Summary: A Modern Linker (mold) +License: AGPLv3+ +URL: https://github.com/rui314/mold +Source: https://github.com/rui314/mold/archive/v%{version}/mold-%{version}.tar.gz + +# mold currently supports x86-64, i386, ARM32, ARM64 and 64-bit RISC-V. +ExclusiveArch: x86_64 aarch64 riscv64 +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: gcc-c++ >= 10 +BuildRequires: openssl-devel +BuildRequires: grep +BuildRequires: python3 +BuildRequires: xxhash-devel +BuildRequires: zlib-devel +BuildRequires: libzstd +BuildRequires: libzstd-devel + +# following pkgs are only required for the test +BuildRequires: clang +BuildRequires: gdb +BuildRequires: glibc-devel +BuildRequires: libstdc++-static +BuildRequires: libdwarf-tools +BuildRequires: llvm +BuildRequires: perl +# API-incompatible with older tbb 2020.3 currently shipped by openEuler +Provides: bundled(tbb) = 2021.5 + +Patch0: tbb-strip-werror.patch + +# Allow building against the system-provided `xxhash.h` +Patch1: 0001-Use-system-compatible-include-path-for-xxhash.h.patch + +%define build_args PREFIX=%{_prefix} LIBDIR=%{_libdir} CFLAGS="%{build_cflags} -fPIC" CXXFLAGS="%{build_cxxflags} -Wno-sign-compare -fPIC" LDFLAGS="%{build_ldflags}" STRIP=true SYSTEM_XXHASH=1 USE_MIMALLOC=0 SYSTEM_ZSTD=1 + +%description +mold is a faster drop-in replacement for existing Unix linkers. +It is several times faster than the LLVM lld linker. +mold is designed to increase developer productivity by reducing +build time, especially in rapid debug-edit-rebuild cycles. + +%prep +%autosetup -p1 +# Prefer system xxhash instead of bundled one +rm -r third-party/xxhash + +%build +%make_build %{build_args} + +%install +%make_install %{build_args} +chmod +x %{buildroot}%{_libdir}/mold/mold-wrapper.so + +%check +make test -k -e %{build_args} || true + +%files +%license %{_docdir}/mold/LICENSE +%{_bindir}/mold +%{_bindir}/ld.mold +%{_bindir}/ld64.mold +%{_libdir}/mold/mold-wrapper.so +%{_libexecdir}/mold +%{_libexecdir}/mold/ld +%{_mandir}/man1/ld.mold.1* +%{_mandir}/man1/mold.1* + +%changelog +* Mon Nov 14 2022 jchzhou - 1.7.0-1 +- Update to 1.7.0 + +* Wed Oct 19 2022 jchzhou - 1.6.0-1 +- Init package for openEuler +- Credit: Christoph Erhardt (fedora@sicherha.de) +- Link: https://src.fedoraproject.org/rpms/mold \ No newline at end of file diff --git a/tbb-strip-werror.patch b/tbb-strip-werror.patch new file mode 100644 index 0000000000000000000000000000000000000000..c3aeee33c46a576d4fff93fe26433c3b43f1a519 --- /dev/null +++ b/tbb-strip-werror.patch @@ -0,0 +1,28 @@ +From bf1642f5e36b006a476805bfa98b735dbbdbb568 Mon Sep 17 00:00:00 2001 +From: jchzhou +Date: Tue, 27 Sep 2022 19:36:44 +0800 +Subject: [PATCH] tbb-strip-werror + +--- + third-party/tbb/cmake/compilers/GNU.cmake | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/third-party/tbb/cmake/compilers/GNU.cmake b/third-party/tbb/cmake/compilers/GNU.cmake +index 733843e..aef6b67 100644 +--- a/third-party/tbb/cmake/compilers/GNU.cmake ++++ b/third-party/tbb/cmake/compilers/GNU.cmake +@@ -44,11 +44,6 @@ if (NOT MINGW) + 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 $<$>:-flifetime-dse=1>) +-- +2.37.3 +