add: dwarf, mimalloc

This commit is contained in:
madonuko
2024-12-20 16:23:20 +08:00
parent 6a80625eb3
commit a324bff65b
12 changed files with 459 additions and 0 deletions
@@ -0,0 +1,44 @@
From 6b57f8b406dc5105d5d83c8b937c3491c7f3852c Mon Sep 17 00:00:00 2001
Message-ID: <6b57f8b406dc5105d5d83c8b937c3491c7f3852c.1727252245.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Sat, 6 Aug 2022 09:18:54 +0200
Subject: [PATCH 1/2] Use system-compatible include path for `xxhash.h`
Distributors that build mold against the system-provided xxHash package
expect its header file `xxhash.h` in the top-level include directory,
not in an `xxhash` subdirectory. Adjust the include path and the
`#include` directive accordingly.
---
CMakeLists.txt | 2 ++
lib/common.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6d1500a..b5f8b56e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -224,6 +224,8 @@ else()
mold_add_tbb()
endif()
+target_include_directories(mold PRIVATE third-party/xxhash)
+
# We always use Clang to build mold on Windows. MSVC can't compile mold.
if(WIN32)
if(MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
diff --git a/lib/common.h b/lib/common.h
index d915c97e..417801d1 100644
--- a/lib/common.h
+++ b/lib/common.h
@@ -34,7 +34,7 @@
#endif
#define XXH_INLINE_ALL 1
-#include "../third-party/xxhash/xxhash.h"
+#include <xxhash.h>
#ifdef NDEBUG
# define unreachable() __builtin_unreachable()
--
2.46.1
@@ -0,0 +1,30 @@
From c4a950cfb4fb78a6009c3834b9875606d4bde475 Mon Sep 17 00:00:00 2001
Message-ID: <c4a950cfb4fb78a6009c3834b9875606d4bde475.1727252245.git.github@sicherha.de>
In-Reply-To: <6b57f8b406dc5105d5d83c8b937c3491c7f3852c.1727252245.git.github@sicherha.de>
References: <6b57f8b406dc5105d5d83c8b937c3491c7f3852c.1727252245.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Sat, 20 Jan 2024 23:58:00 +0100
Subject: [PATCH 2/2] [ELF][S390X] Skip another test that fails with GCC 14
---
test/rodata-name.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/test/rodata-name.sh b/test/rodata-name.sh
index def5a6fd..f5de4b4a 100755
--- a/test/rodata-name.sh
+++ b/test/rodata-name.sh
@@ -5,6 +5,10 @@
# Concretely speaking, ARM as uses "@" as a start of a comment.
[ $MACHINE = arm ] && skip
+# GCC produces buggy code for this test case on s390x.
+# https://sourceware.org/bugzilla/show_bug.cgi?id=29655
+[ $MACHINE = s390x ] && $CC -v 2>&1 | grep -E '^gcc version 14\.' && skip
+
cat <<'EOF' | $CC -c -o $t/a.o -x assembler -
.globl val1, val2, val3, val4, val5
--
2.46.1
+5
View File
@@ -0,0 +1,5 @@
project pkg {
rpm {
spec = "mold.spec"
}
}
+99
View File
@@ -0,0 +1,99 @@
Name: mold
Version: 2.35.0
Release: %autorelease
Summary: A Modern Linker
License: MIT AND (Apache-2.0 OR MIT)
URL: https://github.com/rui314/mold
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
# Allow building against the system-provided `xxhash.h`
Patch0: 0001-Use-system-compatible-include-path-for-xxhash.h.patch
# Possibly https://sourceware.org/bugzilla/show_bug.cgi?id=29655
Patch1: 0002-ELF-S390X-Skip-another-test-that-fails-with-GCC-14.patch
BuildRequires: blake3-devel
BuildRequires: cmake
%if 0%{?el8}
BuildRequires: gcc-toolset-13
%else
BuildRequires: gcc
BuildRequires: gcc-c++ >= 10
%endif
BuildRequires: libzstd-devel
BuildRequires: mimalloc-devel
BuildRequires: xxhash-static
BuildRequires: zlib-devel
BuildRequires: tbb-devel >= 2021.9
# The following packages are only required for executing the tests
BuildRequires: clang
BuildRequires: gdb
BuildRequires: glibc-static
%if ! 0%{?el8}
%ifarch x86_64
# Koji 64-bit buildroots do not contain packages from 32-bit builds, therefore
# the 'glibc-devel.i686' variant is provided as 'glibc32'.
BuildRequires: (glibc32 or glibc-devel(%__isa_name-32))
%endif
BuildRequires: libdwarf-tools
%endif
BuildRequires: libstdc++-static
BuildRequires: llvm
BuildRequires: perl-interpreter
Requires(post): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/alternatives
%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
rm -r third-party/{blake3,mimalloc,xxhash,zlib,zstd}
%if 0%{?fedora} >= 40
rm -r third-party/tbb
%endif
%build
%if 0%{?el8}
. /opt/rh/gcc-toolset-13/enable
%endif
%cmake -DMOLD_USE_SYSTEM_MIMALLOC=ON %{?tbb_flags}
%cmake_build
%install
%cmake_install
%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%{?el8}
. /opt/rh/gcc-toolset-13/enable
%endif
%ctest
%files
%license %{_docdir}/mold/LICENSE
%ghost %{_bindir}/ld
%{_bindir}/mold
%{_bindir}/ld.mold
%{_libdir}/mold/mold-wrapper.so
%{_libexecdir}/mold/ld
%{_mandir}/man1/ld.mold.1*
%{_mandir}/man1/mold.1*
%changelog
%autochangelog
+1
View File
@@ -0,0 +1 @@
rpm.version(gh("rui314/mold"));
+5
View File
@@ -0,0 +1,5 @@
project pkg {
rpm {
spec = "libdwarf.spec"
}
}
+49
View File
@@ -0,0 +1,49 @@
From 472a7ff891d1847b0f3a98325a0bfc2a60a8df82 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
Date: Tue, 25 Jun 2024 08:55:46 +0100
Subject: [PATCH] Make default-library=both work on linux
---
src/lib/libdwarf/meson.build | 6 +++---
src/lib/libdwarfp/meson.build | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lib/libdwarf/meson.build b/src/lib/libdwarf/meson.build
index a958b732..c0753db4 100644
--- a/src/lib/libdwarf/meson.build
+++ b/src/lib/libdwarf/meson.build
@@ -120,10 +120,10 @@ else
libzstd_deps = dependency('',required: false)
endif
-if (lib_type == 'shared')
- compiler_flags = ['-DLIBDWARF_BUILD']
-else
+if (lib_type == 'static')
compiler_flags = ['-DLIBDWARF_STATIC']
+else
+ compiler_flags = ['-DLIBDWARF_BUILD']
endif
libdwarf_lib = library('dwarf', libdwarf_src,
diff --git a/src/lib/libdwarfp/meson.build b/src/lib/libdwarfp/meson.build
index 33b5340e..9c527111 100644
--- a/src/lib/libdwarfp/meson.build
+++ b/src/lib/libdwarfp/meson.build
@@ -31,10 +31,10 @@ libdwarfp_src = [
]
libdwarf_dir = include_directories('../libdwarf')
-if (lib_type == 'shared')
- compiler_flags = ['-DLIBDWARF_BUILD']
-else
+if (lib_type == 'static')
compiler_flags = ['-DLIBDWARF_STATIC']
+else
+ compiler_flags = ['-DLIBDWARF_BUILD']
endif
--
2.45.2
+91
View File
@@ -0,0 +1,91 @@
#? https://src.fedoraproject.org/rpms/libdwarf/blob/epel10/f/libdwarf.spec
Name: libdwarf
Version: 0.11.1
Release: %autorelease
Summary: Library to access the DWARF Debugging file format
License: LGPL-2.1-only AND BSD-2-Clause-FreeBSD
URL: https://www.prevanders.net/dwarf.html
Source0: https://www.prevanders.net/%{name}-%{version}.tar.xz
# Make default-library=both work on linux
Packager: madonuko <mado@fyralabs.com>
Patch: libdwarf-both.patch
BuildRequires: gcc gcc-c++ meson python3
%description
Library to access the DWARF debugging file format which supports
source level debugging of a number of procedural languages, such as C, C++,
and Fortran. Please see http://www.dwarfstd.org for DWARF specification.
%package devel
Summary: Library and header files of libdwarf
License: LGPL-2.1-only AND BSD-2-Clause-FreeBSD
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description devel
Development package containing library and header files of libdwarf.
%package static
Summary: Static libdwarf library
License: LGPL-2.1-only AND BSD-2-Clause-FreeBSD
Requires: %{name}-devel = %{?epoch:%epoch:}%{version}-%{release}
%description static
Static libdwarf library.
%package tools
Summary: Tools for accessing DWARF debugging information
License: GPL-2.0-only AND BSD-2-Clause-FreeBSD
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description tools
C++ version of dwarfdump (dwarfdump2) command-line utilities
to access DWARF debug information.
%prep
%autosetup -p1
%build
%meson --default-library=both
%meson_build
%install
%meson_install
%check
%meson_test
%files
%doc src/lib/libdwarf/ChangeLog src/lib/libdwarf/README
%license src/lib/libdwarf/COPYING src/lib/libdwarf/LIBDWARFCOPYRIGHT src/lib/libdwarf/LGPL.txt
%{_libdir}/libdwarf.so.0
%{_libdir}/libdwarf.so.0.*
%files static
%{_libdir}/libdwarf.a
%files devel
%doc doc/*.pdf
%{_includedir}/libdwarf-0
%{_libdir}/libdwarf.so
%{_libdir}/pkgconfig/libdwarf.pc
%files tools
%license src/bin/dwarfdump/COPYING src/bin/dwarfdump/DWARFDUMPCOPYRIGHT src/bin/dwarfdump/GPL.txt
%{_bindir}/dwarfdump
%{_datadir}/dwarfdump/dwarfdump.conf
%{_mandir}/man1/dwarfdump.1.gz
%changelog
* Fri Dec 20 2024 madonuko <mado@fyralabs.com> - 0.11.1-1
- Repackaged for Terra el10 from Fedora el10
+1
View File
@@ -0,0 +1 @@
rpm.version(find(`(?m)<th>\nReason for release\n</th>\n</tr>\n\n<tr>\n<td>\n<A HREF="libdwarf-([\d.]+)\.tar\.xz"`, get("https://www.prevanders.net/dwarf.html"), 1));
+8
View File
@@ -0,0 +1,8 @@
project pkg {
rpm {
spec = "mimalloc.spec"
}
labels {
updbranch = 1
}
}
+125
View File
@@ -0,0 +1,125 @@
#? https://src.fedoraproject.org/rpms/mimalloc/blob/epel10/f/mimalloc.spec
%undefine __cmake_in_source_build
Name: mimalloc
Version: 2.1.7
Release: 1%{?dist}
Summary: A general purpose allocator with excellent performance
License: MIT
URL: https://github.com/microsoft/mimalloc
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
# Fix ppc64le build
# Patch0: 3966953b7f0f11d2ec33097c5da4356d5b7db7e8.patch
# Patch1: cc3c14f2ed374f908e60a3bf29c1dff84fc8cfc2.patch
Packager: madonuko <mado@fyralabs.com>
BuildRequires: cmake
BuildRequires: gcc-c++
%description
mimalloc (pronounced "me-malloc")
is a general purpose allocator with excellent performance characteristics.
Initially developed by Daan Leijen for the run-time systems.
%package devel
Summary: Development environment for %name
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development package for mimalloc.
%prep
%autosetup -p1
# Remove unneded binary from sources
rm -rf bin
%build
%cmake \
-DMI_BUILD_OBJECT=OFF \
-DMI_OVERRIDE=OFF \
-DMI_INSTALL_TOPLEVEL=ON \
-DMI_BUILD_STATIC=OFF \
-DMI_BUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release
%cmake_build
%install
%cmake_install
%files
%license LICENSE
%doc readme.md
%{_libdir}/lib%{name}.so.2*
%files devel
%{_libdir}/lib%{name}.so
%{_libdir}/cmake/%{name}/
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/*
%changelog
* Fri Dec 20 2024 madonuko <mado@fyralabs.com> - 2.1.7-1
- Repackaged for Terra el10 from Fedora el10
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Tue Jun 18 2024 Vasiliy Glazov <vascom2@gmail.com> - 2.1.7-1
- Update to 2.1.7
* Wed Apr 24 2024 Vasiliy Glazov <vascom2@gmail.com> - 2.1.4-1
- Update to 2.1.4
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri May 12 2023 Vasiliy Glazov <vascom2@gmail.com> - 2.1.2-1
- Update to 2.1.2
* Wed Apr 05 2023 Vasiliy Glazov <vascom2@gmail.com> - 2.1.1-1
- Update to 2.1.1
* Fri Mar 31 2023 Vasiliy Glazov <vascom2@gmail.com> - 2.1.0-1
- Update to 2.1.0
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Dec 28 2022 Vasiliy Glazov <vascom2@gmail.com> - 2.0.9-1
- Update to 2.0.9
* Mon Nov 14 2022 Vasiliy Glazov <vascom2@gmail.com> - 2.0.7-1
- Update to 2.0.7
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Apr 15 2022 Vasiliy Glazov <vascom2@gmail.com> - 2.0.6-1
- Update to 2.0.6
* Tue Feb 15 2022 Vasiliy Glazov <vascom2@gmail.com> - 2.0.5-1
- Update to 2.0.5
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Nov 15 2021 Vasiliy Glazov <vascom2@gmail.com> - 2.0.3-1
- Update to 2.0.3
* Wed Sep 29 2021 Vasiliy Glazov <vascom2@gmail.com> - 2.0.2-2
- Clean spec to follow packaging guidelines
* Wed Sep 29 2021 Vasiliy Glazov <vascom2@gmail.com> - 2.0.2-1
- Initial packaging for Fedora
+1
View File
@@ -0,0 +1 @@
rpm.version(gh("microsoft/mimalloc"));