Ports: Update mold port to v1.0.2

Patches regenerated with the new ./package.sh dev mode. It seems to
work as advertised, after a bit of experimentation :^).
This commit is contained in:
Andrew Kaster 2022-01-23 18:13:05 -07:00 committed by Brian Gianforcaro
parent 1b15144e78
commit 1306fab711
11 changed files with 128 additions and 110 deletions

View file

@ -115,7 +115,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`mbedtls`](mbedtls/) | Mbed TLS | 2.16.2 | https://tls.mbed.org/ |
| [`mc`](mc/) | Midnight Commander | 4.8.27 | http://midnight-commander.org/ |
| [`milkytracker`](milkytracker/) | milkytracker | 1.03.00 | https://github.com/milkytracker/MilkyTracker |
| [`mold`](mold/) | | 1.0.1 | https://github.com/rui314/mold |
| [`mold`](mold/) | A Modern Linker | 1.0.2 | https://github.com/rui314/mold |
| [`mpc`](mpc/) | GNU Multiple Precision Complex Library (MPC) | 1.2.1 | http://www.multiprecision.org/mpc/ |
| [`mpfr`](mpfr/) | GNU Multiple Precision Floating-Point Reliable Library (MPFR) | 4.1.0 | https://www.mpfr.org/ |
| [`mruby`](mruby/) | mruby | 3.0.0 | https://mruby.org/ |

View file

@ -1,8 +1,8 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=mold
version=1.0.1
files="https://github.com/rui314/mold/archive/refs/tags/v${version}.tar.gz mold-${version}.tgz b0d54602d1229c26583ee8a0132e53463c4d755f9dbc456475f388fd8a1aa3e4"
version=1.0.2
files="https://github.com/rui314/mold/archive/refs/tags/v${version}.tar.gz mold-${version}.tgz 1a5c4779d10c6c81d21092ea776504f51e6a4994121f536550c60a8e7bb6a028"
auth_type=sha256
depends=("zlib" "openssl")
makeopts=("OS=SerenityOS" "EXTRA_LDFLAGS=-L${DESTDIR}/usr/local/lib -lcore" "-j$(nproc)")
makeopts=("OS=SerenityOS" "LDFLAGS=-L${DESTDIR}/usr/local/lib" "-j$(nproc)")
installopts=("OS=SerenityOS")

View file

@ -0,0 +1,40 @@
From 70904f38faffd6917593a67326f124251ea03cd3 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Sun, 23 Jan 2022 17:47:17 -0700
Subject: [PATCH 1/6] Disable mold-wrapper.so for Serenity
This feature depends on RTLD_NEXT capabilities which are not yet
implemented in the Serenity DynamicLoader.
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index e2d7cd9..18262a1 100644
--- a/Makefile
+++ b/Makefile
@@ -119,7 +119,7 @@ ifeq ($(OS), Linux)
MOLD_WRAPPER_LDFLAGS = -Wl,-push-state -Wl,-no-as-needed -ldl -Wl,-pop-state
endif
-all: mold mold-wrapper.so
+all: mold
mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB) $(XXHASH_LIB)
$(CXX) $(OBJS) -o $@ $(MOLD_LDFLAGS) $(LDFLAGS)
@@ -172,9 +172,9 @@ install: all
$(INSTALL_PROGRAM) mold $D$(BINDIR)
$(STRIP) $D$(BINDIR)/mold
- $(INSTALL) -d $D$(LIBDIR)/mold
- $(INSTALL_DATA) mold-wrapper.so $D$(LIBDIR)/mold
- $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
+ # $(INSTALL) -d $D$(LIBDIR)/mold
+ # $(INSTALL_DATA) mold-wrapper.so $D$(LIBDIR)/mold
+ # $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
$(INSTALL) -d $D$(LIBEXECDIR)/mold
ln -sf $(BINDIR)/mold $D$(LIBEXECDIR)/mold/ld
--
2.25.1

View file

@ -1,40 +0,0 @@
From e1ceb7155ee680f1fdd83773e9702735e5a46bd6 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Tue, 11 Jan 2022 01:42:36 -0700
Subject: [PATCH 1/7] Disable mold_preload.so for Serenity
This feature depends on RTLD_NEXT capabilities which are not yet
implemented in the Serenity DynamicLoader.
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 7f134b89..5b4f8576 100644
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,7 @@ ifneq ($(OS), Darwin)
LIBS += -lcrypto
endif
-all: mold mold-wrapper.so
+all: mold
mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB) $(XXHASH_LIB)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(OBJS) -o $@ $(LIBS)
@@ -165,9 +165,9 @@ install: all
install -m 755 mold $D$(BINDIR)
$(STRIP) $D$(BINDIR)/mold
- install -m 755 -d $D$(LIBDIR)/mold
- install -m 644 mold-wrapper.so $D$(LIBDIR)/mold
- $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
+ # install -m 755 -d $D$(LIBDIR)/mold
+ # install -m 644 mold-wrapper.so $D$(LIBDIR)/mold
+ # $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
install -m 755 -d $D$(LIBEXECDIR)/mold
ln -sf $(BINDIR)/mold $D$(LIBEXECDIR)/mold/ld
--
2.25.1

