From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B35E615808B for ; Wed, 18 Sep 2024 02:46:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D129BE29A3; Wed, 18 Sep 2024 02:46:13 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 94C1AE29A3 for ; Wed, 18 Sep 2024 02:46:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9A15834302D for ; Wed, 18 Sep 2024 02:46:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EB790B6B for ; Wed, 18 Sep 2024 02:46:10 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1726627533.1cae6bea37065d9a98ba9dd4c1a4c6be626d086a.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/, sys-devel/mold/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-devel/mold/files/mold-2.33.0-icf.patch sys-devel/mold/mold-2.33.0-r1.ebuild X-VCS-Directories: sys-devel/mold/ sys-devel/mold/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 1cae6bea37065d9a98ba9dd4c1a4c6be626d086a X-VCS-Branch: master Date: Wed, 18 Sep 2024 02:46:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 1630372d-dbc3-491e-91c3-6626d9a7bc27 X-Archives-Hash: 32e23644defedeeb4cb5ce5cf4a180d9 commit: 1cae6bea37065d9a98ba9dd4c1a4c6be626d086a Author: Sam James gentoo org> AuthorDate: Wed Sep 18 02:13:53 2024 +0000 Commit: Sam James gentoo org> CommitDate: Wed Sep 18 02:45:33 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cae6bea sys-devel/mold: fix --icf assert Shows up when building Firefox. Closes: https://bugs.gentoo.org/938009 Signed-off-by: Sam James gentoo.org> sys-devel/mold/files/mold-2.33.0-icf.patch | 41 ++++++++++++ sys-devel/mold/mold-2.33.0-r1.ebuild | 103 +++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) 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 +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 to_output_esym(Context &ctx, Symbol &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 *file = (ObjectFile *)sym.file; +- MergeableSection *m = +- file->mergeable_sections[file->get_shndx(sym.esym())].get(); ++ MergeableSection &m = ++ *file->mergeable_sections[file->get_shndx(sym.esym())]; + + SectionFragment *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..257d0d263979 --- /dev/null +++ b/sys-devel/mold/mold-2.33.0-r1.ebuild @@ -0,0 +1,103 @@ +# Copyright 2021-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake 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" + +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() { + 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 +}