Up to [cvs.NetBSD.org] / pkgsrc / devel / mold
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
mold: updated to 2.37.1 mold 2.37.1 is a maintenance release of the high-speed linker. It includes the following bug fix: * Fixed a bug where mold incorrectly reported a spurious "duplicate symbol" error when LTO was enabled.
mold: updated to 2.37.0 2.37.0 New Features If an undefined weak symbol is not resolved to a defined symbol at link time, the linker can choose whether to promote the symbol to a dynamic symbol or not. If promoted, the weak symbol has another chance to be resolved to a defined symbol at load time. Otherwise, it is resolved to address 0 at link time. Previously, mold always resolved remaining undefined weak symbols in an executable to address 0 at link time. Now, you can instruct the linker to promote them to dynamic symbols using -z dynamic-undefined-weak. (1822e47) Bug Fixes and Compatibility Improvements [x86-64] The relocation types R_X86_64_CODE_4_{GOTPCRELX,GOTTPOFF,GOTPC32_TLSDESC} and R_X86_64_CODE_6_GOTTPOFF are now supported. These relocations are for Intel APX (Advanced Performance Extensions), which extends the number of general-purpose registers from 16 to 32. (83152ac, a17202d) [ARM32] The R_ARM_THM_JUMP8 relocation type is now supported. (1fbbcec) [ARM32] Previously, the .ARM.exidx section (which contains exception-handling records) was not subject to garbage collection, even when --gc-sections was specified. This prevented all functions from being garbage-collected, as they were referenced by exception-handling records. Now, mold correctly garbage-collects unused .ARM.exidx records and functions. (16f7599) Previously, --compress-debug-sections was ignored if --separate-debug-file was specified. Now, mold compresses debug information sections even when they are in a separate debug file.
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)
*: replace CMAKE_ARGS with CMAKE_CONFIGURE_ARGS
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
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.
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.
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.
*: reset MAINTAINER to pkgsrc-users@NetBSD.org.
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.
mold: update to 2.0.0. 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. 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. - 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. - [PPC64] R_PPC64_REL32 relocation type is now supported.
devel: Adapt packages to use USE_(CC|CXX)_FEATURES
mold: update to 1.11.0. New features: - IBM Power10 has been supported. Previously, mold created broken executables for that target. - --hash-style=none has been added to cancel --hash-style=sysv, --hash-style=gnu or --hash-style=both. - [ARM32] R_ARM_PLT32 relocation type has been supported. - [RISC-V] R_RISCV_PLT32 relocation type has been supported. 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. - 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. - [x86-64] mold can now link object files generated by old buggy versions of GCC. - [x86-64] Previously, a program with a very large .bss section may fail to link due to R_X86_64_REX_GOTPCRELX relocation overflow. This bug has been fixed.
mold: update to 1.10.1. 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.
mold: update to 1.10.0. 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. - [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. - [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. 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. - 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. - mold 1.9.0 might crash with SIGSEGV if --emit-relocs is used with object files containing debug info. That bug has been fixed.
mold: take back maintainership.
mold: update to 1.9.0. ChangeLog for mold 1.9.0: ------------------------- 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. 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. - Fixed a -gdb-index option's crash bug on big-endian hosts. - [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. ChangeLog for mold 1.8.0: ------------------------- 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.) - --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. - -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. - --[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. - 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. - mold now merges .gnu.note.property sections for various x86 properties. 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. - 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. - 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. - mold now tries to avoid creating copy relocations as much as possible. This change fixed a compatibility issue with GHC. - Thread-local variables are now correctly aligned even if there's a TLV with a large alignment. - mold can now handle GCC LTO files created with -ffat-lto-objects. - mold now accepts -z nopack-relative-relocs as an alias for --pack-dyn-relocs=none for the sake of compatibility with GNU linkers. - 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. - [ARM32, i386] mold now emits REL-type relocations instead of RELA-type for the --relocatable output file. ChangeLog for mold 1.7.1: ------------------------- 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. ChangeLog for mold 1.7.0: ------------------------- 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. Starting from the next LLVM release (we need llvm/llvm-project@20204db), 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. - 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.
mold: drop maintainership.
mold: update to 1.6.0. 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.
mold: update to 1.5.1. mold 1.5.1 is a new release of the high-speed linker. This version contains only the following bug fix. We recommend upgrading from 1.5.0 if you are being affected by this issue. - We changed the memory layout to save both memory and disk space in 1.5.0. Even though the new layout works fine on most systems, the change made the linker to create unusable executables for systems with large pages. Specifically, if you specify a large number for the -z max-page-size option, the loader refused to execute it with the error while loading shared libraries: cannot apply additional memory protection after relocation: Cannot allocate memory error. We reverted our recent commits so that mold creates output files with the same memory layout as it did before 1.5.0.
mold: update to 1.5.0. mold 1.5.0 is a new release of the high-speed linker. The highlight of this release is that we start supporting the following four new targets: PPC64LE, SPARC64, RV32BE and RV64BE. mold 1.5.0 also includes various bug fixes, performance and compatibility improvements as shown below. New features: - PPC64LE and SPARC64 are now supported as new targets. They haven't yet been as well tested as other targets, but they are already able to link mold itself on these platforms. (Note that PPC64LE is very unlikely to work on the most recent POWER10 machines as we didn't have a chance to test it due to a limited availability (POWER10 was released in 2021). If you can support us on this matter, please contact us. We also accept donations, so please consider supporting our project!) - RV32BE and RV64BE (32-bit and 64-bit big-endian RISC-V) are now supported as experimental targets. RISC-V is usually little-endian, but there exists a big-endian RISC-V as an extension. You can make gcc to emit code for big-endian RISC-V by passing -mbig-endian. mold can now link object files generated with that option. - --compress-debug-sections=zstd is now supported. This is an option to compress debug info embedded to an output file with Zstandard compression algorithm. Compared to the existing --compress-debug-sections=zlib, zstd is faster and gives a higher compression ratio. You probably can't start using zstd compression today though, because other tools such as gdb may not be able to read zstd-compressed debug info yet. But adding this option early makes mold future-proof. - mold no longer aligns loadable segments to page boundaries to reduce output file size. Previously, we allocated holes between loadable segments. The saving by this change is most visible for small programs. For example, a "hello world" program used to be ~18 KiB on x86-64. It's now 7.2 KiB. Bug fixes and compatibility improvements: - [RISCV] We optimized code so that the link speed for RISC-V is now comparable to the other targets. As an example, linking mold itself (~150 MiB in size) for RV64 used to take ~45 seconds on a simulated 16-core machine. It now takes only ~0.25 seconds. - mold used to create more than one .rodata section under a certain condition. It's not technically wrong but confused Valgrind. This issue has been resolved. - [ARM32] Previously, mold failed to promote remaining undefined symbols to dynamic symbols if symbols are undefined weak. That caused a link failure for libxml. This issue has been resolved. - mold didn't copy symbol types when creating symbol aliases for the --defsym option. Removed features: - --compress-debug-sections=zlib-gnu has been removed. LLVM lld removed that option too as there seems to be no usage of the flag.
mold: switch to using CMake to build the project. The long term plan for mold is to drop the Makefile and only support CMake in the future. As wiz@ pointed out, CMake is now called from the Makefile anyway and is required, so it makes sense to switch now. Python is now longer required as a build dependency, so clean those bits also.
mold: update to 1.4.2. New features and bug fixes: - [RV32] We've fixed several issues for 32-bit RISC-V. mold can now build complex programs including itself for the target. - [ARM32] mold gained range extension thunks so that it can now link programs whose .text is larger than 16 MiB. Previously, mold couldn't link such large programs. We've also fixed general stability issues for ARM32.
mold: update to 1.4.1. New features: - mold/macOS is now available as an alpha feature. We do not recommend using it for anything serious though. Starting from this version, we accept not only mold/Unix issues but also mold/macOS ones on our GitHub Issues. Feel free to file a bug if you encounter any problem. - We started supporting CMake in addition to Make to build mold. Our long-term plan is to migrate from Make to CMake because we want to support Windows eventually and CMake provides a better Windows support than Make does. Bug fixes and compatibility improvements: - There was a bug that mold accidentally exported a hidden symbol from an executable if a shared library linked to that executable happened to define the same symbol. This caused a build issue with Blender. The bug has been fixed. - --hash-style=both is now the default if no --hash-style option is given. Previously, --hash-style=sysv was the default. This change shouldn't affect most users because the compiler driver (cc, gcc, clang, etc.) always passes --hash-style to the linker. We made this change because GNU ld defaults to --hash-style=both. - Alias symbols defined by the --defsym option now have the same scope as the aliased symbols. Previously, alias symbols defined by --defsym were always hidden and never be exported as dynamic symbols. - mold now accepts foo = bar-style linker script directive to define symbol aliases. Previously, such statement was treated as a syntax error. This change was made to link mariadb-connector-c correctly. - Symbols in mergeable string sections now have correct output section indices instead of SHN_UNDEF. - [ARM32] Previously, calling a function from ARM code to Thumb code caused a program crash due to bug #442. This issue has been fixed.
mold: update to 1.4.0. New features: - Initial support for the 32-bit RISC-V (RV32) has landed. - mold now demangles Rust symbols in error messages thanks to eddyb's rust-demangle.c. - --export-dynamic-symbol and --export-dynamic-symbol-list are now supported for the sake of compatibility with LLVM lld. With these options, you can specify symbols that should be exported using glob pattern. - [x86-64] PLT entries created by mold now always begins with ENDBR64 instruction to improve compatibility with Intel IBT (Indirect Branch Tracking.) Bug fixes and compatibility improvements: - mold now defines __dso_handle symbol. The lack of this linker-synthesized symbol caused a link error with GCC in some environments.
mold: update to 1.3.1. mold 1.3.1 is a maintenance release of the high-speed linker. This release contains the following minor bug fixes. Bug fixes and compatibility improvements: - mold now supports .preinit_array sections. Without this, AddressSanitizer didn't work in some environments. (3b75398) - [ARM32] R_ARM_MOVT_PREL and R_ARM_PREL31 relocations are now handled correctly so that mold no longer emit spurious "recompile with -fPIC" errors. (5294300)
mold: fix the build by reverting to using SYSTEM_TBB=1.
mold: update to 1.3.0. Pkgsrc changes: - Remove now unneeded pkg-config from USE_TOOLS - Use <stdlib.h> on systems where <alloca.h> doesn't exist - Link the bundled (patched) libtbb, as per upstream recommendation Bug fixes and compatibility improvements: - The --icf=safe option has been supported. This option enables a feature to find and deduplicate identical code that can be merged safely. For C++ programs, it typically reduces the output binary size by a few percent. --icf=safe needs to be used with a compiler that supports .llvm_addrsig section; if a compiler does not support it, --icf=safe doesn't do any harm but cannot optimize a given program at all. That section is supported by LLVM/Clang at the moment, and we are working on adding it to GCC. - LTO now works reliably under a heavy load. mold used to abort occasionally under such condition on Linux due to a spurious failure of pthread_create(2). - mold now prints out undefined symbol errors in a format similar to LLVM lld. - mold now prints out a better error message for the disk full situation. - mold can now build GCC 12 with LTO. - Fixed an LTO issue on 32-bits hosts such as i686. - mold is now AddressSanitizer and UndefinedSanitizer clean. - mold used to create broken debug info on 32-bits hosts. The bug has been fixed. - mold used to accept not only a single dash but also double dashes for single-letter options. For example, --S was accidentally accepted as an alias for-S. This is unconventional, and such options are no longer accepted. - --color-diagnostics is now an alias for --color-diagnostics=auto instead of --color-diagnostics=always for compatibility with LLVM lld. - pkg-config is no longer needed to build mold. - The --package-metadata option is supported. Removed features: - An experimental --preload flag has been removed.
mold: install phase uses python3 command, provide a symlink. Thanks to wiz@ once again for the heads up.
mold: the install target requires Python.
mold: needs pkg-config.
mold: update to 1.2.1. Bug fixes and compatibility improvements: - Various bugs in --gdb-index have been fixed. - mold now recognizes --thinlto-cache-dir and --thinlto-cache-policy for the sake of compatibility with LLVM lld. (7ebd071) - mold can now handle TLS common symbols. It looks like GCC sometimes creates such symbol for a thread-local variable. (cf850f8) - In some edge cases, mold created a non-versioned symbol and a versioned one for the same symbol, even though if one symbol is versioned, all symbols of the same name must be versioned. This bug has been fixed. (8298c0a) - mold used to write a PLT address of a symbol instead of its address to .symtab. This bug has been fixed. (e088db7) - mold can now handle an input file with more than 219 symbols. (f1f2d40) - /usr/local/libexec/mold/ld is now installed as a relative symlink instead of an absolute symlink. (5803c3c)
mold: update to 1.2.0. mold 1.2.0 is a new release of the high-speed linker. The highlight of this release is the 32-bit ARM support. We also added other features, and as always, we fixed many bugs and compatibility issues in this release. New features: - The ARM32 target is now supported. - --gdb-index is implemented. If this option is given, mold creates an .gdb_index section in an output file to speed up GNU debugger. Users have to compile their object files with -ggnu-pubnames to use this flag. mold used to ignore --gdb-index. (a7475dd) - mold now supports the following flags: --start-address, -Tbss, -Tdata, -Ttext, --oformat=binary, --disable-new-dtags Deprecated features: - An experimental, mold-specific --preload flag has been marked as deprecated. It's still usable, but a warning message will be displayed if that flag is given. Bug fixes and compatibility improvements: - -dy and -dn are now accepted as aliases for -Bdynamic and -Bstatic, respectively. (82e8072) - -static-pie now works with older versions of glibc thanks to a few bug fixes. (3d68824, 0884f27) - Issues found by UndefinedBehaviorSanizer, AddressSanitizer and ThreadSanitizer are fixed. (bf26753, f4753b3, e1e4e9f) - mold used to place sections with very large section alignment requirements to wrong places in an output file. That caused a mysterious crash of a produced binary (#405). That bug was most noticeable when Nvidia-provided object files are given because they tend to contain such sections. This bug has been fixed. (100922b) - .ctors and .dtors sections are now recognized by mold, and their contents are sorted with a special rule. This shouldn't affect most build environments because these sections have been superseded by .init_array and .fini_array sections a long time ago. But it looks like some old i386 compilers are still using .ctors and .dtors. (392781a) - For a non-position-independent executable, we have to make address-taken PLT entries as "canonical". Marking all PLT entries canonical should be harmless in theory, so we did so. However, some programs, notably Qt library, assume that non-address-taken PLTs can never be canonical (#352). For the sake of compatibility with such programs, we now make PLTs canonical only when their addresses are taken. (e0bc74a) - mold now defines _TLS_MODULE_BASE_ symbol. A reference to this symbol can occur if -mtls-dialect=gnu2 is given to a compiler. The flag tells the compiler to use TLSDESC mechanism instead of the regular TLS access mechanism to access thread-local variables. (5feab82) - libbacktrace sometimes fail to read compressed debug sections in mold-generated files due to a bug. We not only fix that libbacktrace's bug (ianlancetaylor/libbacktrace#87) but also implemented a workaround to mold (ba63479) so that mold works with older versions of libbacktrace. - [ARM64] mold now recognizes R_AARCH64_LD_PREL_LO19 relocation. (146ddd7) - [RISCV64] The correct semantics of R_RISCV_ALIGN is implemented. (0daf623)
mold: update to 1.1.1. New features: - The --dependency-file option has been added. The option is analogous to the compiler's -MM option; it generates a text file containing dependency information in the Makefile format, so that you can include a generated file into a Makefile to automate the file dependency management. (a054bcd) - mold has gained the --reverse-sections option. If the option is given, mold reverses the list of input sections before assigning them the addresses in an output file. This option is useful to find a bug in global initializers (e.g. constructors of global variables.) In C++, the execution order of global initializers is guaranteed only within a single compilation unit (they are executed from top to bottom.) If two global initializers are in different object files, they can be executed in any order. Reversing the execution order of the global initializers in different input files should help you identify a bug in your program. If your program does not work with -Wl,--reverse-sections, your program depends on the undefined behavior. - --shuffle-sections now takes an optional seed for the random number generator in the form of --shuffle-sections=<number>. (8f21cc3) - mold now supports the following LTO-related options for compatibility with LLVM lld: --disable-verify, --lto-O, --lto-cs-profile-file, --lto-cs-profile-generate, --lto-debug-pass-manager, --lto-emit-asm, --lto-obj-path, --lto-partitions, --lto-pseudo-probe-for-profiling, --lto-sample-profile, --no-legacy-pass-manager, --no-lto-legacy-pass-manager, --opt-remarks-filename, --opt-remarks-format, --opt-remarks-hotness-threshold, --opt-remarks-passes, --opt-remarks-with_hotness, --save-temps, --thinlto-emit-imports-files, --thinlto-index-only, --thinlto-index-only, --thinlto-jobs, --thinlto-jobs, --thinlto-object-suffix-replace, --thinlto-prefix-replace (e413433) - -noinhibit-exec and --warn-shared-textrel have been supported. Performance improvements: - We optimized mold's memory usage by reducing the sizes of frequently-allocated objects. Compared to mold 1.1, we observed ~6% reduction of maximum resident set size (RSS) when linking Chromium. Our maximum RSS is smaller than LLVM lld and GNU gold as far as we tested. We measured maximum RSSes with time -v. (f2d27d8, 7068c0c, 83e05da, 4dae896) - If Intel CET-based security-enhanced PLT is enabled (i.e. -z ibtplt is given), mold used to create a PLT section in which each entry is 32 bytes long. We optimized the machine code sequence of the CET-enabled PLT section, so each PLT entry now occupies only 16 bytes, reducing the size of .plt by almost half. (480efde) Bug fixes and compatibility improvements: - -static-pie now works with recent versions of glibc. Previously, statically-linked position-independent executable would crash on startup when linked with mold. (3999aa8) - Previously, mold sometimes created corrupted output file on x86-64 if an input file containing thread-local variables were compiled with -mcmodel=large (#360). This issue has been fixed. (4aa4bfa) - Previously, mold created corrupted debug info section on i386 if an input debug section is also compressed using the compiler -gz option. (#361) This issue has been fixed. (3068364) - mold used to create multiple .init_array sections if input files contain both writable and non-writable .int_array sections. That caused an issue that some initializer functions would not be executed on process startup. (#363). This issue has been fixed. (4198627) - When building a large program with GCC LTO, mold occasionally failed with "too many open files" error. This issue has been resolved. (e67f460) - Previously, mold created a corrupted dynamic relocation table if .got.plt is missing. This issue has been fixed by always creating _GLOBAL_OFFSET_TABLE_ symbol in .got on any target. mold used to try to create the symbol in .got.plt on x86-64 or i386. (eb79859)
mold: update to 1.1. mold 1.1 is a new release of the high-performance linker. It contains a few new major features and various bug fixes. New features: - Native LTO (link-time optimization) support has been added. mold used to invoke ld.bfd or ld.lld if it encountered a GCC IR (intermediate representation) file or an LLVM IR file to delegate the task to the LTO-capable linkers, respectively. Now, mold handles IR files directly. This feature is implemented using the linker plugin API which is also used by GNU ld and GNU gold. Note that the LTO support has been added for completeness and not for speed. mold is only marginally faster than the other linkers for LTO builds because not linking but code optimization dominates. (46995bc) - RISC-V (RV64) is now supported as both host and target platforms. mold can link real-world large programs such as mold itself or LLVM Clang for RISC-V. (e76f7c0) - The -emit-relocs option is supported. If the option is given, mold copies relocation sections from input files to an output file. This feature is used by some post-link binary optimization or analysis tools such as Facebook's Bolt. (26fe71d) - mold gained the --shuffle-sections option. If the option is given, the linker randomly shuffle the order of input sections before fixing their addresses in the virtual address space. This feature is useful in some situations. First, it can be used as a strong form of ASLR (address space layout randomization). Second, you can enable it when you are benchmarking some other program to get more reliable benchmark numbers, because even the same machine code can vary in performance if they are laid out differently in the virtual address space. You want to make sure that you got good/bad benchmark numbers not by coincidence by shuffling input sections. (7e91897) - The --print-dependencies and --print-dependencies=full options were added. They print out dependencies between input files in the CSV format. That is, they print out the information as to which file depends on which file to use which symbol. We added this feature with a few use cases in mind. First, you can use this to analyze why some object file was pulled out from an archive and got linked to an output file. Second, when you want to eliminate all dependencies to some library, you can find all of them very easy with this feature. Note that this is an experimental feature and may change or removed in feature releases of mold. (a1287c2) - The following options are added: --warn-once (f24b997), --warn-textrel (6ffcae4) - Runtime dependency to libxxhash has been eliminated. (e5f4b96) Bug fixes and compatibility improvements: - A PT_GNU_RELRO segment is now aligned up to the next page boundary. Previously, mold didn't align it up, and the runtime loader align it down, so the last partial page would not be protected by the RELRO mechanism. Now, the entire RELRO segment is guaranteed to be read-only at runtime. (0a0f9b3) - The .got.plt section is now protected by RELRO if -z now is given. This is possible because writes to .got.plt happen only during process startup if all symbols are resolved on process startup. (73159e2) - Previously, mold reported an error if object files created with old GCC (with -fgnu-unique) are mixed with ones created with newer GCC or Clang (with -fno-gnu-unique) (#324). Now, mold accepts such input files. (e65c5d2) - mold can now be built with musl libc. (42b7eb8) - mold-generated .symtab section now contains section symbols and symbols derived from input shared object files. (e4c03c2, 1550b5a) - mold-generated executables can now run under valgrind. Previously, valgrind aborted on startup due to an assertion failure because it didn't expect for an executable to have both .bss and .dynbss sections. mold generated .dynbss to contain copy-relocated symbols. The section has been renamed .copyrel to workaround the valgrind's issue. (0f8bf23)
mold: update to 1.0.3. mold 1.0.3 is a maintenance release of the high-speed linker. It contains only the following bug fix: build-static.sh didn't create a statically-linked mold executable (#315). The problem is now fixed. (601b9e6)
mold: update to 1.0.2. New features: - mold now automatically falls back to ld.bfd or ld.lld if GCC-based LTO (link time optimization) or LLVM-based LTO are requested, respectively. This is a temporary hack until mold gains native LTO support. (a5029d1) - The following flags have been added: -z ibt (9ca6a9d), -z cet-report (31a43a7), -z shstk (e29bd8f), -z ibtplt (fbfa01d) - [ARM64] Range extension thunks are now supported. Previously, mold reported "relocation overflow" errors when the output file's text segment is larger than some threshold (~60 MiB). Now, it can link large programs just fine. (9287682) - [NetBSD] mold is now usable on NetBSD. (948248b) - [x86-64] mold now emits compact 8-byte PLT entries instead of the regular 16-byte PLT entries if -z now is given. (0370e7f) - RELR-type packed dynamic relocations are now supported. You can enable it by passing -z pack-dyn-relocs=relr. The good news is that it can typically reduce PIE (position-independent executable) size by a few percent. This is not a negligible saving because PIE is now default on many systems for security reasons. The bad news is that it needs a runtime support. To our knowledge, it's supported only on ChromeOS, Android, Fuchsia and SerenityOS at this moment. We need to wait for a while for other systems to catch up. (bd6afa1) Performance improvements: - Version script processor was rewritten with the Aho-Corasick string matching algorithm. If your program uses a version script that contains lots of glob patterns with the * metacharacter, you'll likely to see a significant speedup. (d0c1c4d) - Relocation processing for non-memory-allocated sections has been optimized. You'll likely to see a speedup if your binary contains large size of debug info. (d8dc8a6) Bug fixes and compatibility improvements: - mold can now link ICC-generated object files with GCC-generated ones even if the -static flag is given. (#271, be6ae07) - mold can now handle archive files (.a files) larger than 4 GiB. (bba506d) - mold no longer have "GNU gold" in its --version string. We had this identification string for some ./configure scripts that didn't work without it, but it causes other compatibility issue such as #284. Now, mold --version prints out something like mold 1.0.2 (compatible with GNU ld). We still need "GNU ld" for many ./configure scripts. (cea6a56) - Symbol resolution algorithm has been completely rewritten. The previous implementation was non-deterministic in some edge cases, meaning that outcomes from multiple runs of the linker with the same command line parameters could be different due to thread scheduling randomness or some other internal randomness. Now it is guaranteed to be deterministic. (ce5749c) - mold now try to pull out an object file from an archive if it's needed to resolve an undefined symbol with a common symbol. mold used to ignore common symbols in archives, so it could fail with an unresolved symbol error even if the undefined symbol could be resolved using a file in an archive. (27d8361) - mold no longer converts .ctors/.dtors sections into .init_array/.fini_array sections. mold used to convert them but in a wrong way. Since .ctors/.dtors have been superseded by .init_array/.fini_array long ago, it should be fine to stop doing this now. (4348417) - [i386] mold now ignores some legacy symbols in an i386 CRT files to avoid duplicate symbol errors. (#270, 0c19046)
Compatibility with NetBSD
mold: update to 1.0.1. New features: - make install now creates /usr/local/libexec/mold/ld as a symlink to the mold executable. We do this for GCC. By passing -B/usr/local/libexec/mold, you can tell GCC to use ld inside that directory instead of /usr/bin/ld. (e8dcecf) - xxHash library is now included in the mold's source tree as a subtree for ease of building. If you want to link against a libxxhash in a system library directory, pass SYSTEM_XXHASH=1 to make. (665bffa) - The extern "C++" directive is now supported in the dynamic list. (7aa5c39) - --color-diagnostics is supported. mold used to ignore that flag. (6e290aa) - Not only * but also ? are now treated as special characters in the version script wildcard pattern. (31b0248) - The --threads=N option has been added as an alias for --thread-count=N. (f9ff048) - The following option has been added: --defsym (f6e8006), -z nodefaultlib (8c86c28), -z separate-code, -z noseparate-code and -z separate-lodable-segments (5601cf4), -z max-page-size (f3766cd) Bug fixes and compatibility improvements: - mold now issue a warning instead of an error for an unknown -z option. (8bc5736) - mold previously created a PT_NOTE segment for non-SHF_ALLOC note segments. This is a wrong behavior because we should create segments only for memory-allocated sections. This problem has been fixed. (76407a6) - Previously, a version script can affect symbol visibility of undefined symbols when they are promoted to dynamic symbols. This is a semantically incorrect behavior and caused a libQt build failure (#151). The issue has been fixed. (3663389) - Previously, mold silently turned unresolved undefined symbols into absolute symbols with value 0 if -shared, -z defs and -warn-undefined-symbols are specified. Even though this behavior makes sense, it's not compatible with GNU ld which promotes such symbols into dynamic symbols. This incompatibility causes a link failure for Firefox. Since 1.0.1, mold behaves the same as GNU ld. (04ccd4d) - Previously, mold applied wrong values for relocations against Initial-Exec thread-local variables. That caused a link failure for Mesa 3D graphics library (#197). The issue has been resolved. (d116113) - GCC 7 has a bug that it emits incorrect relocations against thread-local variables under a certain condition. That bug was unnoticed because existing linkers silently produces an output that works fine in most cases but is technically corrupted. mold used to check for that error condition and report an error. Now, mold does not report it as an error for the sake of bug-compatibility with GCC 7. I don't think relaxing the error check will cause any new issue to existing GCC 7 users, because if it does, they would have been experiencing the issue with existing linkers already. (d9606d6) - If an output file has more than one sections for thread-local BSS, they were laid out in such that they are overlapping with each other. This bug caused a runtime error for programs compiled with DMD, a compiler for the D language (#126). This layout issue has been resolved. (b151de6) - Previously, mold failed to look up correct files under --sysroot in some conditions. That caused a link failure for ClickHouse (#150). This bug has been fixed. (135f17c)
mold: update to 1.0.0. mold 1.0 is the first stable and production-ready release of the high-speed linker. On Linux-based systems, it should "just work" as a faster drop-in replacement for the default GNU linker for most user-land programs. If you are building a large executable which takes a long time to link, mold is worth a try to see if it can shorten your build time. mold is easy to build and easy to use. For more details, see README. mold is created by a person who knows very well as to how the Unix linker should behave, as I'm also the original creator of the current version of the LLVM lld linker. There's no fancy new features in 1.0. Actually, 1.0 is very similar to 0.9.6. That being said, we'd like to make it clear by incrementing a major version number that mold for Linux is now stable. Changes since mold 0.9.6: - -start-lib and -end-lib options are added for compatibility with GNU gold and LLVM lld. - More ARM64 relocations are supported. - Compatibility with glibc 2.2 or prior has improved. (#120) - Compatibility with valgrind has improved. (#118) - -Bno-symbolic option has been supported. - -require-defined option has been supported.
mold: update to 0.9.6. mold 0.9.6 is a maintenance release of the mold linker. This release contains only a single change to fix the following issue: mold used to create dynamic relocations for imported symbols when creating a position-dependent executable. That worked fine in an environment in which position-independent code (PIC) is enabled by default such as recent versions of most Linux distros. However, it failed with the "recompile with -fPIC" error if PIC was disabled and a dynamic relocation was created in a read-only section. mold 0.9.6 fixed the issue by creating copy relocations and PLTs for such symbols.
mold: update to 0.9.5. Highlights of mold 0.9.5: - In 0.9.4, we changed the mold's behavior on remaining weak undefined symbols, so that they would be resolved to address zero if we were creating a shared object file with the -z defs option. Now, such symbols will be promoted to dynamic symbols so that they'll get another chance to be resolved at run-time. This change fixes a regression of Firefox build failure (#114), which depends on this particular linker behavior to export symbols from libxul.so. - mold can now be built on macOS. Note that mold is still able to produce only ELF (Unix) files — so you can use it for cross compilation on macOS for Linux, but you can't use mold for macOS native development. - Relocation overflow are now reported as errors on AArch64 and i386. Previously, such relocations were silently producing incorrect output. Highlights of mold 0.9.4: - mold -run now intercepts invocations of ld, ld.lld and ld.gold wherever they are in the directory hierarchy. Previously, they were intercepted only if they were in /usr/bin. This change was made because it is not uncommon to install a compiler toolchain into a directory other than the system bin directory. - AArch64 (Arm 64-bit) support has been significantly improved. mold can now link many real-world programs including itself for AArch64. - Fix an issue that relocation addends were not handled correctly for i386. - mold is now able to link LLVM compiler-rt's CRT files. - Fix an issue that a dynamic relocation was created for a read-only section if the relocation refers an unresolved weak symbol. - Undefined weak symbols are now always resolved to address 0 instead of being promoted to dynamic symbols.
devel/mold: import mold-0.9.3. 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.