View file

@ -1,27 +1,27 @@
From 3912ec0acdd0e01bf32b4fe38004194e4f42fa93 Mon Sep 17 00:00:00 2001
From d044a28efff134157154b78c05e881369b512e88 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Tue, 11 Jan 2022 01:43:35 -0700
Subject: [PATCH 2/7] Disable mimalloc for serenity
Date: Sun, 23 Jan 2022 17:55:32 -0700
Subject: [PATCH 2/6] Disable mimalloc for serenity
mimalloc needs some help to compile on serenity. That's one yak too
far for right now.
mimalloc needs some help to compile and run on serenity.
That's one yak too far for right now.
---
Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile
index 5b4f8576..e946c6fd 100644
index 18262a1..98c26cc 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,8 @@ endif
@@ -60,6 +60,8 @@ endif
USE_MIMALLOC = 1
ifeq ($(OS), Darwin)
USE_MIMALLOC = 0
+else ifeq ($(OS), SerenityOS)
+ USE_MIMALLOC = 0
else ifneq (, $(findstring android, $(shell uname -r)))
else ifeq ($(IS_ANDROID), 1)
USE_MIMALLOC = 0
else ifeq ($(ASAN), 1)
endif
--
2.25.1

View file

@ -1,7 +1,7 @@
From 232eff20c3e16160b841b786017ed7c509c3c65a Mon Sep 17 00:00:00 2001
From c99783c82b7591768c2b5131c55a55eaa26ca2c1 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Tue, 11 Jan 2022 01:04:05 -0700
Subject: [PATCH 5/7] Tell TBB that SerenityOS does not support weak symbols
Subject: [PATCH 3/6] Tell TBB that SerenityOS does not support weak symbols
Something about the Clang toolchain configuration causes undefined weak
references to scalable_malloc to remain in the mold executable even
@ -12,10 +12,10 @@ 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 278beeb3..d2962374 100644
index cce8ad6..3e07302 100644
--- a/third-party/tbb/include/oneapi/tbb/detail/_config.h
+++ b/third-party/tbb/include/oneapi/tbb/detail/_config.h
@@ -193,7 +193,7 @@
@@ -195,7 +195,7 @@
/** __TBB_WEAK_SYMBOLS_PRESENT denotes that the system supports the weak symbol mechanism **/
#ifndef __TBB_WEAK_SYMBOLS_PRESENT

View file

@ -1,28 +0,0 @@
From a55b1a4d2ca37c0c4ef2516d71a6555de118cc68 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Tue, 11 Jan 2022 01:02:59 -0700
Subject: [PATCH 4/7] Add POSIX headers for timeval and select
mold was relying on other libc implementations leaking these definitions
from other headers.
---
elf/subprocess.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/elf/subprocess.cc b/elf/subprocess.cc
index 9e2fa9f6..410e568b 100644
--- a/elf/subprocess.cc
+++ b/elf/subprocess.cc
@@ -10,7 +10,9 @@
#include <signal.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/types.h>
+#include <sys/select.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <unistd.h>
--
2.25.1

View file

