Releases: rui314/mold
mold 1.5.1
mold 1.5.1 is a new release of the high-speed linker. This version contains only the following bug fix. We recommend upgrading from 1.5.0 if you are being affected by this issue.
- We changed the memory layout to save both memory and disk space in 1.5.0. Even though the new layout works fine on most systems, the change made the linker to create unusable executables for systems with large pages. Specifically, if you specify a large number for the
-z max-page-sizeoption, the loader refused to execute it with theerror while loading shared libraries: cannot apply additional memory protection after relocation: Cannot allocate memoryerror. We reverted our recent commits so that mold creates output files with the same memory layout as it did before 1.5.0. (e62de0b)
Acknowledgements
mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank you to everybody who sponsors our project. In particular, we'd like to acknowledge the following organizations and people who have sponsored $32/mo or more during this release cycle:
- 300baud
- Mercury
- signal-slot
- Wei Wu
- BuildBuddy
- Luke Kasz
- Will Bond
- H.T
- .-A-.
- nasa
- haze
- daquexian
- Johan Andersson
- Markus Schirp
- Anonymous sponsor
mold 1.5.0
mold 1.5.0 is a new release of the high-speed linker. The highlight of this release is that we start supporting the following four new targets: PPC64LE, SPARC64, RV32BE and RV64BE. mold 1.5.0 also includes various bug fixes, performance and compatibility improvements as shown below.
Starting from this release, we recommend using cmake instead of make to build mold. We will soon stop supporting make, so please migrate early and report issues if you find any.
Note for those who create mold binary packages: if you are building mold for binary distribution, please link the bundled libtbb statically (which is default) or rebuild your distro's libtbb package with my patch so that mold's Link-Time Optimization (LTO) works reliably under heavy load.
New features
- PPC64LE and SPARC64 are now supported as new targets. They haven't yet been as well tested as other targets, but they are already able to link mold itself on these platforms. (Note that PPC64LE is very unlikely to work on the most recent POWER10 machines as we didn't have a chance to test it due to a limited availability (POWER10 was released in 2021). If you can support us on this matter, please contact us. We also accept donations, so please consider supporting our project!)
- RV32BE and RV64BE (32-bit and 64-bit big-endian RISC-V) are now supported as experimental targets. RISC-V is usually little-endian, but there exists a big-endian RISC-V as an extension. You can make gcc to emit code for big-endian RISC-V by passing
-mbig-endian. mold can now link object files generated with that option. --compress-debug-sections=zstdis now supported. This is an option to compress debug info embedded to an output file with Zstandard compression algorithm. Compared to the existing--compress-debug-sections=zlib, zstd is faster and gives a higher compression ratio. You probably can't start using zstd compression today though, because other tools such asgdbmay not be able to read zstd-compressed debug info yet. But adding this option early makes mold future-proof. (ede7a5a)- mold no longer aligns loadable segments to page boundaries to reduce output file size. Previously, we allocated holes between loadable segments. The saving by this change is most visible for small programs. For example, a "hello world" program used to be ~18 KiB on x86-64. It's now 7.2 KiB. (2941d75)
Bug fixes and compatibility improvements
- [RISCV] We optimized code so that the link speed for RISC-V is now comparable to the other targets. As an example, linking mold itself (~150 MiB in size) for RV64 used to take ~45 seconds on a simulated 16-core machine. It now takes only ~0.25 seconds. (3ab5489)
- mold used to create more than one
.rodatasection under a certain condition. It's not technically wrong but confused Valgrind. This issue has been resolved. (25c7aee) - [ARM32] Previously, mold failed to promote remaining undefined symbols to dynamic symbols if symbols are undefined weak. That caused a link failure for libxml (#660). This issue has been resolved. (72e26d9)
- mold didn't copy symbol types when creating symbol aliases for the
--defsymoption. (8c7f31c)
Removed features
--compress-debug-sections=zlib-gnuhas been removed. LLVM lld removed that option too as there seems to be no usage of the flag.
Acknowledgements
mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank you to everybody who sponsors our project. In particular, we'd like to acknowledge the following organizations and people who have sponsored $32/mo or more during this release cycle:
- 300baud
- Mercury
- signal-slot
- Wei Wu
- BuildBuddy
- Luke Kasz
- Will Bond
- H.T
- .-A-.
- nasa
- haze
- daquexian
- Johan Andersson
- Markus Schirp
- Anonymous sponsor
mold 1.4.2
mold 1.4.2 is a maintenance release of the high-speed linker. This release includes, but not limited to, the following improvements and bug fixes.
Note for those who create mold binary packages: if you are building mold for binary distribution, please link the bundled libtbb statically (which is default) or rebuild your distro's libtbb package with my patch so that mold's Link-Time Optimization (LTO) works reliably under heavy load.
New features and bug fixes
- [RV32] We've fixed several issues for 32-bit RISC-V. mold can now build complex programs including itself for the target.
- [ARM32] mold gained range extension thunks so that it can now link programs whose .text is larger than 16 MiB. Previously, mold couldn't link such large programs. We've also fixed general stability issues for ARM32.
Acknowledgements
mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank you to everybody who sponsors our project. In particular, we'd like to acknowledge the following organizations and people who have sponsored $32/mo or more during this release cycle:
mold 1.4.1
mold 1.4.1 is a maintenance release of the high-speed linker. This release contains the following improvements and bug fixes.
Note for those who create mold binary packages: if you are building mold for binary distribution, please link the bundled libtbb statically (which is default) or rebuild your distro's libtbb package with my patch so that mold's Link-Time Optimization (LTO) works reliably under heavy load.
New features
- mold/macOS is now available as an alpha feature. We do not recommend using it for anything serious though. Starting from this version, we accept not only mold/Unix issues but also mold/macOS ones on our GitHub Issues. Feel free to file a bug if you encounter any problem.
- We started supporting CMake in addition to Make to build mold. Our long-term plan is to migrate from Make to CMake because we want to support Windows eventually and CMake provides a better Windows support than Make does. (e6a0e67)
Bug fixes and compatibility improvements
- There was a bug that mold accidentally exported a hidden symbol from an executable if a shared library linked to that executable happened to define the same symbol. This caused a build issue with Blender (#606). The bug has been fixed. (b163068)
--hash-style=bothis now the default if no--hash-styleoption is given. Previously,--hash-style=sysvwas the default. This change shouldn't affect most users because the compiler driver (cc, gcc, clang, etc.) always passes--hash-styleto the linker. We made this change because GNU ld defaults to--hash-style=both.- Alias symbols defined by the
--defsymoption now have the same scope as the aliased symbols. Previously, alias symbols defined by--defsymwere always hidden and never be exported as dynamic symbols. (5dd1227) - mold now accepts
foo = bar-style linker script directive to define symbol aliases. Previously, such statement was treated as a syntax error. This change was made to link mariadb-connector-c correctly (f0e1237) - Symbols in mergeable string sections now have correct output section indices instead of
SHN_UNDEF. (a595c48) - [ARM32] Previously, calling a function from ARM code to Thumb code caused a program crash due to bug #442. This issue has been fixed. (053b90b)
Acknowledgements
mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank you to everybody who sponsors our project. In particular, we'd like to acknowledge the following organizations and people who have sponsored $32/mo or more during this release cycle:
mold 1.4.0
mold 1.4.0 is a new release of the high-speed linker. This release contains a few new features and general stability/compatibility improvements as shown below.
Note for those who create mold binary packages: if you are building mold for binary distribution, please link the bundled libtbb statically (which is default) or rebuild your distro's libtbb package with my patch so that mold's Link-Time Optimization (LTO) works reliably under a heavy load.
New features
- Initial support for the 32-bit RISC-V (RV32) has landed. (d9db6bc)
- mold now demangles Rust symbols in error messages thanks to @eddyb's rust-demangle.c. (22e1bba)
--export-dynamic-symboland--export-dynamic-symbol-listare now supported for the sake of compatibility with LLVM lld. With these options, you can specify symbols that should be exported using glob pattern. (e115aae)- [x86-64] PLT entries created by mold now always begins with
ENDBR64instruction to improve compatibility with Intel IBT (Indirect Branch Tracking.) (e3e371d)
Bug fixes and compatibility improvements
- mold now defines
__dso_handlesymbol. The lack of this linker-synthesized symbol caused a link error with GCC in some environments (#507). (764d757)
Acknowledgements
mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank you to everybody who sponsors our project. In particular, we'd like to acknowledge the following organizations and people who have sponsored $32/mo or more during this release cycle:
mold 1.3.1
mold 1.3.1 is a maintenance release of the high-speed linker. This release contains the following minor bug fixes.
Bug fixes and compatibility improvements
- mold now supports
.preinit_arraysections. Without this, AddressSanitizer didn't work in some environments. (3b75398) - [ARM32]
R_ARM_MOVT_PRELandR_ARM_PREL31relocations are now handled correctly so that mold no longer emit spurious "recompile with -fPIC" errors. (5294300)
Acknowledgements
mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank you to everybody who sponsors our project. In particular, we'd like to acknowledge the following organizations and people who have sponsored $32/mo or more during this release cycle:
mold 1.3.0
mold 1.3.0 is a new release of the high-speed linker. This release contains a few new features and general stability/compatibility improvements as shown below.
Note for those who create mold binary packages: if you are building mold for binary distribution, please link the bundled libtbb statically (which is default) or rebuild your distro's libtbb package with my patch so that mold's Link-Time Optimization (LTO) works reliably under a heavy load.
Bug fixes and compatibility improvements
- The
--icf=safeoption has been supported. This option enables a feature to find and deduplicate identical code that can be merged safely. For C++ programs, it typically reduces the output binary size by a few percent.--icf=safeneeds to be used with a compiler that supports.llvm_addrsigsection; if a compiler does not support it,--icf=safedoesn't do any harm but cannot optimize a given program at all. That section is supported by LLVM/Clang at the moment, and we are working on adding it to GCC. (#484, 27908af) - LTO now works reliably under a heavy load. mold used to abort occasionally under such condition on Linux due to a spurious failure of
pthread_create(2). (d8a8877) - mold now prints out undefined symbol errors in a format similar to LLVM lld. (13816a1)
- mold now prints out a better error message for the disk full situation. (5969260)
- mold can now build GCC 12 with LTO. (708ad63)
- Fixed an LTO issue on 32-bits hosts such as i686. (920266b)
- mold is now AddressSanitizer and UndefinedSanitizer clean. (fafb75b, 3499ee6)
- mold used to create broken debug info on 32-bits hosts (#490). The bug has been fixed. (0abd0a4)
- mold used to accept not only a single dash but also double dashes for single-letter options. For example,
--Swas accidentally accepted as an alias for-S. This is unconventional, and such options are no longer accepted. (232dafa) --color-diagnosticsis now an alias for--color-diagnostics=autoinstead of--color-diagnostics=alwaysfor compatibility with LLVM lld.pkg-configis no longer needed to build mold.- The
--package-metadataoption is supported. (#505, e9f6715)
Removed features
- An experimental
--preloadflag has been removed. (a85b1f5)
Acknowledgements
mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank you to everybody who sponsors our project. In particular, we'd like to acknowledge the following organizations and people who have sponsored $32/mo or more during this release cycle:
We'd also like to thank HPC Engineering at AWS to donate $5,000 AWS credits to us.
mold 1.2.1
mold 1.2.1 is a new release of the high-speed linker. This release contains the following bug fixes.
Bug fixes and compatibility improvements
- Various bugs in
--gdb-indexhave been fixed. - mold now recognizes
--thinlto-cache-dirand--thinlto-cache-policyfor the sake of compatibility with LLVM lld. (7ebd071) - mold can now handle TLS common symbols. It looks like GCC sometimes creates such symbol for a thread-local variable. (cf850f8)
- In some edge cases, mold created a non-versioned symbol and a versioned one for the same symbol, even though if one symbol is versioned, all symbols of the same name must be versioned. This bug has been fixed. (8298c0a)
- mold used to write a PLT address of a symbol instead of its address to
.symtab. This bug has been fixed. (e088db7) - mold can now handle an input file with more than 219 symbols. (f1f2d40)
/usr/local/libexec/mold/ldis now installed as a relative symlink instead of an absolute symlink. (5803c3c)
mold 1.2.0
mold 1.2.0 is a new release of the high-speed linker. The highlight of this release is the 32-bit ARM support. We also added other features, and as always, we fixed many bugs and compatibility issues in this release.
New features
- The ARM32 target is now supported.
--gdb-indexis implemented. If this option is given, mold creates an.gdb_indexsection in an output file to speed up GNU debugger. Users have to compile their object files with-ggnu-pubnamesto use this flag. mold used to ignore--gdb-index. (a7475dd)- mold now supports the following flags:
--start-address,-Tbss,-Tdata,-Ttext,--oformat=binary,--disable-new-dtags
Deprecated features
- An experimental, mold-specific
--preloadflag has been marked as deprecated. It's still usable, but a warning message will be displayed if that flag is given.
Bug fixes and compatibility improvements
-dyand-dnare now accepted as aliases for-Bdynamicand-Bstatic, respectively. (82e8072)-static-pienow works with older versions of glibc thanks to a few bug fixes. (3d68824, 0884f27)- Issues found by UndefinedBehaviorSanizer, AddressSanitizer and ThreadSanitizer are fixed. (bf26753, f4753b3, e1e4e9f)
- mold used to place sections with very large section alignment requirements to wrong places in an output file. That caused a mysterious crash of a produced binary (#405). That bug was most noticeable when Nvidia-provided object files are given because they tend to contain such sections. This bug has been fixed. (100922b)
.ctorsand.dtorssections are now recognized by mold, and their contents are sorted with a special rule. This shouldn't affect most build environments because these sections have been superseded by.init_arrayand.fini_arraysections a long time ago. But it looks like some old i386 compilers are still using.ctorsand.dtors. (392781a)- For a non-position-independent executable, we have to make address-taken PLT entries as "canonical". Marking all PLT entries canonical should be harmless in theory, so we did so. However, some programs, notably Qt library, assume that non-address-taken PLTs can never be canonical (#352). For the sake of compatibility with such programs, we now make PLTs canonical only when their addresses are taken. (e0bc74a)
- mold now defines
_TLS_MODULE_BASE_symbol. A reference to this symbol can occur if-mtls-dialect=gnu2is given to a compiler. The flag tells the compiler to use TLSDESC mechanism instead of the regular TLS access mechanism to access thread-local variables. (5feab82) - libbacktrace sometimes fail to read compressed debug sections in mold-generated files due to a bug. We not only fix that libbacktrace's bug (ianlancetaylor/libbacktrace#87) but also implemented a workaround to mold (ba63479) so that mold works with older versions of libbacktrace.
- [ARM64] mold now recognizes
R_AARCH64_LD_PREL_LO19relocation. (146ddd7) - [RISCV64] The correct semantics of
R_RISCV_ALIGNis implemented. (0daf623)
mold 1.1.1
mold 1.1.1 is a maintenance release of the high-performance linker. It contains the following new features, bug fixes and performance improvements including memory usage reduction.
New features
- The
--dependency-fileoption has been added. The option is analogous to the compiler's-MMoption; it generates a text file containing dependency information in the Makefile format, so that you can include a generated file into a Makefile to automate the file dependency management. (a054bcd) - mold has gained the
--reverse-sectionsoption. If the option is given, mold reverses the list of input sections before assigning them the addresses in an output file. This option is useful to find a bug in global initializers (e.g. constructors of global variables.) In C++, the execution order of global initializers is guaranteed only within a single compilation unit (they are executed from top to bottom.) If two global initializers are in different object files, they can be executed in any order. Reversing the execution order of the global initializers in different input files should help you identify a bug in your program. If your program does not work with-Wl,--reverse-sections, your program depends on the undefined behavior. --shuffle-sectionsnow takes an optional seed for the random number generator in the form of--shuffle-sections=<number>. (8f21cc3)- mold now supports the following LTO-related options for compatibility with LLVM lld:
--disable-verify,--lto-O,--lto-cs-profile-file,--lto-cs-profile-generate,--lto-debug-pass-manager,--lto-emit-asm,--lto-obj-path,--lto-partitions,--lto-pseudo-probe-for-profiling,--lto-sample-profile,--no-legacy-pass-manager,--no-lto-legacy-pass-manager,--opt-remarks-filename,--opt-remarks-format,--opt-remarks-hotness-threshold,--opt-remarks-passes,--opt-remarks-with_hotness,--save-temps,--thinlto-emit-imports-files,--thinlto-index-only,--thinlto-index-only,--thinlto-jobs,--thinlto-jobs,--thinlto-object-suffix-replace,--thinlto-prefix-replace(e413433) -noinhibit-execand--warn-shared-textrelhave been supported.
Performance improvements
- We optimized mold's memory usage by reducing the sizes of frequently-allocated objects. Compared to mold 1.1, we observed ~6% reduction of maximum resident set size (RSS) when linking Chromium. Our maximum RSS is smaller than LLVM lld and GNU gold as far as we tested. We measured maximum RSSes with
time -v. (f2d27d8, 7068c0c, 83e05da, 4dae896) - If Intel CET-based security-enhanced PLT is enabled (i.e.
-z ibtpltis given), mold used to create a PLT section in which each entry is 32 bytes long. We optimized the machine code sequence of the CET-enabled PLT section, so each PLT entry now occupies only 16 bytes, reducing the size of.pltby almost half. (480efde)
Bug fixes and compatibility improvements
-static-pienow works with recent versions of glibc. Previously, statically-linked position-independent executable would crash on startup when linked with mold. (3999aa8)- Previously, mold sometimes created corrupted output file on x86-64 if an input file containing thread-local variables were compiled with
-mcmodel=large(#360). This issue has been fixed. (4aa4bfa) - Previously, mold created corrupted debug info section on i386 if an input debug section is also compressed using the compiler
-gzoption. (#361) This issue has been fixed. (3068364) - mold used to create multiple
.init_arraysections if input files contain both writable and non-writable.int_arraysections. That caused an issue that some initializer functions would not be executed on process startup. (#363). This issue has been fixed. (4198627) - When building a large program with GCC LTO, mold occasionally failed with "too many open files" error. This issue has been resolved. (e67f460)
- Previously, mold created a corrupted dynamic relocation table if
.got.pltis missing. This issue has been fixed by always creating_GLOBAL_OFFSET_TABLE_symbol in.goton any target. mold used to try to create the symbol in.got.plton x86-64 or i386. (eb79859)