Skip to content

Commit

Permalink
mold: update to 1.0.2.
Browse files Browse the repository at this point in the history
New features:

- mold now automatically falls back to ld.bfd or ld.lld if GCC-based LTO
  (link time optimization) or LLVM-based LTO are requested, respectively.
  This is a temporary hack until mold gains native LTO support. (a5029d1)
- The following flags have been added: -z ibt (9ca6a9d), -z cet-report
  (31a43a7), -z shstk (e29bd8f), -z ibtplt (fbfa01d)
- [ARM64] Range extension thunks are now supported. Previously, mold
  reported "relocation overflow" errors when the output file's text
  segment is larger than some threshold (~60 MiB). Now, it can link large
  programs just fine. (9287682)
- [NetBSD] mold is now usable on NetBSD. (948248b)
- [x86-64] mold now emits compact 8-byte PLT entries instead of the
  regular 16-byte PLT entries if -z now is given. (0370e7f)
- RELR-type packed dynamic relocations are now supported. You can enable
  it by passing -z pack-dyn-relocs=relr. The good news is that it can
  typically reduce PIE (position-independent executable) size by a few
  percent. This is not a negligible saving because PIE is now default on
  many systems for security reasons. The bad news is that it needs a
  runtime support. To our knowledge, it's supported only on ChromeOS,
  Android, Fuchsia and SerenityOS at this moment. We need to wait for a
  while for other systems to catch up. (bd6afa1)

Performance improvements:

- Version script processor was rewritten with the Aho-Corasick string
  matching algorithm. If your program uses a version script that contains
  lots of glob patterns with the * metacharacter, you'll likely to see a
  significant speedup. (d0c1c4d)
- Relocation processing for non-memory-allocated sections has been
  optimized. You'll likely to see a speedup if your binary contains large
  size of debug info. (d8dc8a6)

Bug fixes and compatibility improvements:

- mold can now link ICC-generated object files with GCC-generated ones
  even if the -static flag is given. (#271, be6ae07)
- mold can now handle archive files (.a files) larger than 4 GiB.
  (bba506d)
- mold no longer have "GNU gold" in its --version string. We had this
  identification string for some ./configure scripts that didn't work
  without it, but it causes other compatibility issue such as #284. Now,
  mold --version prints out something like mold 1.0.2 (compatible with
  GNU ld). We still need "GNU ld" for many ./configure scripts. (cea6a56)
- Symbol resolution algorithm has been completely rewritten. The previous
  implementation was non-deterministic in some edge cases, meaning that
  outcomes from multiple runs of the linker with the same command line
  parameters could be different due to thread scheduling randomness or
  some other internal randomness. Now it is guaranteed to be
  deterministic. (ce5749c)
- mold now try to pull out an object file from an archive if it's needed
  to resolve an undefined symbol with a common symbol. mold used to
  ignore common symbols in archives, so it could fail with an unresolved
  symbol error even if the undefined symbol could be resolved using a
  file in an archive. (27d8361)
- mold no longer converts .ctors/.dtors sections into
  .init_array/.fini_array sections. mold used to convert them but in a
  wrong way. Since .ctors/.dtors have been superseded by
  .init_array/.fini_array long ago, it should be fine to stop doing this
  now. (4348417)
- [i386] mold now ignores some legacy symbols in an i386 CRT files to
  avoid duplicate symbol errors. (#270, 0c19046)
  • Loading branch information
fcambus committed Jan 31, 2022
1 parent fe57ec2 commit a053b7f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 95 deletions.
5 changes: 3 additions & 2 deletions devel/mold/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.6 2022/01/19 02:52:24 pho Exp $
# $NetBSD: Makefile,v 1.7 2022/01/31 22:44:55 fcambus Exp $

DISTNAME= mold-1.0.1
DISTNAME= mold-1.0.2
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=rui314/}
GITHUB_TAG= v${PKGVERSION_NOREV}
Expand All @@ -13,6 +13,7 @@ LICENSE= gnu-agpl-v3
USE_TOOLS+= gmake
USE_LANGUAGES= c c++20

MAKE_FLAGS+= PREFIX="${PREFIX}"
MAKE_FLAGS+= MANDIR="${PREFIX}/${PKGMANDIR}"
MAKE_FLAGS+= SYSTEM_MIMALLOC=1 SYSTEM_TBB=1 SYSTEM_XXHASH=1

Expand Down
12 changes: 5 additions & 7 deletions devel/mold/distinfo
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
$NetBSD: distinfo,v 1.8 2022/01/19 02:52:24 pho Exp $
$NetBSD: distinfo,v 1.9 2022/01/31 22:44:55 fcambus 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) = 4599df0bdfdf0718219bf43a1bc2bdcfa0f33ab4
SHA1 (patch-elf_cmdline.cc) = 2e6879b268e08a76556c167086799122ab8e4b2f
SHA1 (patch-elf_object-file.cc) = 7ab32cd5cb907ee4a599ae4ced988cee4ad832cf
BLAKE2s (mold-1.0.2.tar.gz) = b0c37210c716b5b252ee3b57c1e232056dec2ebf0ff6494c9634b19c4b5d63a4
SHA512 (mold-1.0.2.tar.gz) = 27f6664e63c76c32a6e3ec8bfc4b204138926001f5431be94da9ce47a5d9d3b51aa634c5cd6df45be660d52ac0507f7b7eec17134e35db402db5747d2ecc3715
Size (mold-1.0.2.tar.gz) = 4501088 bytes
SHA1 (patch-Makefile) = 4da9e8cf4b5be616027bce527865e683249bfb4c
45 changes: 18 additions & 27 deletions devel/mold/patches/patch-Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
$NetBSD: patch-Makefile,v 1.5 2022/01/19 02:52:24 pho Exp $
$NetBSD: patch-Makefile,v 1.6 2022/01/31 22:44:55 fcambus Exp $

Do not hard-code -ldl, -pthread, or -fPIE as they are handled by the pkgsrc
infrastructure.
- Honour CFLAGS and CXXFLAGS
- Do not hard-code -pthread, as it is handled by the pkgsrc infrastructure.

--- Makefile.orig 2021-12-31 05:10:03.000000000 +0000
--- Makefile.orig 2022-01-23 08:19:40.000000000 +0000
+++ Makefile
@@ -19,7 +19,7 @@ STRIP ?= strip
OS ?= $(shell uname -s)
@@ -34,14 +34,14 @@ endif

# 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
# If you want to compile mold for debugging, invoke make as
# `make CXXFLAGS=-g`.
-CFLAGS = -O2
-CXXFLAGS = -O2
+CFLAGS ?= -O2
+CXXFLAGS ?= -O2

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
MOLD_CXXFLAGS = -std=c++20 -fno-exceptions -fno-unwind-tables \
-fno-asynchronous-unwind-tables -DMOLD_VERSION=\"1.0.2\" \
-DLIBDIR="\"$(LIBDIR)\""

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_LDFLAGS = -pthread -lz -lm
+MOLD_LDFLAGS = -lz -lm

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 $@ $<
GIT_HASH = $(shell [ -d .git ] && git rev-parse HEAD)
ifneq ($(GIT_HASH),)
32 changes: 0 additions & 32 deletions devel/mold/patches/patch-elf_cmdline.cc

This file was deleted.

27 changes: 0 additions & 27 deletions devel/mold/patches/patch-elf_object-file.cc

This file was deleted.

0 comments on commit a053b7f

Please sign in to comment.