./devel/mold, High performance drop-in replacement for existing Unix linkers

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 2.36.0, Package name: mold-2.36.0, Maintainer: pkgsrc-users

mold is a new linker that is optimized for modern multi-core machines.

mold is command-line compatible with the other major linkers, GNU ld, GNU gold
and LLVM lld, yet it is several times faster than them. Its goal is to increase
programmer productivity by speeding up program build time, especially for rapid
edit-build-test-debug cycles.


Master sites:

Filesize: 9858.163 KB

Version history: (Expand)


CVS history: (Expand)


   2025-01-13 11:37:08 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
mold: updated to 2.36.0

mold 2.36.0

New Features

The --package-metadata=<string> option has been added to embed a given \ 
string into the .note.package section. This option is designed for build scripts \ 
that generate binary packages, such as .rpm or .deb, to include package metadata \ 
in each executable. It simplifies the process of identifying the corresponding \ 
package for a given executable or core file. (7ddc8f4)
[ARM][PowerPC] We've improved the algorithm for creating range extension thunks \ 
to reduce memory usage and improve speed. For example, linking clang-19 for \ 
ARM64 is now ~7% faster than before. (9fc0ace)
[RISC-V][LoongArch] We've improved the algorithm for code-shrinking linker \ 
relaxation to reduce memory usage and improve speed. For example, linking \ 
clang-19 for RISC-V is now ~4% faster than before. (3234d88)

Bug Fixes and Compatibility Improvements

mold created a bad relocation for an IFUNC if the linker's output file type was \ 
a shared library and the symbol was exported. This bug could cause a \ 
segmentation fault of a linked program. The problem has now been fixed. \ 
(a297859)
[RISC-V] mold could produce incorrect code as a result of code-shrinking \ 
relaxation for the R_RISCV_HI20 relocation. That type of relocation was used \ 
rarely because it is not PC-relative. That being said, if your program used the \ 
relocation, and the relocation targets were at a low address (from 0x1f800 to \ 
0x20000), your program would crash at runtime due to the linker's bug. The issue \ 
has now been resolved. (eec3f6b)
[RISC-V][LoongArch] When the linker removed instructions from a function as a \ 
result of code-shrinking relaxation, the function symbol's size in the output \ 
file should be updated to reflect the result of relaxation, even though doing it \ 
is mostly cosmetic. mold did not do that. Now, mold sets correct sizes to output \ 
function symbols. (e6345d5)
[LoongArch] Binaries linked with mold now work on 64 KiB page systems. \ 
Previously, only up to 16 KiB pages were supported. (2d7b6b2)
[s390x] The s390x processor-specific ABI requires the linker to reserve the \ 
first three slots of the .got section for the runtime. mold, however, reserved \ 
only two slots and used the third for itself. Even though we did not observe \ 
issues in the wild, it was a violation of the psABI. The problem has now been \ 
fixed. (dfce2fc)
   2024-08-25 08:19:21 by Thomas Klausner | Files touched by this commit (575)
Log message:
*: replace CMAKE_ARGS with CMAKE_CONFIGURE_ARGS
   2024-05-15 15:02:04 by Kevin Bloom | Files touched by this commit (3) | Package updated
Log message:
mold: update to 2.31.0

Packaging changes:
- removed CMakeLists patch as it is no longer necessary

Upstream changes:
2.30.0 -> 2.30.1:
New Features:
- Up to 10% faster when linking very large, debug info-enabled
  executables
- `-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.
- -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.
Bug Fixes:
- if a linker script contains a newline character in the beginning
  four bytes of a file, it was not recognized as a linker script.
- the INPUT linker script command may have found a different file
  than GNU ld would
- Fixed the --repro option from produced corrupted tar files

https://github.com/rui314/mold/releases/tag/v2.30.1

2.4.1 -> 2.30.0:
Housekeeping:
- Version change to avoid GNU libtool from mistaking mold 2.4.1 for
  GNU ld 2.4.1
- Sections with unknown section types are now reported as errors.
Bug Fixes:
- Fixed having inserted an unnecessary gap before the .bss section in
  an output file, thereby creating an extra segment for it.
- Fixed failing with the "ConcurrentMap is full" error message if
  --gdb-index was used.
- Suppressed warnings for generating an excessive number of
  "ignoring .llvm_addrsig section without sh_link".

https://github.com/rui314/mold/releases/tag/v2.30.0

2.4.0 -> 2.4.1:
Bug Fixes:
- Fixed promoting weak dynamic symbols to strong ones under a rare
  circumstance, which caused "undefined symbol" error at runtime.
- 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
- 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

https://github.com/rui314/mold/releases/tag/v2.4.1

2.3.3 -> 2.4.0:
New Features:
- added the --spare-program-headers=<number> option
- `-z rewrite-endbr` option rewrites superflous endbr64 instructions
  with nop as a countermeasure against control-flow highjacking
  attacks.

Bug Fixes:
- Fixed not handling object files containing multiple .eh_frame
  sections
- `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.
- Fixed the production of non-working executables 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.
- Fixed possible assignment to a different symbol version to a symbol
- Recent versions of LLVM emit a machine code sequence for TLSDESC
  thread-local variables that would be mis-optimized.

https://github.com/rui314/mold/releases/tag/v2.4.0
   2023-11-16 21:42:17 by Frederic Cambus | Files touched by this commit (2) | Package updated
Log message:
mold: update to 2.3.3.

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.
- 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.
- --defsym can cause the linker to crash if a given symbol is not defined.
  The crash bug has been fixed.
- [POWER10] On rare occasions, pointers statically initialized to functions
  could be left as null pointers. This bug has been fixed.
   2023-11-05 17:59:36 by Frederic Cambus | Files touched by this commit (3) | Package updated
Log message:
mold: update to 2.3.2.

mold 2.3.0 ChangeLog:

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.

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.
- mold is now capable of handling input sections larger than 4 GiB.
- [PPC] mold can now generate executables for POWER10 processors. Previously,
  executables produced by mold would crash immediately on startup on POWER10.
- [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.
- [RISC-V] mold now supports new GP-relative relocations.

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.
- [LoongArch] mold is now capable of handling relocations generated for
  the -mcmodel=extreme flag.

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. (4cdfc7e)
- 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.
- 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.
- 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>.
- [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.
- [LoongArch] mold can now handle R_LARCH_PCALA_LO12 relocation for the
  jirl instruction.
   2023-09-28 16:47:59 by Frederic Cambus | Files touched by this commit (3) | Package updated
Log message:
mold: update to 2.2.0.

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.
- mold is now a few percent faster than the previous version due to an
  optimization of string merging code path.
- mold now emits slightly optimized code for thread-local variable accesses.
- [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 (riscv-non-isa/riscv-elf-psabi-doc#373)
  and implement it to compiler toolchain including GCC, GNU binutils and,
  of course, mold.

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.
- [PPC64] --execute-only now works on 64-bit PowerPC.
   2023-08-28 17:09:33 by Frederic Cambus | Files touched by this commit (4)
Log message:
*: reset MAINTAINER to pkgsrc-users@NetBSD.org.
   2023-08-15 19:32:22 by Frederic Cambus | Files touched by this commit (3) | Package updated
Log message:
mold: update to 2.1.0.

New features:

- Loongson's LoongArch CPU has been supported.
- -z nosectionheader has been added to eliminate section headers from the
  output file.

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.
- [ARM64] R_AARCH64_ADR_PREL_PG_HI21_NC relocation type has been supported.
- [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.
- [RISC-V] We now merge input .riscv.attributes contents. Previously, we
  just concatenated them.