From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 finch.gentoo.org (Postfix) with ESMTPS id D611A1584AD for ; Thu, 01 May 2025 01:41:53 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id BF4B7342FEF for ; Thu, 01 May 2025 01:41:53 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id B2CB9110328; Thu, 01 May 2025 01:41:52 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.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 bobolink.gentoo.org (Postfix) with ESMTPS id A4E31110328 for ; Thu, 01 May 2025 01:41:52 +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 4B323341540 for ; Thu, 01 May 2025 01:41:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A7E77C3A for ; Thu, 01 May 2025 01:41:50 +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: <1746063615.3a538523c8039763c9c3bdea27095115cf728c01.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.38.1-default-symver.patch sys-devel/mold/files/mold-2.38.1-omagic-loop.patch sys-devel/mold/mold-2.38.1-r1.ebuild sys-devel/mold/mold-9999.ebuild X-VCS-Directories: sys-devel/mold/ sys-devel/mold/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 3a538523c8039763c9c3bdea27095115cf728c01 X-VCS-Branch: master Date: Thu, 01 May 2025 01:41:50 +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: 8c4dc7c1-6552-4110-bce4-0bde7a62ea57 X-Archives-Hash: a955882ba506ffec5f1c9123d872abd2 commit: 3a538523c8039763c9c3bdea27095115cf728c01 Author: Sam James gentoo org> AuthorDate: Thu May 1 01:37:48 2025 +0000 Commit: Sam James gentoo org> CommitDate: Thu May 1 01:40:15 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a538523 sys-devel/mold: backport 2 fixes to 2.38.1 * Fix -Wl,--default-symver vs -Wl,--version-script which shows up as breakage in dev-libs/jansson vs dev-libs/json-c in net-firewall/firewalld (like in bug #812119). Thanks to Chewi for digging into it & reporting it upstream. There's a chance that it may help with bug #937990 too and maybe (but less likely?) bug #933197. * Fix --omagic hang (upstream report says it was a regression in 2.38.1 vs 2.38.0, so let's fix it while here). * Skip test failing for me on one machine (seems to be Clang not picking up that it should use mold/lld for the test, or the plugin maybe not being around; not going to worry about it for now). Bug: https://bugs.gentoo.org/812119 Bug: https://bugs.gentoo.org/933197 Bug: https://bugs.gentoo.org/937990 Signed-off-by: Sam James gentoo.org> .../mold/files/mold-2.38.1-default-symver.patch | 70 ++++++++++++++++++++++ sys-devel/mold/files/mold-2.38.1-omagic-loop.patch | 28 +++++++++ .../{mold-9999.ebuild => mold-2.38.1-r1.ebuild} | 10 ++++ sys-devel/mold/mold-9999.ebuild | 5 ++ 4 files changed, 113 insertions(+) diff --git a/sys-devel/mold/files/mold-2.38.1-default-symver.patch b/sys-devel/mold/files/mold-2.38.1-default-symver.patch new file mode 100644 index 000000000000..4f5e874db420 --- /dev/null +++ b/sys-devel/mold/files/mold-2.38.1-default-symver.patch @@ -0,0 +1,70 @@ +https://github.com/rui314/mold/commit/8bae43b842f1ded33830a95b8fc7ba8b0a53086f + +From 8bae43b842f1ded33830a95b8fc7ba8b0a53086f Mon Sep 17 00:00:00 2001 +From: Rui Ueyama +Date: Wed, 30 Apr 2025 20:37:14 +0900 +Subject: [PATCH] Make --default-symver work with version scripts + +Previously, symbols specified with the `global:` label were unversioned +even if --default-symver was given. Now, such symbols are versioned with +the output file's soname. + +Fixes https://github.com/rui314/mold/issues/1448 +--- + src/cmdline.cc | 2 -- + src/output-chunks.cc | 8 ++++++++ + test/default-symver-version-script.sh | 11 +++++++++++ + 3 files changed, 19 insertions(+), 2 deletions(-) + create mode 100755 test/default-symver-version-script.sh + +diff --git a/src/cmdline.cc b/src/cmdline.cc +index d27f6bdc3d..a6471d5bba 100644 +--- a/src/cmdline.cc ++++ b/src/cmdline.cc +@@ -1510,9 +1510,7 @@ std::vector parse_nonpositional_args(Context &ctx) { + std::string ver = ctx.arg.soname; + if (ver.empty()) + ver = path_filename(ctx.arg.output); +- + ctx.arg.version_definitions.push_back(ver); +- ctx.default_version = VER_NDX_LAST_RESERVED + 1; + } + + for (std::string_view path : version_scripts) { +diff --git a/src/output-chunks.cc b/src/output-chunks.cc +index 605f3c2f50..838ee838f3 100644 +--- a/src/output-chunks.cc ++++ b/src/output-chunks.cc +@@ -2632,6 +2632,14 @@ void VerdefSection::construct(Context &ctx) { + if (ctx.arg.version_definitions.empty()) + return; + ++ // Handle --default-symver ++ if (ctx.arg.default_symver) ++ for (Symbol *sym : ctx.dynsym->symbols) ++ if (sym && !sym->file->is_dso) ++ if (u16 ver = sym->ver_idx; ++ ver == VER_NDX_GLOBAL || ver == VER_NDX_UNSPECIFIED) ++ sym->ver_idx = VER_NDX_LAST_RESERVED + 1; ++ + // Resize .gnu.version and write to it + ctx.versym->contents.resize(ctx.dynsym->symbols.size(), VER_NDX_GLOBAL); + ctx.versym->contents[0] = VER_NDX_LOCAL; +diff --git a/test/default-symver-version-script.sh b/test/default-symver-version-script.sh +new file mode 100755 +index 0000000000..5b3d22b24f +--- /dev/null ++++ b/test/default-symver-version-script.sh +@@ -0,0 +1,11 @@ ++#!/bin/bash ++. $(dirname $0)/common.inc ++ ++cat < $t/b.ver ++ ++$CC -B. -o $t/c.so -shared $t/a.o -Wl,--default-symver -Wl,--version-script=$t/b.ver ++readelf --dyn-syms $t/c.so | grep -F ' foo@@c.so' + diff --git a/sys-devel/mold/files/mold-2.38.1-omagic-loop.patch b/sys-devel/mold/files/mold-2.38.1-omagic-loop.patch new file mode 100644 index 000000000000..44c8e3e39102 --- /dev/null +++ b/sys-devel/mold/files/mold-2.38.1-omagic-loop.patch @@ -0,0 +1,28 @@ +https://github.com/rui314/mold/issues/1447 +https://github.com/rui314/mold/commit/83dd35397955bd179723ce31d52fc30836a65eed + +From 83dd35397955bd179723ce31d52fc30836a65eed Mon Sep 17 00:00:00 2001 +From: Rui Ueyama +Date: Thu, 1 May 2025 09:33:52 +0900 +Subject: [PATCH] Prevent oscillation when computing the size of the phdr + +Fixes https://github.com/rui314/mold/issues/1447 +--- + src/passes.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/passes.cc b/src/passes.cc +index a2f1ed3347..5845dd6a19 100644 +--- a/src/passes.cc ++++ b/src/passes.cc +@@ -2780,7 +2780,7 @@ i64 set_osec_offsets(Context &ctx) { + if (ctx.phdr) { + i64 sz = ctx.phdr->shdr.sh_size; + ctx.phdr->update_shdr(ctx); +- if (sz != ctx.phdr->shdr.sh_size) ++ if (sz < ctx.phdr->shdr.sh_size) + continue; + } + + + diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-2.38.1-r1.ebuild similarity index 90% copy from sys-devel/mold/mold-9999.ebuild copy to sys-devel/mold/mold-2.38.1-r1.ebuild index f675a8309da7..263989f96286 100644 --- a/sys-devel/mold/mold-9999.ebuild +++ b/sys-devel/mold/mold-2.38.1-r1.ebuild @@ -35,6 +35,11 @@ RDEPEND=" " DEPEND="${RDEPEND}" +PATCHES=( + "${FILESDIR}"/${P}-default-symver.patch + "${FILESDIR}"/${P}-omagic-loop.patch +) + pkg_pretend() { # Requires a c++20 compiler, see #831473 if [[ ${MERGE_TYPE} != binary ]]; then @@ -64,6 +69,11 @@ src_prepare() { # Fails if binutils errors out on textrels by default rm test/textrel.sh test/textrel2.sh || die + # Fails with (sometimes, maybe dependent on sys-devel/clang default + # linker): + # "/usr/bin/x86_64-pc-linux-gnu-ld.bfd: unrecognised emulation mode: llvm" + rm test/lto-llvm2.sh || die + # static-pie tests require glibc built with static-pie support if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then rm test/{,ifunc-}static-pie.sh || die diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-9999.ebuild index f675a8309da7..7117deff952b 100644 --- a/sys-devel/mold/mold-9999.ebuild +++ b/sys-devel/mold/mold-9999.ebuild @@ -64,6 +64,11 @@ src_prepare() { # Fails if binutils errors out on textrels by default rm test/textrel.sh test/textrel2.sh || die + # Fails with (sometimes, maybe dependent on sys-devel/clang default + # linker): + # "/usr/bin/x86_64-pc-linux-gnu-ld.bfd: unrecognised emulation mode: llvm" + rm test/lto-llvm2.sh || die + # static-pie tests require glibc built with static-pie support if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then rm test/{,ifunc-}static-pie.sh || die