public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/
Date: Sat, 29 Jul 2023 04:43:22 +0000 (UTC)	[thread overview]
Message-ID: <1690604918.11f5aee9517614ad79d5bf9aae5d9e7a165ac6ab.sam@gentoo> (raw)

commit:     11f5aee9517614ad79d5bf9aae5d9e7a165ac6ab
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 29 04:28:38 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 29 04:28:38 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11f5aee9

sys-devel/mold: backport musl test fix

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../mold/files/mold-2.0.0-reloc-test-fix.patch     | 58 ++++++++++++++
 sys-devel/mold/mold-2.0.0-r1.ebuild                | 93 ++++++++++++++++++++++
 2 files changed, 151 insertions(+)

diff --git a/sys-devel/mold/files/mold-2.0.0-reloc-test-fix.patch b/sys-devel/mold/files/mold-2.0.0-reloc-test-fix.patch
new file mode 100644
index 000000000000..8e6e04f5d535
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.0.0-reloc-test-fix.patch
@@ -0,0 +1,58 @@
+https://github.com/rui314/mold/issues/1067
+https://github.com/rui314/mold/commit/1582b720d58df61bc4c0ae39fa269e3b250b94df
+
+From 1582b720d58df61bc4c0ae39fa269e3b250b94df Mon Sep 17 00:00:00 2001
+From: Rui Ueyama <ruiu@bluewhale.systems>
+Date: Fri, 28 Jul 2023 14:58:57 +0900
+Subject: [PATCH] Weak undefs should not keep DSOs alive
+
+Fixes https://github.com/rui314/mold/issues/1067
+--- a/elf/input-files.cc
++++ b/elf/input-files.cc
+@@ -1396,7 +1396,8 @@ SharedFile<E>::mark_live_objects(Context<E> &ctx,
+     if (sym.is_traced)
+       print_trace_symbol(ctx, *this, esym, sym);
+ 
+-    if (esym.is_undef() && sym.file && !sym.file->is_alive.test_and_set()) {
++    if (esym.is_undef() && !esym.is_weak() && sym.file &&
++        !sym.file->is_alive.test_and_set()) {
+       feeder(sym.file);
+ 
+       if (sym.is_traced)
+--- /dev/null
++++ b/test/elf/as-needed-dso2.sh
+@@ -0,0 +1,33 @@
++#!/bin/bash
++. $(dirname $0)/common.inc
++
++cat <<EOF | $CC -c -fPIC -o $t/a.o -xc -
++int foo() {
++  return 0;
++}
++EOF
++
++cat <<EOF | $CC -c -fPIC -o $t/b.o -xc -
++__attribute__((weak)) int foo();
++
++int bar() {
++  if (foo) return foo();
++  return 0;
++}
++EOF
++
++cat <<EOF | $CC -xc -c -o $t/c.o -
++int bar();
++
++int main() {
++  return bar();
++}
++EOF
++
++$CC -B. -shared -o $t/libfoo.so $t/a.o
++$CC -B. -shared -o $t/libbar.so $t/b.o
++$CC -B. -o $t/exe $t/c.o -L$t -Wl,--as-needed -lfoo -lbar
++
++readelf --dynamic $t/exe > $t/log
++! grep libfoo.so $t/log || false
++grep -q libbar.so $t/log
+

diff --git a/sys-devel/mold/mold-2.0.0-r1.ebuild b/sys-devel/mold/mold-2.0.0-r1.ebuild
new file mode 100644
index 000000000000..6d863f669627
--- /dev/null
+++ b/sys-devel/mold/mold-2.0.0-r1.ebuild
@@ -0,0 +1,93 @@
+# Copyright 2021-2023 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 ~arm64 ~ppc64 ~riscv ~x86"
+fi
+
+# mold (MIT)
+#  - xxhash (BSD-2)
+LICENSE="MIT BSD-2"
+SLOT="0"
+
+RDEPEND="
+	app-arch/zstd:=
+	>=dev-cpp/tbb-2021.7.0-r1:=
+	sys-libs/zlib
+	!kernel_Darwin? (
+		>=dev-libs/mimalloc-2:=
+		dev-libs/openssl:=
+	)
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-reloc-test-fix.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_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 ../../../usr/bin/${PN} /usr/libexec/${PN}/ld
+}


             reply	other threads:[~2023-07-29  4:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-29  4:43 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-20  6:10 [gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/ Sam James
2024-12-09  5:54 Sam James
2024-09-02  5:14 Sam James
2024-06-24  0:32 Sam James
2024-04-30  7:03 Sam James
2023-11-13  2:11 Sam James
2022-12-04  8:55 Matthew Smith
2022-07-28 10:17 Sam James
2021-12-20  5:08 Sam James
2021-12-14 11:14 Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1690604918.11f5aee9517614ad79d5bf9aae5d9e7a165ac6ab.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox