|/
|\ISS               Tidbits  Posts  Answers  Install  Wiki  Contact  Donate  GitHub


mold                                                               version 0.9.6
________________________________________________________________________________

mold is a multi-threaded, high-performance linker that is several times faster
than the industry-standard ones, namely, GNU ld, GNU gold or LLVM lld. It is
developed as a drop-in replacement for these linkers and command-line compatible
with them with a few exceptions. [0]

Upstream: $/rui314/mold


[000] Index
________________________________________________________________________________

* Installation ........................................................... [001]
* Setup .................................................................. [002]
  * METHOD 1 (Compiler-agnostic) ......................................... [003]
  * METHOD 2 (Clang >= 12.0) ............................................. [004]
  * METHOD 3 (GCC) ....................................................... [005]
* Usage .................................................................. [006]
* Troubleshooting ........................................................ [007]
  * Package Fails To Link With Mold ...................................... [008]
* History ................................................................ [009]
* References ............................................................. [010]


[001] Installation
________________________________________________________________________________

+------------------------------------------------------------------------------+
|                                                                              |
|  $ kiss b mold                                                               |
|                                                                              |
+------------------------------------------------------------------------------+


[002] Setup
________________________________________________________________________________

To use mold as the system linker one of the following methods must be used.
The first solution is recommended as it removes all possibility of the prior
linker being executed by mistake.


--[003] METHOD 1 (Compiler-agnostic) -------------------------------------------

  Use the alternatives system to set mold as the system linker.

  +----------------------------------------------------------------------------+
  |                                                                            |
  |  $ kiss a mold /usr/bin/ld                                                 |
  |                                                                            |
  +----------------------------------------------------------------------------+


--[004] METHOD 2 (Clang >= 12.0) -----------------------------------------------

  Add --ld-path to CFLAGS/CXXFLAGS.

  +----------------------------------------------------------------------------+
  |                                                                            |
  |  $ export CFLAGS="$CFLAGS --ld-path=/usr/bin/mold"                         |
  |  $ export CXXFLAGS="$CXXFLAGS --ld-path=/usr/bin/mold"                     |
  |                                                                            |
  +----------------------------------------------------------------------------+

  In addition to --ld-path, the following may also be needed. Please NOTE the
  implications of this warning suppression and why METHOD 1 may be the best
  solution to this problem.

  +----------------------------------------------------------------------------+
  |                                                                            |
  | $ export CFLAGS="$CFLAGS -Wno-unused-command-line-argument"                |
  | $ export CXXFLAGS="$CXXFLAGS -Wno-unused-command-line-argument"            |
  |                                                                            |
  +----------------------------------------------------------------------------+


--[005] METHOD 3 (GCC) ---------------------------------------------------------

  Add -B to CFLAGS/CXXFLAGS (GCC)

  +----------------------------------------------------------------------------+
  |                                                                            |
  |  $ export CFLAGS="$CFLAGS -B/usr/lib/mold"                                 |
  |  $ export CXXFLAGS="$CXXFLAGS -B/usr/lib/mold"                             |
  |                                                                            |
  +----------------------------------------------------------------------------+


[006] Usage
________________________________________________________________________________

Mold does not yet support all use cases. It can not be used to link the Linux
kernel (due to lack of linker script support) and It has no support for LTO
(Link Time Optimization).

With mold as the default linker, running the package manager as normal should
result in its usage. To verify that mold is being used, disable binary stripping
(KISS_STRIP=0) and run the following command on a newly built executable.

+------------------------------------------------------------------------------+
|                                                                              |
|   $ readelf -p .comment /path/to/exe                                         |
|                                                                              |
+------------------------------------------------------------------------------+

If 'mold' appears in the output, everything is setup correctly.


[007] Troubleshooting
________________________________________________________________________________


--[008] Package Fails To Link With Mold ----------------------------------------

  If a package in the official repositories fails to link with mold, open an
  issue. If a package in a third-party repository fails to link with mold, open
  an issue in their tracker. If a package you maintain fails to link (and the
  issue is in the linker), open an issue upstream.


[009] History
________________________________________________________________________________

2021-09-27 80bbca61 mold: 0.9.6
2021-09-10 b31d9d37 mold: clarify clang method. Closes #332
2021-09-10 f6bc4cd5 mold: fix docs. See #332
2021-09-07 56aa29f0 mold: use release tarball
2021-09-07 172adbeb mold: 0.9.5
2021-09-03 846480af mold: revert to older version.
2021-08-29 653eda0d mold: import bug fix
2021-08-28 20d53eb8 mold: 0.9.4
2021-08-26 67210c84 mold: use more recent commit
2021-08-21 ce790b94 mold: new README
2021-08-17 070b1be2 mold: bump version to fix gcc
2021-08-16 1814fddf mold: fix typo
2021-08-16 324cd46d mold: use recent commit
2021-08-15 517f995a mold: fix typo
2021-08-15 60d9a593 mold: Use recent commit
2021-08-15 970b16ac mold: 0.9.3


[010] References
________________________________________________________________________________

[0] $/rui314/mold




________________________________________________________________________________

Dylan Araps (C) 2019-2021

The registered trademark Linux(R) is used pursuant to a sublicense from the
Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark
on a world­wide basis.