mold 1.0.2
mold 1.0.2 is a maintenance release of the high-speed linker. It contains a few new features and various bug fixes as well as performance improvements.
New features
- mold now automatically falls back to
ld.bfd
orld.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 likemold 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)