commit:     172a04700061bc4e34f02d8184faa0f68701d789
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 20 06:09:02 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 20 06:09:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=172a0470

sys-devel/mold: add 2.35.1

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/mold/Manifest                            |  1 +
 .../mold/files/mold-2.35.1-system-mimalloc.patch   | 64 ++++++++++++++++++++++
 .../mold/{mold-9999.ebuild => mold-2.35.1.ebuild}  |  2 +-
 sys-devel/mold/mold-9999.ebuild                    |  4 --
 4 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/sys-devel/mold/Manifest b/sys-devel/mold/Manifest
index fffe115e7813..984985ba4b09 100644
--- a/sys-devel/mold/Manifest
+++ b/sys-devel/mold/Manifest
@@ -1,3 +1,4 @@
 DIST mold-2.1.0.tar.gz 9278811 BLAKE2B 
b31e13f92177553adf5069cf35c8c75c7bc28f0af4d1726cdc0c6abc1c9d3baaa5be512c3a8fb9bc3c3110096a79e1c6751c701171769595a2234fc1fa8c441a
 SHA512 
f1c98d349b35b4042109d71f7db6eb8d7d089dc3241735bbd7b5402d513dcc85ca17904828779e5fc8234650fa9fb97f47c3a2f3e89cc2fb3cb9e9110439e5a2
 DIST mold-2.34.1.tar.gz 10057683 BLAKE2B 
9a9b166e64c4e5d48631147e781ce0d58acf76420f172bdee31fe5c44f37a8e2b098ae5696b52b668255f9a5967b0fb567a51d9fb8b26cddba0e14ed5a3e3464
 SHA512 
6ddfda8b81b710555272ee67eac7f2b3088a7a78f308843caa1730c1b631fc7031b8f5eac33379b9926c9f000d7b27864c12bb62ea75051d2f1caf9f9d2946ab
 DIST mold-2.35.0.tar.gz 10056856 BLAKE2B 
9b039031047263aa959aa6f2bf296d11d51bf02d0a66afa76e08200d4547ee5d66cf522497b86fce7fd8cbd43559b8d19ad0264c749833988592cf7291fd55fe
 SHA512 
6f7be924cb6ea38c0089f0c34beec9ef51160daea3510dac4ed68c519efefe4496739271b35c271f7384c9e436bd8a0636ce47e0847aa2b4daf227accecc7314
+DIST mold-2.35.1.tar.gz 10094602 BLAKE2B 
4943588d116a4631ad4404a4f2d92c4f9745546ec1ab7054df2af766f270c634c571f90d5e224f5441e48a3b310819f6993e56d5574c60032dd547d68d08fc64
 SHA512 
30d9cadfe57288e80ffcaddf1bf7df7b3bff75d337ea2b612bdffa3de3f7bd908b02d24c1f848d4ad0e82f72cd0e04c33ddd01d23c549d81aac5af58e63dbab4

diff --git a/sys-devel/mold/files/mold-2.35.1-system-mimalloc.patch 
b/sys-devel/mold/files/mold-2.35.1-system-mimalloc.patch
new file mode 100644
index 000000000000..c0abe4b5fd68
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.35.1-system-mimalloc.patch
@@ -0,0 +1,64 @@
+https://github.com/rui314/mold/commit/9c9145eb6e5381b69f47bdfb11eeffb7b9febb8b
+https://github.com/rui314/mold/commit/ac9568f17b9054e92fed95a862ec83701336cd37
+
+From 9c9145eb6e5381b69f47bdfb11eeffb7b9febb8b Mon Sep 17 00:00:00 2001
+From: Christoph Erhardt <[email protected]>
+Date: Thu, 19 Dec 2024 21:55:41 +0100
+Subject: [PATCH] Add missing `#include "common.h"`
+
+This allows the compiler to make sure that the implementation of
+`set_mimalloc_options()` matches its declaration.
+
+More importantly, it indirectly pulls in `config.h`, where the macros
+`MOLD_USE_SYSTEM_MIMALLOC` and `MOLD_USE_MIMALLOC` are conditionally
+defined. Without these, the build configuration is ignored.
+---
+ lib/mimalloc.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/mimalloc.cc b/lib/mimalloc.cc
+index 637d5e8ce7..823b91b8e9 100644
+--- a/lib/mimalloc.cc
++++ b/lib/mimalloc.cc
+@@ -1,3 +1,5 @@
++#include "common.h"
++
+ // Including mimalloc-new-delete.h overrides new/delete operators.
+ // We need it only when we are using mimalloc as a dynamic library.
+ #if MOLD_USE_SYSTEM_MIMALLOC
+
+From ac9568f17b9054e92fed95a862ec83701336cd37 Mon Sep 17 00:00:00 2001
+From: Christoph Erhardt <[email protected]>
+Date: Thu, 19 Dec 2024 23:40:12 +0100
+Subject: [PATCH] Disable mimalloc when a sanitizer is used
+
+Combining mimalloc and AddressSanitizer triggers a segmentation fault in
+many tests.
+
+Combining mimalloc and ThreadSanitizer leads to duplicate symbols for
+the `new` and `delete`
+operators, causing the build to fail.
+Example message from a failed GitHub Actions build:
+```
+mold: error: duplicate symbol:
+third-party/mimalloc/libmimalloc-debug.a(alloc.c.o):
+/usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.tsan_cxx-x86_64.a(tsan_new_delete.cpp.o):
+operator delete(void*, std::align_val_t)
+```
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d8643961d9..c451ea952a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -180,7 +180,7 @@ endif()
+ # be stable on 32-bit targets.
+ cmake_dependent_option(
+   MOLD_USE_MIMALLOC "Use mimalloc" ON
+-  "CMAKE_SIZEOF_VOID_P EQUAL 8; NOT APPLE; NOT ANDROID; NOT OPENBSD" OFF)
++  "CMAKE_SIZEOF_VOID_P EQUAL 8; NOT APPLE; NOT ANDROID; NOT OPENBSD; NOT 
MOLD_USE_ASAN; NOT MOLD_USE_TSAN" OFF)
+ 
+ cmake_dependent_option(
+   MOLD_USE_SYSTEM_MIMALLOC "Use system or vendored mimalloc" OFF

diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-2.35.1.ebuild
similarity index 98%
copy from sys-devel/mold/mold-9999.ebuild
copy to sys-devel/mold/mold-2.35.1.ebuild
index d7e4c65e6171..142325bfb19f 100644
--- a/sys-devel/mold/mold-9999.ebuild
+++ b/sys-devel/mold/mold-2.35.1.ebuild
@@ -35,7 +35,7 @@ RDEPEND="
 DEPEND="${RDEPEND}"
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-2.34.1-linux-6.11.patch
+       "${FILESDIR}"/${P}-system-mimalloc.patch
 )
 
 pkg_pretend() {

diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-9999.ebuild
index d7e4c65e6171..e0398e86fe4b 100644
--- a/sys-devel/mold/mold-9999.ebuild
+++ b/sys-devel/mold/mold-9999.ebuild
@@ -34,10 +34,6 @@ RDEPEND="
 "
 DEPEND="${RDEPEND}"
 
-PATCHES=(
-       "${FILESDIR}"/${PN}-2.34.1-linux-6.11.patch
-)
-
 pkg_pretend() {
        # Requires a c++20 compiler, see #831473
        if [[ ${MERGE_TYPE} != binary ]]; then

Reply via email to