mold

Mold: A Modern Linker 🦠

MIT License

Downloads
262
Stars
13.4K
Committers
100
mold - mold 2.32.0 Latest Release

Published by rui314 5 months ago

mold 2.32.0 is a new release of the high-speed linker. It includes the following new features and bug fixes:

New features

  • mold supports a feature called Identical Code Folding, or ICF. As the name suggests, ICF finds identical functions and merges them to reduce the size of an output file. This is especially effective for template-heavy C++ programs since templates tend to be instantiated to the same machine code for different types. For example, std::vector<int> is likely to be instantiated to the same code as std::vector<unsigned>. We've made an improvement to our ICF algorithm so that the --icf feature is ~50% faster than the previous version. (fa8e95a289f911c0c47409d5848c993cb50c8862)
  • The -z rodynamic option is now supported for compatibility with LLVM lld. With the option, mold places the .dynamic section into a read-only segment. (9a233df7e206ca944b8d996d4030c8645587b6f0)

Bug fixes and compatibility improvements

  • Previously, mold behaved differently compared to other linkers if both -z defs and --undefined=ignore-in-object-files were given (https://github.com/rui314/mold/issues/1270). Now, they override each other so that the mold's behavior is compatible with others. (8cd85aaa29093a315d2b905bdcab379ac922e73a)
  • Previously, --dependency-file mistakenly recorded response files as dependencies (https://github.com/rui314/mold/issues/1258). This bug has been fixed. (4281f45f06db2dd6034bb064b263373e6fa6c862)
  • There was a bug that mold corrupted debug info section contents when the --relocatable option was given (https://github.com/rui314/mold/issues/1265). This issue has been fixed. (08b0a1629df5ea04fc1f8d38b28c7a1640241ebb)
  • [PPC64] The R_PPC64_TPREL16_LO_DS relocation type is supported. (a8cd2e84e0ea3e5c2bd53f5924814f1539f83623)
  • [ARM64, PPC64, LoongArch] mold 2.31.0 or earlier may have failed with an assertion failure when creating a large output file (https://github.com/rui314/mold/issues/1224). This issue has been resolved. (c7c8583946dc84f5bb1278bfa1b84c87d6be80cd)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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 - mold 2.31.0

Published by rui314 6 months ago

mold 2.31.0 is a new release of the high-speed linker. It includes the following new features and bug fixes:

New features

  • mold is now up to 10% faster when linking very large, debug info-enabled executables such as Blender (~1.8 GiB) or Clang (~3.8 GiB), thanks to several improvements we've made to the string merging algorithm. (53ebcd80d888778cde16952270f73343f090f342, d71430118061ca2c8898f738f7f99ff5a7fb2cf5, 40f6b17edae892d717bd3a9fd75b25fcb2ee2268, c9faf3d34562d010b9e430ff3fec466c11db295e)
  • -z start-stop-visibility=hidden is now supported so that linker-synthesized __start_<section-name> and __stop_<section-name> symbols can be completely hidden from other ELF modules. Previously, only -z start-stop-visibility=protected was supported. (99a5b1541eb1b553cfda53c7f6590a79cbca0b11)
  • -Bsymbolic-non-weak and -Bsymbolic-non-weak-functions options are now supported for compatibility with LLVM lld. Just like lld, these options control which symbols are exported as dynamic symbols. -Bsymbolic-non-weak makes the linker to export only weak symbols, whereas -Bsymbolic-non-weak-functions makes it to export only weak function symbols. (7d17aa83ebeabeea1626fd21d94774993b5692b3)

Bug fixes and compatibility improvements

  • Previously, if a linker script contains a newline character in the beginning four bytes of a file, it was not recognized as a linker script by mold. Now, mold allows newlines at the beginning of a file. (ea054ccced2dce076fb468bc64bca969b3d8d056)
  • Under rare circumstances, the INPUT linker script command may have found a different file than GNU ld would. Now, mold's behavior aligns with GNU ld's. (163975d82ad73968c56f8da0372b4ea1645f2bff)
  • Previously, the --repro option produced corrupted tar files. Now the bug has been fixed. (32c4a09debae11f5cb18434dc4c9ae35031c61b2)
  • mold generally guarantees that its output is reproducible, meaning that if you run the linker with the exact same command line options and input files, the output is guaranteed to be bit-for-bit identical to the previous outputs. However, under rare circumstances, it might produce different output due to a bug. It's reported that this nondeterminism caused random crashes for some programs (https://github.com/rui314/mold/issues/1247). This bug has been fixed. (6463a7c48ab3d355be6a99e4f7e177bf959da398)
  • mold no longer sets the address of the .text section as the entry point address if --entry option is not given, just like LLVM lld. (020b1a78d9704ad8deca5cd5d63b0fe37f3e4162)
  • [RISC-V] __global_pointer$ symbol is now exported from executables as required by the processor-specific ABI. (3df7c8e89c507865abe0fad4ff5355f4d328f78d)
  • [ARM32] --long-plt option is now recognized as known option by mold. mold ignores the option, though, because the PLTs generated by our linker is always long. (d432e987a019ba213a21cfed89b01ba9041e1a2c)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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 - mold 2.30.0

Published by rui314 8 months ago

mold 2.30.0 is a maintenance release of the high-speed linker. It includes the following minor bug fixes:

  • We have increased the version number from 2.4.1 to 2.30.0, even though this release contains only minor bug fixes. This change was made to prevent GNU libtool from mistaking mold 2.4.1 for GNU ld 2.4.1, which led it to incorrectly conclude that our linker was an outdated version of the GNU linker. Bumping up the version number to align with GNU ld may not be the most elegant solution, but it is a practical approach to resolve the compatibility issue with GNU libtool. (c7f6a91da512ef8a2634a1bef5d4ba82104659fe)
  • Previously, mold may have inserted an unnecessary gap before the .bss section in an output file, thereby creating an extra segment for it. While not technically incorrect, it was certainly unnecessary. mold 2.30.0 eliminates this unnecessary on-disk gap for .bss. (c395da1c5414656e1b22f3e71a42ba17c51673a4)
  • Previously, under rare circumstances, mold might fail with the "ConcurrentMap is full" error message if --gdb-index was used. This bug has been resolved. (c60d1d0877aeb713fc392d2e7c2396854cca0dbd)
  • Previously, mold might generate an excessive number of "ignoring .llvm_addrsig section without sh_link" warnings. These warnings are now suppressed. (51f871f43b3f012a4367538f3bd831d701cb10ed)
  • Sections with unknown section types are now reported as errors. (d21207cc79bb8f6074a21ff1b588d50ab7e5fa2f)
  • [PPC32] A crash bug related to --gc-sections has been fixed. (8eae0a33b374862345a7293d4a85a491c309d82b)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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 - mold 2.4.1

Published by rui314 8 months ago

mold 2.4.1 is a maintenance release of the high-speed linker. It contains the following minor bug fixes.

  • mold 2.4.0 or prior may promote weak dynamic symbols to strong ones under a rare circumstance, which caused "undefined symbol" error at runtime. The bug has been fixed. (https://github.com/rui314/mold/commit/50bdf39ba57e29386de28bd0c303035e626fa29c)
  • Previously, if two or more VERSION clauses in a version script match to the same symbol, the first one took precedence. This was incompatible with GNU ld, which gives the last one the highest priority, causing a Qt library link failure. This compatibility issue has been resolved. (e1e16bf85a47b1e85944ca7fdbae858fddfe5e2e)
  • By default, we demangle symbols in error messages so that they are easier to read. Previously, Rust symbols could accidentally be demangled as C++ symbols. Now, mold attempts to demangle symbols as Rust ones only for object files created by rustc. (ea9864bbd5da9cec3a2867d9ecd0754fb1b5c5d6)
  • [RISC-V] mold now relaxes a GOT-load instruction sequence into a direct address materialization if the symbol address is known at link time. This relaxation eliminates one memory load and slightly improves the linked program's performance. (2ccaa81aaba64dfb7f9287bb960a0264b58d34e5)
  • [PowerPC64 ELFv2] GCC may emit references to _savegpr0_*, _restgpr0_*, _savegpr1_* and _restgpr1_* symbols for the -Os command line option to optimize the output for code size. These symbols are not defined by any object file and expected to be synthesized by the linker. mold didn't use to synthesize these symbols, and therefore object files created with -Os sometimes failed due to missing symbol errors. Now, mold synthesizes these symbols. (d4ff48a07e554098755848ea8ee43f40a420ea87)
  • [PowerPC64] R_PPC64_DTPREL16_LO_DS relocation type has now been supported. (6d8e6afbf208e4aedda88fc44c9755e997f8ac91)
  • [Illumos] On Illumos OS, absolute symbols in DSOs need to be resolved at runtime because the dynamic linker treats such symbols in a special manner. Previously, mold directly used absolute symbol addresses at link-time and did not place them into the dynamic symbol table. That optimization has been removed for compatibility with Illumos. (bed5b1731b7d94fe5655da3cdc7d87eab239eb4a, 7f8d77d84e7cfa725cd36fc6dc93da739461307f)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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 - mold 2.4.0

Published by rui314 11 months ago

mold 2.4.0 is a new release of the high-speed linker.

New features

  • mold gained the --spare-program-headers=<number> option, which adds a specified number of spare entries at the end of the program header. The option aims to make post-processing tools to add program header entries very easily. Note that sorting program header entries after adding new ones may be necessary to meet the constraints of the ELF file format. For details, see the elf(5) man page. (eb6c213f2a9aa8a101b2b52a791be369d165e6a9)
  • mold's -z rewrite-endbr option rewrites superflous endbr64 instructions with nop as a countermeasure against control-flow highjacking attacks. Previously, this worked exclusively with object files compiled with -ffunction-sections, requiring each function to be compiled into a separate section. Starting from this release, -z rewrite-endbr works on object files compiled without it. In other words, mold is now capable of rewriting endbr64 instructions even if the instruction is not at the beginning of a section. (3cb8a528a5c474c3435b9ff87848b52f96770990)

Bug fixes and compatibility improvements

  • Previously, mold couldn't handle object files containing multiple .eh_frame sections. The .eh_frame is a section containing data for exception handling. Usually, an object file contains only one .eh_frame which describes how to handle exceptions for all text sections in the same file. However, on rare conditions, it seems ld -r creates an object file containing multiple .eh_frame sections. mold is now able to handle such object files. (f4c5a8a42ecaf090a4aa14d52400bcaa341d53e2)
  • mold -run <command> is an easy way to run the given command with a virtual environment in which the ld command is replaced with mold. The feature is implemented using LD_PRELOAD to hook fork(2)-family functions. Before this release, some invocations of ld were not intercepted correctly because we missed the posix_spawnp(2) function. Now, the function is intercepted just like other fork(2)-family functions. (3fd1cec20e01fe249467cbd57f452ea96d3dbe81)
  • mold used to produce a non-working executable on a rare occasion when all thread-local variables lacked an initial value and the read-only data required alignment equal to or greater than the page size. This bug has been resolved. (de7d37e1fc01e7ad06fb07b4456022c4c0adf927)
  • Previously, mold might assign a different symbol version to a symbol compared to GNU ld if it matches both a wildcard pattern and an exact pattern in a version script. Our behavior is now compatible with that of GNU ld. (0fdbace9b2b1d078ebfabbdbe47dad83a7b8e6e5)
  • [x86-64, i686] Recent versions of LLVM emit a machine code sequence for TLSDESC thread-local variables that differs from GCC's, and mold previously mis-optimized this sequence, leading to crashes in the linked programs. In other words, if you are using LLVM/Clang and compile object files with -mtls-dialect=gnu2, mold might mis-optimize the output file. Now, the bug has been fixed. (000ce0ee52b8ded59a6f8f4fba6939a20b56449c)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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 - mold 2.3.3

Published by rui314 12 months ago

mold 2.3.3 contains the following bug fixes:

  • --dynamic-list has different semantics for executables and DSOs. Previously, mold implemented only the semantics for executables, causing issues with libraries such as musl that used this option. mold now handles the option for DSOs correctly. (da3f5dd4ecf4faaba466ba41c7c30ba4f8f73bfd)
  • Old object files often contain .ctors and .dtors sections, which hold function pointers for initializing and finalizing processes, respectively. Their roles have been superseded by .init_array and .fini_array on most targets. mold worked functioned correctly as long as input object files consistently use the old or the new sections. However, mixing object files that contain both types of initializers/finalizers resulted in some functions not being executed. This issue has been fixed. (3f88964527a38d4881ccebce27b23fa19b209507)
  • --defsym can cause the linker to crash if a given symbol is not defined. The crash bug has been fixed. (ff3d54d26f2f9adc17f7d18ecb5ac5ba11fa32ec)
  • [POWER10] On rare occasions, pointers statically initialized to functions could be left as null pointers. This bug has been fixed. (31c3b5397b91ea058dbd9e773e2a2c397f17558e)

Additionally, our dist.sh script that we use to create binary packages attached to the release notes pages is now reproducible. That means the script always creates bit-for-bit identical output for the same git commit, irrespective of the OS versions or environments in which it's run. This property is very useful as a countermeasure against supply chain attacks. You can now verify that the binaries we distribute are indeed built from the released version of source files by rebuilding the binaries yourself and comparing the outputs.

mold - mold 2.3.2

Published by rui314 12 months ago

mold 2.3.2 contains the following bug fixes.

  • mold no longer emits dynamic relocations against the text segment for GNU ifunc symbols. Previously, mold emitted such relocations for position-dependent executables. (4cdfc7e72c5c88010de0e43952b19fd48647848e)
  • mold no longer reports the "REL-type relocation table is not supported for this target" error and instead ignore incompatible relocation tables. LLVM generates such non-conforming relocation tables for the .llvm.call-graph-profile section. This change was made for compatibility. (37919009ab60b55c537931747c1a4b0cafc695e6)
  • mold now pads unused gaps in the text segment with interrupt or NOP instructions, instead of leaving them filled with zeros. This alteration does not change the program's semantics but prevents disassemblers from interpreting the spaces between functions as valid instructions. (c86a59a5112c47c6d60c4cbab09a9cc3d479964b)
  • mold now creates the .mold-lock file for MOLD_JOBS not in the home directory but in $XDG_RUNTIME_DIR, which is usually /var/user/<uid>. (39cdf61695847f13b9c69993dd8118a8a51966fb)
  • [ARM32] There was an issue preventing mold from being built on an ARMv8 64-bit ARM processor with an ARM32 userland, such as the 32-bit Raspberry Pi OS running on a Raspberry Pi 4. This build issue has been resolved. (02ead29989c0738fddfe837a8ee4b24b6e10176a)
  • [LoongArch] mold can now handle R_LARCH_PCALA_LO12 relocation for the jirl instruction. (d3188e39df2f8039d14ef1683a657bc8bbe681c5)
mold - mold 2.3.1

Published by rui314 about 1 year ago

mold 2.3.1 contains the following bug fixes.

  • [ARM32, ARM64, PowerPC, LoongArch] mold 2.3.0 would crash when handling large output files. This was due to a bug in the code that creates range extension thunks. This issue has now been resolved. (7be1b66791e2a21b8c8f516f8d622ab3617292c0)
  • [LoongArch] mold is now capable of handling relocations generated for the -mcmodel=extreme flag. (4bd80ec21c0a345b9b1f1de83f0f620717a3e39f)
mold - mold 2.3.0

Published by rui314 about 1 year ago

mold 2.3.0 is a new release of the high-speed linker.

New features

  • [x86-64] mold 2.3.0 has introduced an experimental flag, -z rewrite-endbr, which rewrites superfluous endbr64 instructions as nop.

    endbr64 is a relatively recent x86 instruction used to mark locations where an indirect jump instruction can transfer control. With control-flow integrity enabled (meaning endbr64 is effective), an indirect jump can only target an endbr64 or it will trigger a runtime exception. This mechanism significantly hinders certain control hijacking attacks, such as ROP or JOP, since attackers cannot jump to just any location.

    When given the -fcf-protection flag, GCC conservatively places an endbr64 at the beginning of every global function. This is because the function's address might be taken as a pointer by other translation units. However, in most cases, function addresses are not actually taken. This conservative approach results in an overabundance of unnecessary endbr64 instructions, leading to not only code bloating but also a potential decrease in security as there are more locations for an attacker to exploit.

    The new linker option, -z rewrite-endbr, aims to alleviate this issue. The linker can carry out a whole-program analysis on the input files to identify functions whose addresses are never taken. If -z rewrite-endbr is specified, mold will conduct this analysis and replace the initial endbr64 with a nop for functions whose addresses aren't taken.

    mold also emits an endbr64 in a PLT entry only when the address of the PLT entry is taken. (17f0d85efb427681f70db4f46a88a17dc660649f)

Bug fixes and compatibility improvements

  • mold now produces a more compact .gdb_index section when using the --gdb-index flag. Additionally, mold now generates a correct .gdb_index section for object files created by Clang. (a396fa400fb8aa5ecc766d83bb8ab0a646e295dd)
  • mold is now capable of handling input sections larger than 4 GiB. (0ce32d36d5923eb573589d3c78c5ec7ad8b2c32e)
  • [PPC] mold can now generate executables for POWER10 processors. Previously, executables produced by mold would crash immediately on startup on POWER10. (0f714710f0f55291b588f8eb9c1981b02c01fc7d)
  • [ARM64] When a function with a non-standard calling convention is exported, it's mandatory for the linker to turn on the STO_AARCH64_VARIANT_PCS flag to notify the dynamic linker. mold now appropriately sets this flag. (2e3b56ee3f9199944c7a56837206f22ee8f5e16a)
  • [RISC-V] mold now supports new GP-relative relocations. (ac3ee91cbddc84837f4fc4f9bfffe74a0fc76bef)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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:

Signal Slot Inc.
Mercury
G-Research-OSS
Jinkyu Yi
Emerge Tools
Cybozu, Inc.
jfmontanaro
Steven Noonan
Brett Slatkin
Dougall Johnson
Santiago Pastorino
CubeSoft, Inc.
Rahul Butani
Kyle Lacy
daquexian
Josh Triplett
Kiril Mihaylov

mold - mold 2.2.0

Published by rui314 about 1 year ago

mold 2.2.0 is a new release of the high-speed linker.

New features

  • We now use BLAKE3 as a cryptographic hash function instead of SHA256. This change has made --build-id a few percent faster. libssl is no longer a build dependency. (7f7a744ebb9875e77f862a12e2fb9ca48ac27e7e)
  • mold is now a few percent faster than the previous version due to an optimization of string merging code path. (1a13c5076e7e3f6528a6f98201e6b2f73ccde243)
  • mold now emits slightly optimized code for thread-local variable accesses. (f057fdadbabf888012c7b806f75bedf97caaff36, d56f528c27b1fb9330fe81ddc608d35f6a06815e)
  • [RISC-V] mold now supports TLSDESC relocations. TLSDESC is a new mechanism for faster thread-local variable access. We (@ishitatsuyuki) actually led the effort to ratify the specification (https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/373) and implement it to compiler toolchain including GCC, GNU binutils and, of course, mold. (141556db449395d7073d5f48cfd9844b9b006da5)

Bug fixes and compatibility improvements

  • mold no longer marks an as-needed .so as "needed" if the .so file is not directly used by the output file. Previously, mold marked a .so file as "needed" if the .so file was used by another "needed" .so file. (f02db0fa0f6fef9e25ccc168f68c81830dd4ed98)
  • [PPC64] --execute-only now works on 64-bit PowerPC. (ac20d8729b1c69929981703dc023601f68694dea, 51fec5f1ff46d9c56ab6486f4e8d710748ef4df0)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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 - mold 2.1.0

Published by rui314 about 1 year ago

mold 2.1.0 is a new release of the high-speed linker.

New features

  • Loongson's LoongArch CPU has been supported. (03b1a1cc6861e561ec690dc8de12f433092c4cb5)
  • -z nosectionheader has been added to eliminate section headers from the output file. (084ca55a36382017c07d0b510e9c8cf060f15163)

Bug fixes and compatibility improvements

  • Previously, linking with the -z pack-relative-relocs option produces an executable that glibc 2.38 refuses to run with DT_RELR without GLIBC_ABI_DT_RELR dependency error. Now, mold produces binaries compatible with glibc 2.38. (f467ad1add2ab6e381e0e458f026df197e63d487)
  • [ARM64] R_AARCH64_ADR_PREL_PG_HI21_NC relocation type has been supported. (17a5c3e0ab8d169715fae6bfd8f4bb2a5c86a5e7)
  • [ARM64] R_AARCH64_MOVW_UABS_G3 relocation type has now been handled as a PLT-generating relocation to fix an issue when main is not defined in the main executable but rather in a .so file. (e764557007d788f262cd971e026db88db22e8d3e)
  • [RISC-V] We now merge input .riscv.attributes contents. Previously, we just concatenated them. (aa644914fe7c03a88511f07955d18b70ec587d83)

Acknowledgements

mold is an open-source project, and we accept donations via GitHub Sponsors and OpenCollective. We thank everyone 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 - mold 2.0.0

Published by rui314 over 1 year ago

Mold 2.0.0 is a new major release of our high-speed linker. With this release, we've transitioned our license from AGPL to MIT, aiming to expand the user base of our linker. This was not an easy decision, as those who have been following our progress know that we've been attempting to monetize our product through an AGPL/commercial license dual-licensing scheme. Unfortunately, this approach didn't meet our expectations. The license change represents our acceptance of this reality. We don't want to persist with a strategy that didn't work well.

As always, we welcome new GitHub sponsors. If you are happy with the license change, please consider becoming a sponsor.

In addition to the license change, here is a list of updates we have made in this release:

  • Previously, mold could not produce an object file with more than 65520 sections using the --relocatable option. Now the bug has been fixed. (2e8bd0b7a6d78e1bb2a08249bf83f7603a245174)
  • mold now interprets -undefined as a synonym for --undefined instead of -u ndefined. This seems inconsistent, as -ufoo is generally treated as -u foo (which is an alias for --undefined foo), but this is the behavior of the GNU linkers and LLVM lld, so we prioritize compatibility over consistency.
  • -nopie is now handled as a synonym for --no-pie.
  • [RISC-V] R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 relocation types are now supported (4bffe26bc0167f26c2bad0778f0f95e6be4809f2, 1ac5fe7c1e9678dca3c7e0bb0f96e1d20be969e5)
  • [PPC64] R_PPC64_REL32 relocation type is now supported. (ebd780e8baf8722283be4d157a713d751bed0f81)
mold - mold 1.11.0

Published by rui314 over 1 year ago

mold 1.11.0 is a new release of the high-speed linker. This is not a big release but includes general improvements and bug fixes.

New features

  • IBM Power10 has been supported. Previously, mold created broken executables for that target. (5065547c4e71ffa4dc34b0c87a0d1df4617bf8c0)
  • --hash-style=none has been added to cancel --hash-style=sysv, --hash-style=gnu or --hash-style=both. (ec756333cbfdb02dc96a4aebf9f8a9b374a4b5a7)
  • [ARM32] R_ARM_PLT32 relocation type has been supported. (e50590043cb8d92fedfa48a08415511565fe2659)
  • [RISC-V] R_RISCV_PLT32 relocation type has been supported. (51845ac5fe1694de32bba1c9adf784185a8445c5)

Bug fixes and compatibility improvements

  • Previous versions of mold failed to link some programs in rare corner cases if Link-Time Optimization (LTO) is enabled. These bugs have been fixed. (e1a7590db372e3ae0c1e0b18c6dfa5e0165ed85f, 62d65371d764263263329bbe5ce68836787b4223)
  • mold used to ignore dependencies between DSOs. Since this version, if a required DSO depends on other as-needed DSO, mold keeps the latter DSO as a required one. This improves compatibility with GNU linkers. (1adde7aa513bd2f3b50c6e6cf1a2093b68f85f10)
  • [x86-64] mold can now link object files generated by old buggy versions of GCC. (d2970e096d3992a2efeefcc23f1b0374b5e2e328)
  • [x86-64] Previously, a program with a very large .bss section may fail to link due to R_X86_64_REX_GOTPCRELX relocation overflow (https://github.com/rui314/mold/issues/975). This bug has been fixed. (627bf7c8efbe87d6329ef18e37decc74412d1810)

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 - mold 1.10.1

Published by rui314 almost 2 years ago

mold 1.10.1 contains only the following bug fix:

  • mold 1.10.0 had a buffer overrun bug that causes the linker to terminate immediately if compiled with -D_GLIBCXX_ASSERTIONS. We fixed the unsafe memory access in this release. (7e6554677f3183da599f9699d78600da239d1508)
mold - mold 1.10.0

Published by rui314 almost 2 years ago

New features

  • mold now officially supports the --print-dependencies option to print out dependency information between input files. Here is a truncated example output when linking mold itself with the option. There are many use cases of the option; for example, if you want to eliminate the dependency to some library from your program, you can use this option to find out all the functions that use the library's function to fix them. (6fd47dbab4a10eee56f0fb1170370defde5a560e)
  • [x86-64][s390x] mold now optimizes thread-local variable accesses in shared libraries if the library is linked with -z nodlopen. If your shared library is not intended to be used via dlopen(2) and your library frequently accesses thread-local variables, you might want to pass that option when linking your library. (25d02bb2613b631180848de05020349b7fd1002c, f32ce333dd9bc8e919a32439da1e04bbed7f705b)
  • [arm64] mold is now able to optimize GOT load by rewriting an ADDR+LDR instruction pair with an ADDR+ADD if the loaded GOT value is known at link-time. (f2311b1efab41e9f69a8d1c0e863f3a811686f88)

Bug fixes and compatibility improvements

  • mold 1.9.0 was up to 10% slower than 1.8.0 on some multicore machines. We fixed the performance regression and made it even faster than 1.8.0. (7132822cc7c5b1aaa16b64e66b78d5fcc8f02563)
  • Previously, mold failed to report an undefined symbol error if there's a weak undefined symbol of the same name. That bug resulted in producing a non-working executable instead of reporting a link failure. Now, mold correctly reports such link errors. (8936194ba7293dd362c7441814d8318b925907de)
  • mold 1.9.0 might crash with SIGSEGV if --emit-relocs is used with object files containing debug info. That bug has been fixed. (e17d7daee8fc9ccdf54bf52c156d9cae448fdd0f)

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 - mold 1.9.0

Published by rui314 almost 2 years ago

New features

  • mold gained support for the three new targets: 32-bit PowerPC, SH-4 and DEC Alpha. Each porting work didn't take more than a few days for us to complete, which demonstrate how portable the mold linker is. You can typically port mold to a new target just by writing a few hundreds lines of target-specific code. See arch-*.cc files in mold/elf/ directory to see how target-specific code actually looks like. (651adad5f2086746dc99c7dad9f60c86939149b8, 3411e17d8b2a8ad54c8266d6a706a042498c239f, 623151079488fef9ef7f7c23fe1ee73997950760)

Bug fixes and compatibility improvements

  • In a rare occasion, a statically-initialized function pointer might get a wrong address in a statically-linked executable. This bug has been fixed. (ccd47db91653aebacc52dd3b6fb7833990122dc3)
  • Fixed a -gdb-index option's crash bug on big-endian hosts. (3c968289f838c5dbf5ef5c64309605ea7e5ff850)
  • [RISC-V] mold rewrote machine instructions in a wrong way as a result of a wrong R_RISCV_HI20 relaxation if the output file was being linked against the high address. It's not a problem for user-land programs, but kernels linked with mold could crash due to this bug. This bug has been fixed. (3c968289f838c5dbf5ef5c64309605ea7e5ff850)

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 - mold 1.8.0

Published by rui314 almost 2 years ago

mold 1.8.0 is a new release of the high-speed linker.

New features

  • The --relocatable (or -r) option has been reimplemented to improve its performance and compatibility with the GNU linkers. That option tells the linker to combine input object files into another object file instead of into an executable or a shared library file. mold has been supporting the feature since version 0.9, but until now the output file created with -r looked fairly different from what GNU linkers would produce. GHC (Glasgow Haskell Compiler) in particular uses re-linkable object files as dynamic libraries instead of real .so files, and it didn't work with mold. Now, mold can produce object files that GHC can load. Note that this work was funded by Mercury, so thanks to the company to help us improve the product. (Yes, you can ask us to prioritize your feature request by funding the project.) (c9a7ae733c265e8e876ec6d5654399b3d9db726e)
  • --relocatable-merge-sections option has been added. By default, mold keeps original input section names for the --relocatable output and therefore does not merge input sections into a single output sections unless they are of the same name. If --relocatable-merge-sections is given, mold merges input by the usual default merging rule. For example, .text.foo and .text.bar are merged to .text if and only if --relocatable-merge-sections is given for the --relocatable output. (c2a0ae1c9692d0bbac8d6a6f4fb61bedaa19fa44)
  • -z [no]dynamic-undefined-weak options have been added. This option controls whether an undefined weak symbol is promoted to a dynamic symbol or not. (ed235f3db64b1bf20add3713a1d63a0ad09d5de6)
  • --[no-]undefined-version options have been supported. Now, mold warns on a symbol name in a version script if it does not match with any defined symbol. This change was made so that it is easy to find a typo in a version script. (e2d7353213004f5eac0eeda372dac7cbbdb1cb28)
  • mold now warns on symbol type mismatch. If two object files have the same symbol with different symbol types, it usually means your program has a bug. Chances are, you are using the same identifier as a function name in one translation unit and as a global variable name in another. So it makes sense to warn on the mismatch. (b70211ec08353b4a823be0fb99857dfc29750751)
  • mold now merges .gnu.note.property sections for various x86 properties. (d30d743cb0c5c6b4c5e21c9bd57dab72b0527c0b)

Removed features

  • The experimental macOS/iOS support has been removed from mold. If you want to use it, please use our sold linker instead.

Bug fixes and compatibility improvements

  • --wrap now works with LTO. (07d89116a8fd4766645cf3581ac755b56b0c2bc4)
  • A global variable initialized with an IFUNC function pointer is now initialized correctly with the function's address. Previously, it was mistakenly initialized to the function resolver's address. (b2858d268086b8ff384586b117d38d771e1c48a7)
  • The filename specified by --version-script or --dynamic-list is now searched from library search paths if it does not exist in the current working directory. This behavior is compatible with GNU linkers. (3c1a0550da7a65e24f9f4872a2ebc637e3b0a1e5, 8c87f1659292feab06e0b7688d2a48f334418b7a)
  • mold now tries to avoid creating copy relocations as much as possible. This change fixed a compatibility issue with GHC. (5866c9e95abb7d5a387d82e80b7c14ad8ab475ba)
  • Thread-local variables are now correctly aligned even if there's a TLV with a large alignment. (bd46edf3f0fe9e1a787ea453c4657d535622e61f)
  • mold can now handle GCC LTO files created with -ffat-lto-objects. (804b8439833604981a55d56346e5d1a86e43823c)
  • mold now accepts -z nopack-relative-relocs as an alias for --pack-dyn-relocs=none for the sake of compatibility with GNU linkers. (b51058867776a6192abc2c9d864886a9252ab631)
  • mold now recognizes -z start-stop-visibility=hidden but ignores it because it's the default for mold. GNU linkers support this option to control the visibility of linker-synthesized __start_<sectname> and __stop_<sectname> symbols, with global as the default visibility. mold creates these symbols with the hidden visibility by default, which is desirable for almost all cases. (22c9ec8cb6bf32ff67da5b68c3c9cc23cc76ec63)
  • [ARM32, i386] mold now emits REL-type relocations instead of RELA-type for the --relocatable output file. (8b373d38ce3baa6f99fcd8d3cc087069cbc452ea)

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 - mold 1.7.1

Published by rui314 almost 2 years ago

mold 1.7.1 is a bug-fix release containing only the following change:

Bug fix

  • mold 1.7.0 may generate the same build-id for two different output files. We fixed the issue in 1.7.1 so that build-id is guaranteed to be unique for each different output file. (d8dd12426c1f20c21dfcf5d4021a7c89c88ed727)

Licensing

My comment in the last release notes about a possible license change caused an overwhelming response. Thank you guys for taking care of the software and its ecosystem. We will reconsider our plan based on the feedback. We may still want to change the license of mold/macOS, but we are not going to change the license of mold/Unix at least in a next few releases.

On this occasion, I want to say something. We are not a big evil corp who are trying to squeeze as much money as possible from users. This is mostly a one-person project, and what we are trying to do is to create better tools and make them publicly available to improve programmers' productivity worldwide. If you think of the number of developers who are using compiled languages and how many person-minutes we can save every year with better tools, the sum is a huge saving. We'd like to get a small chunk of it as a return. I believe we are doing good job at creating better tools but struggling to establish a way to get a return from it.

Please keep in mind that there are always people behind an open-source project. Some feedback to my comment were honestly too harsh and disrespectful. Open-source is as much as about people as it is about software. Please respect each other even if you have a different opinion.

By the way, for those who wish to obtain a copy of the mold linker in a different license than AGPL, we finally set up our company web site. You can purchase a license of the "sold" linker (which is a rebranded mold linker) using credit card. Unlike mold, sold is available under a usual per-user, per-month license. We believe this is a good option for some organizations, so please visit our website at bluewhale.systems to check it out.

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 - mold 1.7.0

Published by rui314 almost 2 years ago

mold 1.7.0 is a new release of the high-speed linker.

Just like previous versions, you need to apply https://github.com/oneapi-src/oneTBB/commit/137c1a88b690acf3525e0f279720ac489ce66481 to libtbb if you do not use a bundled version of OneTBB library. OneTBB has merged this patch, but the most recent release of OneTBB hasn't picked it up yet.

Licensing

I'd like to inform users that I'm seriously considering changing the mold's license from AGPL to a source-available license unless I secure big funding. The new license would be something like individuals can use it for free but corporate users have to pay. mold started as my personal project, and I've been working on this full time for two years so far. I thought that I could earn a comfortable income if mold become popular, but unfortunately, I'm still losing my money. I think I need to take an action to make the project sustainable long term. For the details, please read my post.

New features

  • [m68k] mold now supports the Motorola 68000 series microprocessors. Yes, it's the processor in the original Mac or Sun workstations in the 80s. This work is sponsored by m68k hobbyist communities.

Bug fixes and compatibility improvements

  • We fixed a few issues for Facebook/Meta's BOLT optimizer (https://github.com/rui314/mold/issues/789). Starting from the next LLVM release (we need https://github.com/llvm/llvm-project/commit/20204db50389d9c2b7796722d69e9c94a6a37be5), BOLT should work on mold-generated executables out of the box.
  • We fixed a long-standing symbol resolution issue involving GNU UNIQUE symbols which caused a link failure for a few programs. (730e970e7908bc31e07ceb5ee08614a3a3596e67)
  • Previously, if a version script contains a "C++" directive, and a symbol matches a non-C++ version pattern and a C++ version pattern, a wrong version could be assigned to the symbol. This has been fixed so that the mold's behavior matches with GNU ld. (9875150677f9969fa0fbc662de478fdd6bc4421f)

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 - mold 1.6.0

Published by rui314 about 2 years ago

mold 1.6.0 is a new release of the high-speed linker. This release adds support for two IBM-based platforms, though we are not affiliated with IBM. We are happy to take donations and/or make support contracts. If you are interested in financially supporting the project, please visit our GitHub Sponsors page.

New features

  • [ppc64] mold now supports the original 64-bit big-endian PowerPC ABI (which is also known as PPC64 ELFv1 or just ppc64), so that you can build applications for older PPC64 systems with mold. Note that this should not be confused with the modern PPC64 ELFv2 ABI (which is also known as ppc64le), which is already supported by mold.
  • [s390x] Linux/s390x is now supported. Linux/s390x is the Linux environment on IBM z/Architecture mainframes. I've personally never seen a mainframe, but we wanted to support it because many Linux distros actively support that target, which in turn means there are many enterprise users who are using IBM mainframes. Speaking of the porting effort, we do not only port our linker to s390x but also found a couple of issues with the existing GCC toolchain for s390x. So, we are improving the whole IBM mainframe ecosystem!
  • mold now creates smaller output files. It is most noticeable on targets with large page sizes such as PPC64 (on which the common page size is 64 KiB), but even on x86-64, it should save a few kilobytes per an output file.

Bug fixes and compatibility improvements

  • [arm64] mold can now link executables with -static-pie. Previously, executables linked with that flag crashed immediately. (fc667594449fdcdf594cf1886d582a5d46332f24)

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:

Package Rankings
Top 4.09% on Proxy.golang.org
Top 5.37% on Alpine-edge
Top 1.42% on Alpine-v3.18
Top 15.9% on Spack.io
Top 13.2% on Formulae.brew.sh
Top 8.18% on Alpine-v3.17
Badges
Extracted from project README
Packaging status