From bdc96227be360cff94440ac3f1d4a203f309e5e5 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 27 Oct 2024 02:04:34 +0000 Subject: [PATCH] Ports: Update mold to 2.34.1 --- Ports/AvailablePorts.md | 2 +- Ports/mold/package.sh | 6 ++-- ...renityOS-does-not-support-weak-symbo.patch | 8 ++--- ...renityOS-libraries-are-named-like-BS.patch | 10 +++--- ...Stub-out-a-definition-of-RTLD_NOLOAD.patch | 4 +-- ...isable-mold-wrapper.so-on-SerenityOS.patch | 6 ++-- ...kf-fd-F_LOCK-0-with-flock-fd-LOCK_EX.patch | 34 +++++++++++++++++++ Ports/mold/patches/ReadMe.md | 6 ++++ 8 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 Ports/mold/patches/0005-Replace-lockf-fd-F_LOCK-0-with-flock-fd-LOCK_EX.patch diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 6af220f05f9..7faaded5b6d 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -214,7 +214,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`mednafen`](mednafen/) | Mednafen (My Emulator Doesn't Need A Frickin' Excellent Name) | 1.31.0-UNSTABLE | https://mednafen.github.io/ | | [`mgba`](mgba/) | Game Boy, Game Boy Color and Game Boy Advance emulator | 0.10.2 | https://mgba.io/ | | [`milkytracker`](milkytracker/) | milkytracker | 1.03.00 | https://github.com/milkytracker/MilkyTracker | -| [`mold`](mold/) | A Modern Linker | 1.5.1 | https://github.com/rui314/mold | +| [`mold`](mold/) | A Modern Linker | 2.34.1 | https://github.com/rui314/mold | | [`mpc`](mpc/) | GNU Multiple Precision Complex Library (MPC) | 1.3.1 | http://www.multiprecision.org/mpc/ | | [`mpfr`](mpfr/) | GNU Multiple Precision Floating-Point Reliable Library (MPFR) | 4.2.1 | https://www.mpfr.org/ | | [`mrsh`](mrsh/) | mrsh | cd3c3a4 | https://mrsh.sh/ | diff --git a/Ports/mold/package.sh b/Ports/mold/package.sh index 32aec88db1a..fb131a3a5c2 100755 --- a/Ports/mold/package.sh +++ b/Ports/mold/package.sh @@ -1,8 +1,8 @@ #!/usr/bin/env -S bash ../.port_include.sh -port=mold -version=1.5.1 +port='mold' +version='2.34.1' files=( - "https://github.com/rui314/mold/archive/refs/tags/v${version}.tar.gz#ec94aa74758f1bc199a732af95c6304ec98292b87f2f4548ce8436a7c5b054a1" + "https://github.com/rui314/mold/archive/refs/tags/v${version}.tar.gz#a8cf638045b4a4b2697d0bcc77fd96eae93d54d57ad3021bf03b0333a727a59d" ) depends=("zlib" "openssl" "zstd") useconfigure='true' diff --git a/Ports/mold/patches/0001-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch b/Ports/mold/patches/0001-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch index 50cf1e8827e..f5500f1f7ba 100644 --- a/Ports/mold/patches/0001-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch +++ b/Ports/mold/patches/0001-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch @@ -12,15 +12,15 @@ runtime. So, just lie to TBB that we don't support weak symbols. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/tbb/include/oneapi/tbb/detail/_config.h b/third-party/tbb/include/oneapi/tbb/detail/_config.h -index fa287cd2968ec7f336b754ee450a8da12f4ded23..b93878aa6369a8ffe386da4dd822ab5bd1fe3c3b 100644 +index d6705e154c36d6ed405233f14dc2cd17bbaf7281..739df2b5520999d63ec09374932b04c6c560ae20 100644 --- a/third-party/tbb/include/oneapi/tbb/detail/_config.h +++ b/third-party/tbb/include/oneapi/tbb/detail/_config.h -@@ -195,7 +195,7 @@ +@@ -201,7 +201,7 @@ /** __TBB_WEAK_SYMBOLS_PRESENT denotes that the system supports the weak symbol mechanism **/ #ifndef __TBB_WEAK_SYMBOLS_PRESENT -- #define __TBB_WEAK_SYMBOLS_PRESENT ( !_WIN32 && !__APPLE__ && !__sun && (__TBB_GCC_VERSION >= 40000 || __INTEL_COMPILER ) ) -+ #define __TBB_WEAK_SYMBOLS_PRESENT ( !_WIN32 && !__APPLE__ && !__sun && !__serenity__ && (__TBB_GCC_VERSION >= 40000 || __INTEL_COMPILER ) ) +- #define __TBB_WEAK_SYMBOLS_PRESENT ( !__EMSCRIPTEN__ && !_WIN32 && !__APPLE__ && !__sun && (__TBB_GCC_VERSION >= 40000 || __INTEL_COMPILER ) ) ++ #define __TBB_WEAK_SYMBOLS_PRESENT ( !__EMSCRIPTEN__ && !_WIN32 && !__APPLE__ && !__sun && !__serenity__ && (__TBB_GCC_VERSION >= 40000 || __INTEL_COMPILER ) ) #endif /** Presence of compiler features **/ diff --git a/Ports/mold/patches/0002-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch b/Ports/mold/patches/0002-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch index 4708cf0311d..4a78e05ae3d 100644 --- a/Ports/mold/patches/0002-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch +++ b/Ports/mold/patches/0002-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch @@ -11,26 +11,26 @@ library for mold, but the OS detection logic still needs updated. 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/third-party/tbb/src/tbb/allocator.cpp b/third-party/tbb/src/tbb/allocator.cpp -index f30ded675f1372d572f4156489b15655cd302b2e..0acccef4b2521eee061e4df0aa8dd055e57f41c3 100644 +index 888f43fd3302d6fd1b17130ed6cfaea06b8608d9..7d77bc1bf8412c3b52ff77c7a0c42442aa4d9df2 100644 --- a/third-party/tbb/src/tbb/allocator.cpp +++ b/third-party/tbb/src/tbb/allocator.cpp -@@ -101,7 +101,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = { +@@ -119,7 +119,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = { #define MALLOCLIB_NAME "tbbmalloc" DEBUG_SUFFIX ".dll" #elif __APPLE__ - #define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".dylib" + #define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".2.dylib" -#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__ +#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__ || __serenity__ #define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so" #elif __unix__ // Note that order of these #elif's is important! #define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so.2" diff --git a/third-party/tbb/src/tbb/rml_tbb.cpp b/third-party/tbb/src/tbb/rml_tbb.cpp -index d31a77fb6ff25ef86557daf946aeefe8fe9db5ca..fb676bc90ec22c624b13835f77b5dda1c8d99d93 100644 +index d1cd285c1ae4e98488c4ae07cdebe6749d405945..4d4507c3c1c54a97d6a56e0342959fec295140fc 100644 --- a/third-party/tbb/src/tbb/rml_tbb.cpp +++ b/third-party/tbb/src/tbb/rml_tbb.cpp @@ -50,7 +50,7 @@ namespace rml { #define RML_SERVER_NAME "irml" DEBUG_SUFFIX ".dll" #elif __APPLE__ - #define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".dylib" + #define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".1.dylib" -#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX +#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __serenity__ #define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so" diff --git a/Ports/mold/patches/0003-Stub-out-a-definition-of-RTLD_NOLOAD.patch b/Ports/mold/patches/0003-Stub-out-a-definition-of-RTLD_NOLOAD.patch index 70e044981be..d82d25ab2fd 100644 --- a/Ports/mold/patches/0003-Stub-out-a-definition-of-RTLD_NOLOAD.patch +++ b/Ports/mold/patches/0003-Stub-out-a-definition-of-RTLD_NOLOAD.patch @@ -12,10 +12,10 @@ use it will never be used. 1 file changed, 1 insertion(+) diff --git a/third-party/tbb/src/tbb/dynamic_link.cpp b/third-party/tbb/src/tbb/dynamic_link.cpp -index 91941adab7d4a73699784aed0d896ff32125b8e0..dddbbe128dd92c860527ae7f8befb105690a81f2 100644 +index a21beb5aeb0205ce5f4013b2115515155fad6940..f7353c521b94b2534494bdd77111b5f89a4af318 100644 --- a/third-party/tbb/src/tbb/dynamic_link.cpp +++ b/third-party/tbb/src/tbb/dynamic_link.cpp -@@ -53,6 +53,7 @@ +@@ -55,6 +55,7 @@ #pragma weak dlclose #endif /* __TBB_WEAK_SYMBOLS_PRESENT && !__TBB_DYNAMIC_LOAD_ENABLED */ diff --git a/Ports/mold/patches/0004-Disable-mold-wrapper.so-on-SerenityOS.patch b/Ports/mold/patches/0004-Disable-mold-wrapper.so-on-SerenityOS.patch index b350867b083..8827d444ae2 100644 --- a/Ports/mold/patches/0004-Disable-mold-wrapper.so-on-SerenityOS.patch +++ b/Ports/mold/patches/0004-Disable-mold-wrapper.so-on-SerenityOS.patch @@ -8,13 +8,13 @@ Subject: [PATCH] Disable mold-wrapper.so on SerenityOS 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 79c035d5f523eece5a6da7c9f0994993ddb00364..368fa741aff60f41ba5842ad2450d87a1bea4401 100644 +index 62b260427c56e1c3815dd48b5d02c2f5a62b095b..ac73954d9fd1564de18148bff288d5ded9083562 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -141,7 +141,7 @@ else() - endif() +@@ -245,7 +245,7 @@ else() endif() + # Build mold-wrapper.so -if(NOT APPLE AND NOT WIN32) +if(NOT APPLE AND NOT WIN32 AND NOT SERENITYOS) add_library(mold-wrapper SHARED) diff --git a/Ports/mold/patches/0005-Replace-lockf-fd-F_LOCK-0-with-flock-fd-LOCK_EX.patch b/Ports/mold/patches/0005-Replace-lockf-fd-F_LOCK-0-with-flock-fd-LOCK_EX.patch new file mode 100644 index 00000000000..47a4c4d7fd0 --- /dev/null +++ b/Ports/mold/patches/0005-Replace-lockf-fd-F_LOCK-0-with-flock-fd-LOCK_EX.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Sun, 27 Oct 2024 02:13:48 +0000 +Subject: [PATCH] Replace lockf(fd, F_LOCK, 0) with flock(fd, LOCK_EX) + +We don't have the former implemented. +--- + lib/jobs-unix.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/jobs-unix.cc b/lib/jobs-unix.cc +index 9912ab52c451bb7eacd8a40f5d9cadbbbb49260e..03de0b59ea8d8b95930b10df9550e28fe3b37d0c 100644 +--- a/lib/jobs-unix.cc ++++ b/lib/jobs-unix.cc +@@ -14,9 +14,9 @@ + #include + #include + #include ++#include + #include + #include +-#include + + namespace mold { + +@@ -37,7 +37,7 @@ void acquire_global_lock() { + if (fd == -1) + return; + +- if (lockf(fd, F_LOCK, 0) == -1) ++ if (flock(fd, LOCK_EX) == -1) + return; + lock_fd = fd; + } diff --git a/Ports/mold/patches/ReadMe.md b/Ports/mold/patches/ReadMe.md index b8a983ef50a..7d17a6a6945 100644 --- a/Ports/mold/patches/ReadMe.md +++ b/Ports/mold/patches/ReadMe.md @@ -30,3 +30,9 @@ use it will never be used. Disable mold-wrapper.so on SerenityOS +## `0005-Replace-lockf-fd-F_LOCK-0-with-flock-fd-LOCK_EX.patch` + +Replace lockf(fd, F_LOCK, 0) with flock(fd, LOCK_EX) + +We don't have the former implemented. +