mold 2.32.0 is a new release of the high-speed linker. It includes the following new features and bug fixes:
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)-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)-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)--dependency-file
mistakenly recorded response files as dependencies (https://github.com/rui314/mold/issues/1258). This bug has been fixed. (4281f45f06db2dd6034bb064b263373e6fa6c862)--relocatable
option was given (https://github.com/rui314/mold/issues/1265). This issue has been fixed. (08b0a1629df5ea04fc1f8d38b28c7a1640241ebb)R_PPC64_TPREL16_LO_DS
relocation type is supported. (a8cd2e84e0ea3e5c2bd53f5924814f1539f83623)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:
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:
-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)INPUT
linker script command may have found a different file than GNU ld would. Now, mold's behavior aligns with GNU ld's. (163975d82ad73968c56f8da0372b4ea1645f2bff)--repro
option produced corrupted tar files. Now the bug has been fixed. (32c4a09debae11f5cb18434dc4c9ae35031c61b2).text
section as the entry point address if --entry
option is not given, just like LLVM lld. (020b1a78d9704ad8deca5cd5d63b0fe37f3e4162)__global_pointer$
symbol is now exported from executables as required by the processor-specific ABI. (3df7c8e89c507865abe0fad4ff5355f4d328f78d)--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)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:
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:
.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)--gdb-index
was used. This bug has been resolved. (c60d1d0877aeb713fc392d2e7c2396854cca0dbd)--gc-sections
has been fixed. (8eae0a33b374862345a7293d4a85a491c309d82b)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:
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.
rustc
. (ea9864bbd5da9cec3a2867d9ecd0754fb1b5c5d6)_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)R_PPC64_DTPREL16_LO_DS
relocation type has now been supported. (6d8e6afbf208e4aedda88fc44c9755e997f8ac91)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:
Published by rui314 11 months ago
mold 2.4.0 is a new release of the high-speed linker.
--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)-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).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)-mtls-dialect=gnu2
, mold might mis-optimize the output file. Now, the bug has been fixed. (000ce0ee52b8ded59a6f8f4fba6939a20b56449c)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:
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).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)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.
Published by rui314 12 months ago
mold 2.3.2 contains the following bug fixes.
.llvm.call-graph-profile
section. This change was made for compatibility. (37919009ab60b55c537931747c1a4b0cafc695e6).mold-lock
file for MOLD_JOBS
not in the home directory but in $XDG_RUNTIME_DIR
, which is usually /var/user/<uid>
. (39cdf61695847f13b9c69993dd8118a8a51966fb)R_LARCH_PCALA_LO12
relocation for the jirl
instruction. (d3188e39df2f8039d14ef1683a657bc8bbe681c5)Published by rui314 about 1 year ago
mold 2.3.1 contains the following bug fixes.
-mcmodel=extreme
flag. (4bd80ec21c0a345b9b1f1de83f0f620717a3e39f)Published by rui314 about 1 year ago
mold 2.3.0 is a new release of the high-speed linker.
[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)
.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)STO_AARCH64_VARIANT_PCS
flag to notify the dynamic linker. mold now appropriately sets this flag. (2e3b56ee3f9199944c7a56837206f22ee8f5e16a)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
Published by rui314 about 1 year ago
mold 2.2.0 is a new release of the high-speed linker.
--build-id
a few percent faster. libssl is no longer a build dependency. (7f7a744ebb9875e77f862a12e2fb9ca48ac27e7e)--execute-only
now works on 64-bit PowerPC. (ac20d8729b1c69929981703dc023601f68694dea, 51fec5f1ff46d9c56ab6486f4e8d710748ef4df0)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:
Published by rui314 about 1 year ago
mold 2.1.0 is a new release of the high-speed linker.
-z nosectionheader
has been added to eliminate section headers from the output file. (084ca55a36382017c07d0b510e9c8cf060f15163)-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)R_AARCH64_ADR_PREL_PG_HI21_NC
relocation type has been supported. (17a5c3e0ab8d169715fae6bfd8f4bb2a5c86a5e7)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).riscv.attributes
contents. Previously, we just concatenated them. (aa644914fe7c03a88511f07955d18b70ec587d83)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:
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:
--relocatable
option. Now the bug has been fixed. (2e8bd0b7a6d78e1bb2a08249bf83f7603a245174)-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
.R_RISCV_SET_ULEB128
and R_RISCV_SUB_ULEB128
relocation types are now supported (4bffe26bc0167f26c2bad0778f0f95e6be4809f2, 1ac5fe7c1e9678dca3c7e0bb0f96e1d20be969e5)R_PPC64_REL32
relocation type is now supported. (ebd780e8baf8722283be4d157a713d751bed0f81)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.
--hash-style=none
has been added to cancel --hash-style=sysv
, --hash-style=gnu
or --hash-style=both
. (ec756333cbfdb02dc96a4aebf9f8a9b374a4b5a7)R_ARM_PLT32
relocation type has been supported. (e50590043cb8d92fedfa48a08415511565fe2659)R_RISCV_PLT32
relocation type has been supported. (51845ac5fe1694de32bba1c9adf784185a8445c5).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)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:
Published by rui314 almost 2 years ago
mold 1.10.1 contains only the following bug fix:
-D_GLIBCXX_ASSERTIONS
. We fixed the unsafe memory access in this release. (7e6554677f3183da599f9699d78600da239d1508)Published by rui314 almost 2 years ago
--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)-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)--emit-relocs
is used with object files containing debug info. That bug has been fixed. (e17d7daee8fc9ccdf54bf52c156d9cae448fdd0f)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:
Published by rui314 almost 2 years ago
arch-*.cc
files in mold/elf/ directory to see how target-specific code actually looks like. (651adad5f2086746dc99c7dad9f60c86939149b8, 3411e17d8b2a8ad54c8266d6a706a042498c239f, 623151079488fef9ef7f7c23fe1ee73997950760)-gdb-index
option's crash bug on big-endian hosts. (3c968289f838c5dbf5ef5c64309605ea7e5ff850)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)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:
Published by rui314 almost 2 years ago
mold 1.8.0 is a new release of the high-speed linker.
--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).gnu.note.property
sections for various x86 properties. (d30d743cb0c5c6b4c5e21c9bd57dab72b0527c0b)--wrap
now works with LTO. (07d89116a8fd4766645cf3581ac755b56b0c2bc4)--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)-ffat-lto-objects
. (804b8439833604981a55d56346e5d1a86e43823c)-z nopack-relative-relocs
as an alias for --pack-dyn-relocs=none
for the sake of compatibility with GNU linkers. (b51058867776a6192abc2c9d864886a9252ab631)-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)--relocatable
output file. (8b373d38ce3baa6f99fcd8d3cc087069cbc452ea)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:
Published by rui314 almost 2 years ago
mold 1.7.1 is a bug-fix release containing only the following change:
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.
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:
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.
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.
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:
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.
-static-pie
. Previously, executables linked with that flag crashed immediately. (fc667594449fdcdf594cf1886d582a5d46332f24)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: