pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/devel/mold Compatibility with NetBSD
details: https://anonhg.NetBSD.org/pkgsrc/rev/3d815d2e4d84
branches: trunk
changeset: 372068:3d815d2e4d84
user: pho <pho%pkgsrc.org@localhost>
date: Wed Jan 19 02:52:24 2022 +0000
description:
Compatibility with NetBSD
diffstat:
devel/mold/Makefile | 16 ++++++++++---
devel/mold/distinfo | 6 +++-
devel/mold/patches/patch-Makefile | 34 +++++++++++++++++++++++++++++
devel/mold/patches/patch-elf_cmdline.cc | 32 +++++++++++++++++++++++++++
devel/mold/patches/patch-elf_object-file.cc | 27 +++++++++++++++++++++++
5 files changed, 109 insertions(+), 6 deletions(-)
diffs (157 lines):
diff -r dea9aaeba166 -r 3d815d2e4d84 devel/mold/Makefile
--- a/devel/mold/Makefile Tue Jan 18 23:34:05 2022 +0000
+++ b/devel/mold/Makefile Wed Jan 19 02:52:24 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2022/01/01 15:36:48 fcambus Exp $
+# $NetBSD: Makefile,v 1.6 2022/01/19 02:52:24 pho Exp $
DISTNAME= mold-1.0.1
CATEGORIES= devel
@@ -10,17 +10,25 @@
COMMENT= High performance drop-in replacement for existing Unix linkers
LICENSE= gnu-agpl-v3
-ONLY_FOR_PLATFORM= Linux-*-x86_64
-
USE_TOOLS+= gmake
-USE_LANGUAGES= c c++
+USE_LANGUAGES= c c++20
MAKE_FLAGS+= MANDIR="${PREFIX}/${PKGMANDIR}"
MAKE_FLAGS+= SYSTEM_MIMALLOC=1 SYSTEM_TBB=1 SYSTEM_XXHASH=1
+# This package uses a lot of C++20 features. GCC 10 is the oldest GCC that can
+# build it.
+GCC_REQD+= 10
+
+# Handle linker flags for dlopen and pthread automatically.
+DL_AUTO_VARS= yes
+PTHREAD_AUTO_VARS= yes
+
.include "../../devel/mimalloc/buildlink3.mk"
.include "../../devel/xxhash/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../parallel/threadingbuildingblocks/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff -r dea9aaeba166 -r 3d815d2e4d84 devel/mold/distinfo
--- a/devel/mold/distinfo Tue Jan 18 23:34:05 2022 +0000
+++ b/devel/mold/distinfo Wed Jan 19 02:52:24 2022 +0000
@@ -1,6 +1,8 @@
-$NetBSD: distinfo,v 1.7 2022/01/01 15:36:48 fcambus Exp $
+$NetBSD: distinfo,v 1.8 2022/01/19 02:52:24 pho Exp $
BLAKE2s (mold-1.0.1.tar.gz) = d41c3256a5e956ffb060b32a6e7549c5e10ce5fa733802cd33b2677d7b3bf8f3
SHA512 (mold-1.0.1.tar.gz) = cc03a7db395362b97879c28942397d4443d12b72e067b6f979b1ece4d8aab06154b4c1a0f4c57d6ac505bcd4f892bf9a355ad281d628d4d544d8f70edaf34b72
Size (mold-1.0.1.tar.gz) = 3675262 bytes
-SHA1 (patch-Makefile) = ade79e3746409842e89838ce6b2aab35cfb6dd94
+SHA1 (patch-Makefile) = 4599df0bdfdf0718219bf43a1bc2bdcfa0f33ab4
+SHA1 (patch-elf_cmdline.cc) = 2e6879b268e08a76556c167086799122ab8e4b2f
+SHA1 (patch-elf_object-file.cc) = 7ab32cd5cb907ee4a599ae4ced988cee4ad832cf
diff -r dea9aaeba166 -r 3d815d2e4d84 devel/mold/patches/patch-Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/mold/patches/patch-Makefile Wed Jan 19 02:52:24 2022 +0000
@@ -0,0 +1,34 @@
+$NetBSD: patch-Makefile,v 1.5 2022/01/19 02:52:24 pho Exp $
+
+Do not hard-code -ldl, -pthread, or -fPIE as they are handled by the pkgsrc
+infrastructure.
+
+--- Makefile.orig 2021-12-31 05:10:03.000000000 +0000
++++ Makefile
+@@ -19,7 +19,7 @@ STRIP ?= strip
+ OS ?= $(shell uname -s)
+
+ # Used for both C and C++
+-COMMON_FLAGS = -pthread -fPIE -fno-unwind-tables -fno-asynchronous-unwind-tables
++COMMON_FLAGS = -fno-unwind-tables -fno-asynchronous-unwind-tables
+
+ CFLAGS ?= -O2
+ CFLAGS += $(COMMON_FLAGS)
+@@ -27,7 +27,7 @@ CFLAGS += $(COMMON_FLAGS)
+ CXXFLAGS ?= -O2
+ CXXFLAGS += $(COMMON_FLAGS) -std=c++20 -fno-exceptions
+ CPPFLAGS += -DMOLD_VERSION=\"1.0.1\" -DLIBDIR="\"$(LIBDIR)\""
+-LIBS = -pthread -lz -ldl -lm
++LIBS = -lz -lm
+
+ SRCS=$(wildcard *.cc elf/*.cc macho/*.cc)
+ HEADERS=$(wildcard *.h elf/*.h macho/*.h)
+@@ -120,7 +120,7 @@ mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB)
+ ln -sf mold ld64.mold
+
+ mold-wrapper.so: elf/mold-wrapper.c Makefile
+- $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -shared -o $@ $(LDFLAGS) $< -ldl
++ $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -shared -o $@ $(LDFLAGS) $<
+
+ out/%.o: %.cc $(HEADERS) Makefile out/elf/.keep out/macho/.keep
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
diff -r dea9aaeba166 -r 3d815d2e4d84 devel/mold/patches/patch-elf_cmdline.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/mold/patches/patch-elf_cmdline.cc Wed Jan 19 02:52:24 2022 +0000
@@ -0,0 +1,32 @@
+$NetBSD: patch-elf_cmdline.cc,v 1.1 2022/01/19 02:52:24 pho Exp $
+
+Ignore -dc and -dp for now. The base GCC for NetBSD 9 passes them to linker but
+mold currently doesn't support them.
+
+PR sent to the upstream:
+https://github.com/rui314/mold/pull/278
+
+--- elf/cmdline.cc.orig 2022-01-18 17:54:53.408218316 +0000
++++ elf/cmdline.cc
+@@ -60,10 +60,12 @@ Options:
+ --color-diagnostics Alias for --color-diagnostics=always
+ --compress-debug-sections [none,zlib,zlib-gabi,zlib-gnu]
+ Compress .debug_* sections
++ --dc Ignored
+ --defsym=SYMBOL=VALUE Define a symbol alias
+ --demangle Demangle C++ symbols in log messages (default)
+ --no-demangle
+ --disable-new-dtags Ignored
++ --dp Ignored
+ --dynamic-list Read a list of dynamic symbols
+ --eh-frame-hdr Create .eh_frame_hdr section
+ --no-eh-frame-hdr
+@@ -796,6 +798,8 @@ void parse_nonpositional_args(Context<E>
+ } else if (read_flag(args, "no-undefined-version")) {
+ } else if (read_arg(ctx, args, arg, "sort-section")) {
+ } else if (read_flag(args, "sort-common")) {
++ } else if (read_flag(args, "dc")) {
++ } else if (read_flag(args, "dp")) {
+ } else if (read_flag(args, "fix-cortex-a53-843419")) {
+ } else if (read_flag(args, "EL")) {
+ } else if (read_flag(args, "warn-once")) {
diff -r dea9aaeba166 -r 3d815d2e4d84 devel/mold/patches/patch-elf_object-file.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/mold/patches/patch-elf_object-file.cc Wed Jan 19 02:52:24 2022 +0000
@@ -0,0 +1,27 @@
+$NetBSD: patch-elf_object-file.cc,v 1.1 2022/01/19 02:52:24 pho Exp $
+
+It should be perfectly legal to have an empty CIE along with an end-of-records
+marker of FDE. /usr/lib/crtend.o from NetBSD/amd64 has the following .eh_frame
+but mold emits an error for the zero-length FDE:
+
+ .section .eh_frame, "a", @progbits
+ .align 8
+ .quad 0
+
+PR sent to the upstream:
+https://github.com/rui314/mold/pull/278
+
+--- elf/object-file.cc.orig 2021-12-31 05:10:03.000000000 +0000
++++ elf/object-file.cc
+@@ -322,9 +322,8 @@ void ObjectFile<E>::read_ehframe(Context
+ for (std::string_view data = contents; !data.empty();) {
+ i64 size = *(u32 *)data.data();
+ if (size == 0) {
+- if (data.size() != 4)
+- Fatal(ctx) << isec << ": garbage at end of section";
+- break;
++ data = data.substr(4);
++ continue;
+ }
+
+ i64 begin_offset = data.data() - contents.data();
Home |
Main Index |
Thread Index |
Old Index