Skip to content

mold 1.0.1

Compare
Choose a tag to compare
@rui314 rui314 released this 31 Dec 05:20
· 3727 commits to main since this release

mold 1.0 is a maintenance release of the high-speed linker. It contains a few new features and various bug fixes.

New features

  • make install now creates /usr/local/libexec/mold/ld as a symlink to the mold executable. We do this for GCC. By passing -B/usr/local/libexec/mold, you can tell GCC to use ld inside that directory instead of /usr/bin/ld. (e8dcecf)
  • xxHash library is now included in the mold's source tree as a subtree for ease of building. If you want to link against a libxxhash in a system library directory, pass SYSTEM_XXHASH=1 to make. (665bffa)
  • The extern "C++" directive is now supported in the dynamic list. (7aa5c39)
  • --color-diagnostics is supported. mold used to ignore that flag. (6e290aa)
  • Not only * but also ? are now treated as special characters in the version script wildcard pattern. (31b0248)
  • The --threads=N option has been added as an alias for --thread-count=N. (f9ff048)
  • The following option has been added: --defsym (f6e8006), -z nodefaultlib (8c86c28), -z separate-code, -z noseparate-code and -z separate-lodable-segments (5601cf4), -z max-page-size (f3766cd)

Bug fixes and compatibility improvements

  • mold now issue a warning instead of an error for an unknown -z option. (8bc5736)
  • mold previously created a PT_NOTE segment for non-SHF_ALLOC note segments. This is a wrong behavior because we should create segments only for memory-allocated sections. This problem has been fixed. (76407a6)
  • Previously, a version script can affect symbol visibility of undefined symbols when they are promoted to dynamic symbols. This is a semantically incorrect behavior and caused a libQt build failure (#151). The issue has been fixed. (3663389)
  • Previously, mold silently turned unresolved undefined symbols into absolute symbols with value 0 if -shared, -z defs and -warn-undefined-symbols are specified. Even though this behavior makes sense, it's not compatible with GNU ld which promotes such symbols into dynamic symbols. This incompatibility causes a link failure for Firefox. Since 1.0.1, mold behaves the same as GNU ld. (04ccd4d)
  • Previously, mold applied wrong values for relocations against Initial-Exec thread-local variables. That caused a link failure for Mesa 3D graphics library (#197). The issue has been resolved. (d116113)
  • GCC 7 has a bug that it emits incorrect relocations against thread-local variables under a certain condition. That bug was unnoticed because existing linkers silently produces an output that works fine in most cases but is technically corrupted. mold used to check for that error condition and report an error. Now, mold does not report it as an error for the sake of bug-compatibility with GCC 7. I don't think relaxing the error check will cause any new issue to existing GCC 7 users, because if it does, they would have been experiencing the issue with existing linkers already. (d9606d6)
  • If an output file has more than one sections for thread-local BSS, they were laid out in such that they are overlapping with each other. This bug caused a runtime error for programs compiled with DMD, a compiler for the D language (#126). This layout issue has been resolved. (b151de6)
  • Previously, mold failed to look up correct files under --sysroot in some conditions. That caused a link failure for ClickHouse (#150). This bug has been fixed. (135f17c)