v1.0.2
版本发布时间: 2022-01-23 16:49:14
rui314/mold最新发布版本:v2.34.0(2024-09-25 13:04:28)
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. (a5029d19a8fb70f77cb85f5ad58222d385abf716) - The following flags have been added:
-z ibt
(9ca6a9dc5e060e1283f9c3b413665640b02f1de5),-z cet-report
(31a43a7ba69f5ed0b22163dcd51f667055525831),-z shstk
(e29bd8f42b5571494138d22036fb2a4a2a2b55d2),-z ibtplt
(fbfa01dcd1f5c7a38a78ea6350d3635e1189b0e5) - [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. (92876820cb7f621d5fd3581874aee49b4a8ed881)
- [NetBSD] mold is now usable on NetBSD. (948248b732cea40057d1a66fd128f72dad87e09d)
- [x86-64] mold now emits compact 8-byte PLT entries instead of the regular 16-byte PLT entries if
-z now
is given. (0370e7f1b355cf577ee3b462148337ece3671e0b) - 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. (bd6afa1b23218c70877d318e8aac722298f931a8)
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. (d0c1c4db19b41d7b7720640c68faf7c79828437a) - 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. (d8dc8a67875bd49498612fb5c803116c220393d9)
Bug fixes and compatibility improvements
- mold can now link ICC-generated object files with GCC-generated ones even if the
-static
flag is given. (https://github.com/rui314/mold/issues/271, be6ae07ac181eb783f2d7428572a5e0aab879efa) - mold can now handle archive files (.a files) larger than 4 GiB. (bba506d6b4ba90b6857e95a3b6028b2985396629)
- 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 https://github.com/rui314/mold/issues/284. Now,mold --version
prints out something likemold 1.0.2 (compatible with GNU ld)
. We still need "GNU ld" for many./configure
scripts. (cea6a569afa544826c91fda7ef0f9941f50c9459) - 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. (ce5749ce2fdb41488f0b0608d3fcc5cb016d9683)
- 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. (27d836180fb7868bf7cd6e87917e0c09531dd945)
- 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. (4348417dd8df5ca19d3c173f9447f72a0fe39985) - [i386] mold now ignores some legacy symbols in an i386 CRT files to avoid duplicate symbol errors. (https://github.com/rui314/mold/issues/270, 0c1904672186bb9a395259cf71a276cff462fcbb)