diff --git a/extra/mold/README b/extra/mold/README new file mode 100644 index 00000000..3bee3df7 --- /dev/null +++ b/extra/mold/README @@ -0,0 +1,70 @@ +Mold +________________________________________________________________________________ + +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. + + +Caveats +________________________________________________________________________________ + +* mold can not yet link the kernel. +* LTO is not yet supported (so refrain from using it) + +If a package fails to link with mold, open an issue at $/kisslinux/repo and +(until it is fixed) revert to using your previous linker for said package. + + +Usage +________________________________________________________________________________ + +The linker is typically located at /usr/bin/ld and is invoked by the compiler. +To use mold as the system linker, one of the following methods must be used. + +1. Use the alternatives system to set mold as the system linker. + ++------------------------------------------------------------------------------+ +| | +| $ kiss a mold /usr/bin/ld | +| | ++------------------------------------------------------------------------------+ + +2. Add --ld-path to CFLAGS/CXXFLAGS (Clang > 12.0) + ++------------------------------------------------------------------------------+ +| | +| $ export CFLAGS="$CFLAGS -ld-path=/usr/bin/mold" | +| $ export CXXFLAGS="$CXXFLAGS -ld-path=/usr/bin/mold" | +| | ++------------------------------------------------------------------------------+ + +3. Add -B to CFLAGS/CXXFLAGS (GCC) + ++------------------------------------------------------------------------------+ +| | +| $ export CFLAGS="$CFLAGS -B/usr/lib/mold" | +| $ export CXXFLAGS="$CXXFLAGS -B/usr/lib/mold" | +| | ++------------------------------------------------------------------------------+ + + +Verification +________________________________________________________________________________ + +To verify that mold is being used, disable binary stripping (KISS_STRIP=0) and +run the following command on a newly build executable. If 'mold' appears in the +output, everything is setup correctly. + ++------------------------------------------------------------------------------+ +| | +| $ readelf -p .comment /path/to/exe | +| | ++------------------------------------------------------------------------------+ + + +Further Reading +________________________________________________________________________________ + +* $/rui314/mold diff --git a/extra/mold/build b/extra/mold/build new file mode 100755 index 00000000..64b2ed30 --- /dev/null +++ b/extra/mold/build @@ -0,0 +1,26 @@ +#!/bin/sh -e +# +# This build system is a little funky. I want to contribute upstream to get the +# whole thing buildable with Makefiles (no Cmake). + +make -C xxhash + +# Point mold to the local xxhash. +export CXXFLAGS="-L$PWD/xxhash -I$PWD/xxhash $CXXFLAGS" + +# Prevent the build system from overwriting CC/CXX. +sed /clang/d Makefile > _ +mv -f _ Makefile + +# CMAKE_GENERATOR must be set to force usage of Makefiles. The build system +# calls cmake and proceeds to assume that Makefiles will be used with it. +make CMAKE_GENERATOR= LDFLAGS="$LDFLAGS -static" +make install + +# Create a symbolic link so users can use mold as the linker system-wide +# (without need for special CFLAGS/CXXFLAGS). +ln -s mold "$1/usr/bin/ld" + +# To tell GCC to use mold we must put a symlink to it in a directory and set it +# to search for the linker within. +ln -s ../../bin/mold "$1/usr/lib/mold/ld" diff --git a/extra/mold/checksums b/extra/mold/checksums new file mode 100644 index 00000000..da99432d --- /dev/null +++ b/extra/mold/checksums @@ -0,0 +1,2 @@ +bb4dea1e6b04ef989ffd4bd32c91a4f03fcd4853c849a9d0aae2a28e56aaa99f +7054c3ebd169c97b64a92d7b994ab63c70dd53a06974f1f630ab782c28db0f4f diff --git a/extra/mold/depends b/extra/mold/depends new file mode 100644 index 00000000..2e0ad68c --- /dev/null +++ b/extra/mold/depends @@ -0,0 +1,3 @@ +cmake make +openssl make +zlib make diff --git a/extra/mold/sources b/extra/mold/sources new file mode 100644 index 00000000..e2f798ae --- /dev/null +++ b/extra/mold/sources @@ -0,0 +1,2 @@ +https://github.com/rui314/mold/archive/refs/tags/vVERSION.tar.gz +https://github.com/Cyan4973/xxHash/archive/refs/tags/v0.8.0.tar.gz xxhash diff --git a/extra/mold/version b/extra/mold/version new file mode 100644 index 00000000..e582c77c --- /dev/null +++ b/extra/mold/version @@ -0,0 +1 @@ +0.9.3 1