@ -1,7 +1,7 @@
From 271f83f66d67ce88512cfd128241ccff1919972b Mon Sep 17 00:00:00 2001
From 6f67266ca2e7797506273c50b0a0f2adcfaf5173 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Tue, 11 Jan 2022 01:04:13 -0700
Subject: [PATCH 6/7] Tell TBB that SerenityOS libraries are named like BSD
Date: Sun, 23 Jan 2022 17:50:52 -0700
Subject: [PATCH 4/6] Tell TBB that SerenityOS libraries are named like BSD
ones
We won't be loading these libraries when building TBB as a static
@ -12,31 +12,31 @@ 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 6bf5a0be..c779361e 100644
index f30ded6..0acccef 100644
--- a/third-party/tbb/src/tbb/allocator.cpp
+++ b/third-party/tbb/src/tbb/allocator.cpp
@@ -95,7 +95,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = {
@@ -101,7 +101,7 @@ static const dynamic_link_descriptor MallocLinkTable[] = {
#define MALLOCLIB_NAME "tbbmalloc" DEBUG_SUFFIX ".dll"
#elif __APPLE__
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".dylib"
-#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__
+#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __ANDROID__ || __serenity__
#define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so"
#elif __linux__ // Note that order of these #elif's is important!
#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 122e2709..fc8d7fa8 100644
index d31a77f..fb676bc 100644
--- a/third-party/tbb/src/tbb/rml_tbb.cpp
+++ b/third-party/tbb/src/tbb/rml_tbb.cpp
@@ -52,7 +52,7 @@ namespace rml {
@@ -50,7 +50,7 @@ namespace rml {
#define RML_SERVER_NAME "irml" DEBUG_SUFFIX ".dll"
#elif __APPLE__
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".dylib"
#elif __linux__
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so.1"
-#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX
+#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __sun || _AIX || __serenity__
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so"
#else
#error Unknown OS
#elif __unix__
#define RML_SERVER_NAME "libirml" DEBUG_SUFFIX ".so.1"
--
2.25.1

View file

@ -1,9 +1,9 @@
From e48745461894370e3b47c14fe53417dd2bc7515f Mon Sep 17 00:00:00 2001
From 095c4671242dd8e719c544b97e7b737a553f3d8f Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Tue, 11 Jan 2022 01:04:20 -0700
Subject: [PATCH 7/7] Stub out a definition of RTLD_NOLOAD
Subject: [PATCH 5/6] Stub out a definition of RTLD_NOLOAD
SerenityOs's DynamicLoader doesn't support this flag. However, we won't
SerenityOS's DynamicLoader doesn't support this flag. However, we won't
be dynamically loading any tbb extensions for the static library build
mold uses, so we can just define it as a no-op as the code paths that
use it will never be used.
@ -12,7 +12,7 @@ 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 f9b25ee1..4bacaae8 100644
index 3f13425..7dd2169 100644
--- a/third-party/tbb/src/tbb/dynamic_link.cpp
+++ b/third-party/tbb/src/tbb/dynamic_link.cpp
@@ -53,6 +53,7 @@

View file

@ -0,0 +1,27 @@
From b1c7fb39e002ee60589a731a5908bfc8473760e1 Mon Sep 17 00:00:00 2001
From: Andrew Kaster <akaster@serenityos.org>
Date: Sun, 23 Jan 2022 17:58:07 -0700
Subject: [PATCH 6/6] Disable __TBB_RESUMABLE_TASKS for serenity
This feature requires ``<ucontext.h>``, which is not currently
implemented for any supported SerenityOS targets
---
third-party/tbb/include/oneapi/tbb/detail/_config.h | 2 +-
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 3e07302..3b42d9e 100644
--- a/third-party/tbb/include/oneapi/tbb/detail/_config.h
+++ b/third-party/tbb/include/oneapi/tbb/detail/_config.h
@@ -268,7 +268,7 @@
#define __TBB_CPP20_COMPARISONS_PRESENT __TBB_CPP20_PRESENT
#endif
-#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__QNXNTO__)
+#define __TBB_RESUMABLE_TASKS (!__TBB_WIN8UI_SUPPORT && !__ANDROID__ && !__QNXNTO__ && !__serenity__)
/* This macro marks incomplete code or comments describing ideas which are considered for the future.
* See also for plain comment with TODO and FIXME marks for small improvement opportunities.
--
2.25.1

View file

@ -1,29 +1,48 @@
# Patches for mold on SerenityOS
## `0001-Disable-mold_preload.so-for-Serenity.patch`
## `0001-Disable-mold-wrapper.so-for-Serenity.patch`
Disable mold-wrapper.so for Serenity
This feature depends on RTLD_NEXT capabilities which are not yet
implemented in the Serenity DynamicLoader.
## `0002-Disable-mimalloc-for-serenity.patch`
mimalloc needs some help to compile on serenity. That's one yak too
far for right now.
## `0004-Add-POSIX-headers-for-timeval-and-select.patch`
mold was relying on other libc implementations leaking these definitions
from other headers.
Disable mimalloc for serenity
mimalloc needs some help to compile and run on serenity.
That's one yak too far for right now.
## `0003-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch`
Tell TBB that SerenityOS does not support weak symbols
## `0005-Tell-TBB-that-SerenityOS-does-not-support-weak-symbo.patch`
Something about the Clang toolchain configuration causes undefined weak
references to scalable_malloc to remain in the mold executable even
though there's no chance we'll be loading the tbbmalloc library at
runtime. So, just lie to TBB that we don't support weak symbols.
## `0006-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch`
## `0004-Tell-TBB-that-SerenityOS-libraries-are-named-like-BS.patch`
Tell TBB that SerenityOS libraries are named like BSD ones
We won't be loading these libraries when building TBB as a static
library for mold, but the OS detection logic still needs updated.
## `0007-Stub-out-a-definition-of-RTLD_NOLOAD.patch`
## `0005-Stub-out-a-definition-of-RTLD_NOLOAD.patch`
Stub out a definition of RTLD_NOLOAD
SerenityOS's DynamicLoader doesn't support this flag. However, we won't
be dynamically loading any tbb extensions for the static library build
mold uses, so we can just define it as a no-op as the code paths that
use it will never be used.
## `0006-Disable-__TBB_RESUMABLE_TASKS-for-serenity.patch`
Disable __TBB_RESUMABLE_TASKS for serenity
This feature requires ``<ucontext.h>``, which is not currently
implemented for any supported SerenityOS targets