summaryrefslogtreecommitdiff
path: root/sys-devel/mold
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/mold')
-rw-r--r--sys-devel/mold/Manifest4
-rw-r--r--sys-devel/mold/files/mold-2.33.0-icf.patch41
-rw-r--r--sys-devel/mold/mold-2.33.0-r1.ebuild106
-rw-r--r--sys-devel/mold/mold-9999.ebuild7
4 files changed, 155 insertions, 3 deletions
diff --git a/sys-devel/mold/Manifest b/sys-devel/mold/Manifest
index 5adb023ddcd2..cfdeb9bba320 100644
--- a/sys-devel/mold/Manifest
+++ b/sys-devel/mold/Manifest
@@ -1,9 +1,11 @@
AUX mold-2.32.1-libdl.patch 632 BLAKE2B db9a5911f5587c33d27a38347a027c3d93cbca41a0328e6a290760c32a4738db4a7241eb3b041d81c1ebb6e20bd9b752573d4e13e1812925adf07dcda2fe5d4f SHA512 6fd38910d1d7cd1126579b15c7442ceccc8c06ba1c439d647334316b035e2dc7b073239b27d29ae94b7dd83b2b8ba7c6e19377d905530fa9118fcb463985b2d3
+AUX mold-2.33.0-icf.patch 1618 BLAKE2B 3c1953a854874218b532fa6db91b20a0625bb71d4ed154a0b7f86a19691d99257db6bd28ab174452830749b66ad0dcdddcc8f7292ce4de2fa9553d67ea21ec88 SHA512 86d74a1e00789552606493d469e7fae7ca8b2022bfb3542aecf8478a7ebf49dcf123b57e8e536dfe4e3004a2b42ece7ee3a7b73170db8585fb0012112313d407
DIST mold-2.1.0.tar.gz 9278811 BLAKE2B b31e13f92177553adf5069cf35c8c75c7bc28f0af4d1726cdc0c6abc1c9d3baaa5be512c3a8fb9bc3c3110096a79e1c6751c701171769595a2234fc1fa8c441a SHA512 f1c98d349b35b4042109d71f7db6eb8d7d089dc3241735bbd7b5402d513dcc85ca17904828779e5fc8234650fa9fb97f47c3a2f3e89cc2fb3cb9e9110439e5a2
DIST mold-2.32.1.tar.gz 10010384 BLAKE2B b020d57df25d91fac9b6ef994e9f7f73b6736d18a73be3caebe03a851a1db1986abe395b5481a1e30e01f38362c3705cb5903251b7201c0003c745dee37a5148 SHA512 d38b12faf81ba8015fc0cdb52944ac94366877c3033871a92610087e036d75b3d072baf9bbf107a9029495521e067fb36c0809b5138f90976492547b39c33085
DIST mold-2.33.0.tar.gz 10061838 BLAKE2B 65c460035f3bdbc101120a27e30b70982d549a4222cf4beb1b7228c0c961afd3eb8928cacde5be20734a80a80765eb60e6d961bd5cb001ecaef1aba1152730b9 SHA512 67c41ae33f8a229f32aabf32ffb8bcb261eff047dedd189b8751e5de43ef12a2dbd05f45632c8baeac2ceff99c40256256d7d5c790cc12e4fecf1dc3cfebeb11
EBUILD mold-2.1.0.ebuild 2169 BLAKE2B b91dec8fb9890052e06cf40124f7647833a6ea786d95d44863848bfff17c0ba335f28aaac08d6971a619dbb845b9091d1134bae47f70bd811d2fde0f9ca11066 SHA512 5d27926e5003e6bd24ee3baf8258ab043aa660b7a36918500283bbec9d991ad8ea6971add52579ba6ee10a7eeeb97a6dff3a7e065c7292ced42d2f0043e33d1e
EBUILD mold-2.32.1.ebuild 2448 BLAKE2B 88d6d168b5de620f787abf540531759dcba0be4830a71ee43bf23beb011d465b2a98f036365583dad411772a6ba1332d8d7dae3632592b7d8cd22424934b2991 SHA512 a5485b242d40e43ffcd2dfff62df1f54ca31b154acb98df4b90f23135cc61ef23d9e0950da47983d3f2362ca7d4435d3108f2c8f54814ce4730bbdc008c64dd3
+EBUILD mold-2.33.0-r1.ebuild 2520 BLAKE2B eaffd7dd7ebe40218d9749a2a0032d7d220cab021b6c45720971f7f5561d6d11fa8eb4234b0503c57e5b2fd3d6db178d780359f353dc6f488a4359b1e8c42e17 SHA512 534ccf4969ccadc73691f04e1c466f1048ce4c076dd9166f40b4e138ee68b0cfc766f488e35109ab35d39cf0e054fdfe5087ceb15cbcc5de0eaeb52629001dfb
EBUILD mold-2.33.0.ebuild 2409 BLAKE2B 770982e41dec11dd488e13a581c75744239897bacc5f8742491f19d4fefe6718971e54ef274ce61e6cff9f83df0b97320a15aac26a6d970c11f1d6953ecce4bf SHA512 7f8968d75136cf5c763e5127a5f26cd60ab4bce97dc5048292393053788de2b17858738b67c43fffe9920f28b9694a7f54fc17da95bc6efd30c477b5ae6260f6
-EBUILD mold-9999.ebuild 2380 BLAKE2B 8a84a1645f1b912deb00f67f65191c7dbb5d467889e71460c0ec5a693800c1ecefbc5a1e41b1e1f3fb7afe08165be06603e59fd350d524bb7a42b21eba062e7d SHA512 db3d64d4c4366b61e5e1400ae783443538bce18b74b832e0ccbe5410a9314c1cb78245d49eb43264f367dcfa9f9258d666fce9a732d9b47ad587ad3d0fd5c21a
+EBUILD mold-9999.ebuild 2453 BLAKE2B 4764d3061876d7c287d7114c3b259255b1250f82fb49d249b28af22f9d25acd0b4328d800464bb262893519bc0e577f36ab4abedf2c7710d249fa99ab05655ae SHA512 9b080e79c9fa25000747f3f12f3b147be137537335986919170f4e2eee1e66e5d4a2e99a8a198aba9e2b714f67c51c1acbf5fd929b68e5954fa018b80c2e8e2d
MISC metadata.xml 424 BLAKE2B a1c0cbdcb86c323fa1e6143c9665ec548f7713e74002a25b2fc26c51b60dae00922d3448a5aaecd5027a8cb026a681386ca7dea90657a3e10b25fb194dafc0d3 SHA512 1adc934e78ca0210743a1aa7479ebc4b5ea0b66a348c4408423460f02b404b885d3a8eca6e89ea8ac53ac9c76e85116965f1eef79e3f3e1f0451c8cf5ce0dfd6
diff --git a/sys-devel/mold/files/mold-2.33.0-icf.patch b/sys-devel/mold/files/mold-2.33.0-icf.patch
new file mode 100644
index 000000000000..e5b90fbfd9e3
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.33.0-icf.patch
@@ -0,0 +1,41 @@
+https://bugs.gentoo.org/938009
+https://github.com/rui314/mold/issues/1326
+https://github.com/rui314/mold/commit/5a9919b43344b4fb92ea701f0b32a7e20857b9ca
+
+From 5a9919b43344b4fb92ea701f0b32a7e20857b9ca Mon Sep 17 00:00:00 2001
+From: Rui Ueyama <ruiu@cs.stanford.edu>
+Date: Fri, 9 Aug 2024 12:08:03 +0900
+Subject: [PATCH] Fix a crash bug
+
+Fixes https://github.com/rui314/mold/issues/1326
+--- a/elf/output-chunks.cc
++++ b/elf/output-chunks.cc
+@@ -1730,21 +1730,18 @@ ElfSym<E> to_output_esym(Context<E> &ctx, Symbol<E> &sym, u32 st_name,
+ esym.st_type = STT_FUNC;
+ esym.st_visibility = sym.visibility;
+ esym.st_value = sym.get_plt_addr(ctx);
+- } else if (!isec->output_section) {
++ } else if ((isec->shdr().sh_flags & SHF_MERGE) &&
++ !(isec->shdr().sh_flags & SHF_ALLOC)) {
+ // Symbol in a mergeable non-SHF_ALLOC section, such as .debug_str
+- assert(!(isec->shdr().sh_flags & SHF_ALLOC));
+- assert(isec->shdr().sh_flags & SHF_MERGE);
+- assert(!sym.file->is_dso);
+-
+ ObjectFile<E> *file = (ObjectFile<E> *)sym.file;
+- MergeableSection<E> *m =
+- file->mergeable_sections[file->get_shndx(sym.esym())].get();
++ MergeableSection<E> &m =
++ *file->mergeable_sections[file->get_shndx(sym.esym())];
+
+ SectionFragment<E> *frag;
+ i64 frag_addend;
+- std::tie(frag, frag_addend) = m->get_fragment(sym.esym().st_value);
++ std::tie(frag, frag_addend) = m.get_fragment(sym.esym().st_value);
+
+- shndx = m->parent.shndx;
++ shndx = m.parent.shndx;
+ esym.st_visibility = sym.visibility;
+ esym.st_value = frag->get_addr(ctx) + frag_addend;
+ } else {
+
diff --git a/sys-devel/mold/mold-2.33.0-r1.ebuild b/sys-devel/mold/mold-2.33.0-r1.ebuild
new file mode 100644
index 000000000000..d9e220971d81
--- /dev/null
+++ b/sys-devel/mold/mold-2.33.0-r1.ebuild
@@ -0,0 +1,106 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake flag-o-matic toolchain-funcs
+
+DESCRIPTION="A Modern Linker"
+HOMEPAGE="https://github.com/rui314/mold"
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/rui314/mold.git"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~riscv ~sparc ~x86"
+fi
+
+# mold (MIT)
+# - xxhash (BSD-2)
+# - siphash ( MIT CC0-1.0 )
+LICENSE="MIT BSD-2 CC0-1.0"
+SLOT="0"
+IUSE="debug"
+
+RDEPEND="
+ app-arch/zstd:=
+ >=dev-cpp/tbb-2021.7.0-r1:=
+ dev-libs/blake3:=
+ sys-libs/zlib
+ !kernel_Darwin? (
+ >=dev-libs/mimalloc-2:=
+ )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-icf.patch
+)
+
+pkg_pretend() {
+ # Requires a c++20 compiler, see #831473
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
+ die "${PN} needs at least gcc 10"
+ elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
+ die "${PN} needs at least clang 12"
+ fi
+ fi
+}
+
+src_prepare() {
+ cmake_src_prepare
+
+ # Needs unpackaged dwarfdump
+ rm test/elf/{{dead,compress}-debug-sections,compressed-debug-info}.sh || die
+
+ # Heavy tests, need qemu
+ rm test/elf/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
+ rm test/elf/lto-{archive,dso,gcc,llvm,version-script}.sh || die
+
+ # Sandbox sadness
+ rm test/elf/run.sh || die
+ sed -i 's|`pwd`/mold-wrapper.so|"& ${LD_PRELOAD}"|' \
+ test/elf/mold-wrapper{,2}.sh || die
+
+ # static-pie tests require glibc built with static-pie support
+ if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then
+ rm test/elf/{,ifunc-}static-pie.sh || die
+ fi
+}
+
+src_configure() {
+ use debug || append-cppflags "-DNDEBUG"
+
+ local mycmakeargs=(
+ -DMOLD_ENABLE_QEMU_TESTS=OFF
+ -DMOLD_LTO=OFF # Should be up to the user to decide this with CXXFLAGS.
+ -DMOLD_USE_MIMALLOC=$(usex !kernel_Darwin)
+ -DMOLD_USE_SYSTEM_MIMALLOC=ON
+ -DMOLD_USE_SYSTEM_TBB=ON
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ dobin "${BUILD_DIR}"/${PN}
+
+ # https://bugs.gentoo.org/872773
+ insinto /usr/$(get_libdir)/mold
+ doins "${BUILD_DIR}"/${PN}-wrapper.so
+
+ dodoc docs/{design,execstack}.md
+ doman docs/${PN}.1
+
+ dosym ${PN} /usr/bin/ld.${PN}
+ dosym ${PN} /usr/bin/ld64.${PN}
+ dosym -r /usr/bin/${PN} /usr/libexec/${PN}/ld
+}
+
+src_test() {
+ export TEST_CC="$(tc-getCC)" \
+ TEST_GCC="$(tc-getCC)" \
+ TEST_CXX="$(tc-getCXX)" \
+ TEST_GXX="$(tc-getCXX)"
+ cmake_src_test
+}
diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-9999.ebuild
index d13290655de3..53b3beaf330c 100644
--- a/sys-devel/mold/mold-9999.ebuild
+++ b/sys-devel/mold/mold-9999.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-inherit cmake toolchain-funcs
+inherit cmake flag-o-matic toolchain-funcs
DESCRIPTION="A Modern Linker"
HOMEPAGE="https://github.com/rui314/mold"
@@ -12,7 +12,7 @@ if [[ ${PV} == 9999 ]] ; then
inherit git-r3
else
SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
- KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86"
+ KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~riscv ~sparc ~x86"
fi
# mold (MIT)
@@ -20,6 +20,7 @@ fi
# - siphash ( MIT CC0-1.0 )
LICENSE="MIT BSD-2 CC0-1.0"
SLOT="0"
+IUSE="debug"
RDEPEND="
app-arch/zstd:=
@@ -65,6 +66,8 @@ src_prepare() {
}
src_configure() {
+ use debug || append-cppflags "-DNDEBUG"
+
local mycmakeargs=(
-DMOLD_ENABLE_QEMU_TESTS=OFF
-DMOLD_LTO=OFF # Should be up to the user to decide this with CXXFLAGS.