pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/devel/mold



Module Name:    pkgsrc
Committed By:   pho
Date:           Wed Jan 19 02:52:24 UTC 2022

Modified Files:
        pkgsrc/devel/mold: Makefile distinfo
Added Files:
        pkgsrc/devel/mold/patches: patch-Makefile patch-elf_cmdline.cc
            patch-elf_object-file.cc

Log Message:
Compatibility with NetBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 pkgsrc/devel/mold/Makefile
cvs rdiff -u -r1.7 -r1.8 pkgsrc/devel/mold/distinfo
cvs rdiff -u -r0 -r1.5 pkgsrc/devel/mold/patches/patch-Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/devel/mold/patches/patch-elf_cmdline.cc \
    pkgsrc/devel/mold/patches/patch-elf_object-file.cc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/mold/Makefile
diff -u pkgsrc/devel/mold/Makefile:1.5 pkgsrc/devel/mold/Makefile:1.6
--- pkgsrc/devel/mold/Makefile:1.5      Sat Jan  1 15:36:48 2022
+++ pkgsrc/devel/mold/Makefile  Wed Jan 19 02:52:24 2022
@@ -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 @@ HOMEPAGE=   https://github.com/rui314/mold
 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"

Index: pkgsrc/devel/mold/distinfo
diff -u pkgsrc/devel/mold/distinfo:1.7 pkgsrc/devel/mold/distinfo:1.8
--- pkgsrc/devel/mold/distinfo:1.7      Sat Jan  1 15:36:48 2022
+++ pkgsrc/devel/mold/distinfo  Wed Jan 19 02:52:24 2022
@@ -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

Added files:

Index: pkgsrc/devel/mold/patches/patch-Makefile
diff -u /dev/null pkgsrc/devel/mold/patches/patch-Makefile:1.5
--- /dev/null   Wed Jan 19 02:52:24 2022
+++ pkgsrc/devel/mold/patches/patch-Makefile    Wed Jan 19 02:52:24 2022
@@ -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 $@ $<

Index: pkgsrc/devel/mold/patches/patch-elf_cmdline.cc
diff -u /dev/null pkgsrc/devel/mold/patches/patch-elf_cmdline.cc:1.1
--- /dev/null   Wed Jan 19 02:52:24 2022
+++ pkgsrc/devel/mold/patches/patch-elf_cmdline.cc      Wed Jan 19 02:52:24 2022
@@ -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")) {
Index: pkgsrc/devel/mold/patches/patch-elf_object-file.cc
diff -u /dev/null pkgsrc/devel/mold/patches/patch-elf_object-file.cc:1.1
--- /dev/null   Wed Jan 19 02:52:24 2022
+++ pkgsrc/devel/mold/patches/patch-elf_object-file.cc  Wed Jan 19 02:52:24 2022
@@ -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