sys-devel/mold: update upstream patch for AS_NEEDED

Signed-off-by: Brett A C Sheffield <bacs@librecast.net>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/219
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Brett A C Sheffield
2026-03-08 04:16:29 +00:00
committed by Sam James
parent 35637f14f8
commit cbaea18da8
@@ -2,9 +2,9 @@ https://bugs.gentoo.org/968893
https://github.com/rui314/mold/issues/1545
https://github.com/rui314/mold/pull/1546
From df7b1433b9dab52f207975a90bcef068e3999047 Mon Sep 17 00:00:00 2001
From e0a6f8e1d3881b0c9493cd33930959c60301fa81 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Wed, 21 Jan 2026 11:39:57 +0000
Date: Sat, 28 Feb 2026 09:08:49 +0000
Subject: [PATCH] Fix getting output type from linker scripts that use
AS_NEEDED
@@ -22,7 +22,7 @@ Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
create mode 100755 test/linker-script-group-as-needed.sh
diff --git a/src/linker-script.cc b/src/linker-script.cc
index 51144b3029..b40191887b 100644
index 51144b3029..6848b0e8b3 100644
--- a/src/linker-script.cc
+++ b/src/linker-script.cc
@@ -249,9 +249,12 @@ std::string_view Script<E>::get_script_output_type() {
@@ -31,7 +31,7 @@ index 51144b3029..b40191887b 100644
if (tok.size() >= 3 && (tok[0] == "INPUT" || tok[0] == "GROUP") &&
- tok[1] == "(")
+ tok[1] == "(") {
+ if (tok[2] == "AS_NEEDED" && tok[3] == "(")
+ if (tok.size() >= 5 && tok[2] == "AS_NEEDED" && tok[3] == "(")
+ tok = tok.subspan(2);
if (MappedFile *mf = resolve_path(tok[2], false))
return get_machine_type(ctx, rctx, mf);