Mold 1.1 has already been released, know the news of this modern Linker superior to GNU gold and LLVM

Several days ago the release of the new version of the modern Linker Mold 1.1 was announced, which can be used as a faster transparent replacement for the GNU linker on Linux systems.

In this new version of mold 1.1 is a version that contains new features, bug fixes, and performance improvements.

About Mold

Mold supports all the features of the GNU linker and it has a very high performance, since the links it makes are only twice as slow as simply copying files with the cp utility.

In this way the reducing compilation time significantly improves the convenience of developing large projects by reducing the wait time in the executable file generation process when debugging and testing changes.

The motivation for creating Mold was the annoyance of having to wait for the link to complete after each code change, as well as the low efficiency of existing linkers in multicore systems and the desire to test a fundamentally different link architecture without resorting to unnecessarily complicated models such as incremental linking.

The high performance of linking an executable file from a large number of compiler-prepared object files in Mold is achieved through the use of faster algorithms, the active parallelization of operations between available CPU cores, and the use of data structures more efficient.

For example, Mold implements a technique to perform intensive calculations simultaneously with file copying, proactively loading object files into memory, using fast hash tables when resolving characters, scanning relocation tables in a separate stream and deduplicating sections that are repeated in different files.

Main novelties of Mold 1.1

In this new version of Mold 1.1 that is presented, it is highlighted that the support for link stage optimization (LTO, Link Time Optimization).

LTO optimizations differ by taking into account the state of all files involved in the build process, while traditional optimization modes optimize each file individually and do not take into account the conditions for calling functions defined in other files.

Previously, when GCC or LLVM intermediate code (IR) files were encountered, the appropriate ld.bfd or ld.lld linkers were invoked, but now Mold handles IR files on its own and uses the Linker plugin API, also used in GNU ld and GNU gold linkers. Speed ​​when LTO is enabled is only marginally faster than other linkers, as most of the time is spent optimizing the code, not linking.

It is also highlighted that options added “–print-dependencies” and “–print-dependencies=full” pTo generate information in CSV format about the dependencies between input files, which can, for example, be used to analyze connection reasons when linking certain object files or while working to minimize dependencies between files.

Another change that stands out from the new eversion is that the support for RISC-V architecture (RV64) on the host and target platforms.

In addition to that, we can also find that added “–emit-relocs” option to enable copying of address relocating sections from input files to final files for further optimizations to be applied at the post-link stage.

Of the other changes that stand out:

  • Added option “–shuffle-sections” to randomize the order of sections before fixing their addresses in the virtual address space.
  • Added “–warn-once” and “–warn-textrel” options.
  • Removed dependency on libxxhash.

Finally if you are interested in knowing more about it, you can check the details in the following link

How to install Mould?

For those who are interested in being able to work with Mold, they can obtain the utility by downloading and compiling the source code. To do this, simply open a terminal and type the following:

git clone https://github.com/rui314/mold.git
cd mold
git checkout v1.1.1
make -j$(nproc) CXX=clang++
sudo make install

To know the use of Mold, you can consult the documentation this link.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.