chore(zig-master): Update patches (#8782) (#8926)

(cherry picked from commit 7f2754d576)

Co-authored-by: Gilver <rockgrub@disroot.org>
This commit is contained in:
Raboneko
2026-01-04 14:25:21 -08:00
committed by GitHub
parent 2f66fdb597
commit fb0a12e0d5
6 changed files with 8 additions and 96 deletions
@@ -1,9 +1,9 @@
--- a/src/main.zig 2025-04-25 06:01:31.337458939 -0500
+++ b/src/main.zig 2025-04-25 06:03:02.239473385 -0500
@@ -4072,6 +4072,15 @@
--- a/src/main.zig 2025-12-27 19:19:30.000000000 -0600
+++ b/src/main.zig 2025-12-31 08:25:12.962257290 -0600
@@ -3998,6 +3998,15 @@
try create_module.lib_directories.ensureUnusedCapacity(arena, paths.lib_dirs.items.len);
for (paths.lib_dirs.items) |path| addLibDirectoryWarn2(&create_module.lib_directories, path, true);
for (paths.lib_dirs.items) |path| addLibDirectoryWarn2(io, &create_module.lib_directories, path, true);
+
+ for (paths.lib_dirs.items) |native_lib_dir| {
+ for (0.., create_module.rpath_list.items) |i, rpath_dir| {
@@ -1,43 +0,0 @@
From 1796a91063dc5ed71418f164bb7d98ca65c33d4a Mon Sep 17 00:00:00 2001
From: Jan200101 <sentrycraft123@gmail.com>
Date: Mon, 16 Jun 2025 20:46:25 +0200
Subject: [PATCH] link.Elf: add root directory of libraries to linker path
All the given dynamic shared objects will be linked with an absolute
path however they may link to other dynamic shared objects which won't
have an absolute path, for this we need to add the library path so that
lld can resolve it.
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
---
src/link/Lld.zig | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/link/Lld.zig b/src/link/Lld.zig
index 4ea809428e..b8421dd60a 100644
--- a/src/link/Lld.zig
+++ b/src/link/Lld.zig
@@ -1109,9 +1109,19 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
// Positional arguments to the linker such as object files.
var whole_archive = false;
+ var lib_directories = std.StringArrayHashMap(void).init(gpa);
+ defer lib_directories.deinit();
+
for (base.comp.link_inputs) |link_input| switch (link_input) {
.res => unreachable, // Windows-only
- .dso => continue,
+ .dso => |dso| {
+ if (dso.path.root_dir.path) |root_dir| {
+ const lib_dir = try lib_directories.getOrPut(root_dir);
+ if (lib_dir.found_existing) continue;
+ try argv.append("-L");
+ try argv.append(root_dir);
+ }
+ },
.object, .archive => |obj| {
if (obj.must_link and !whole_archive) {
try argv.append("-whole-archive");
--
2.49.0
@@ -47,7 +47,6 @@ URL: https://ziglang.org
Source0: %{archive_name}
Source1: %{archive_name}.minisig
Patch0: 0000-remove-native-lib-directories-from-rpath.patch
Patch3: 0005-link.Elf-add-root-directory-of-libraries-to-linker-p.patch
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
@@ -1,9 +1,9 @@
--- a/src/main.zig 2025-04-25 06:01:31.337458939 -0500
+++ b/src/main.zig 2025-04-25 06:03:02.239473385 -0500
@@ -4072,6 +4072,15 @@
--- a/src/main.zig 2025-12-27 19:19:30.000000000 -0600
+++ b/src/main.zig 2025-12-31 08:25:12.962257290 -0600
@@ -3998,6 +3998,15 @@
try create_module.lib_directories.ensureUnusedCapacity(arena, paths.lib_dirs.items.len);
for (paths.lib_dirs.items) |path| addLibDirectoryWarn2(&create_module.lib_directories, path, true);
for (paths.lib_dirs.items) |path| addLibDirectoryWarn2(io, &create_module.lib_directories, path, true);
+
+ for (paths.lib_dirs.items) |native_lib_dir| {
+ for (0.., create_module.rpath_list.items) |i, rpath_dir| {
@@ -1,43 +0,0 @@
From 1796a91063dc5ed71418f164bb7d98ca65c33d4a Mon Sep 17 00:00:00 2001
From: Jan200101 <sentrycraft123@gmail.com>
Date: Mon, 16 Jun 2025 20:46:25 +0200
Subject: [PATCH] link.Elf: add root directory of libraries to linker path
All the given dynamic shared objects will be linked with an absolute
path however they may link to other dynamic shared objects which won't
have an absolute path, for this we need to add the library path so that
lld can resolve it.
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
---
src/link/Lld.zig | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/link/Lld.zig b/src/link/Lld.zig
index 4ea809428e..b8421dd60a 100644
--- a/src/link/Lld.zig
+++ b/src/link/Lld.zig
@@ -1109,9 +1109,19 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
// Positional arguments to the linker such as object files.
var whole_archive = false;
+ var lib_directories = std.StringArrayHashMap(void).init(gpa);
+ defer lib_directories.deinit();
+
for (base.comp.link_inputs) |link_input| switch (link_input) {
.res => unreachable, // Windows-only
- .dso => continue,
+ .dso => |dso| {
+ if (dso.path.root_dir.path) |root_dir| {
+ const lib_dir = try lib_directories.getOrPut(root_dir);
+ if (lib_dir.found_existing) continue;
+ try argv.append("-L");
+ try argv.append(root_dir);
+ }
+ },
.object, .archive => |obj| {
if (obj.must_link and !whole_archive) {
try argv.append("-whole-archive");
--
2.49.0
-1
View File
@@ -22,7 +22,6 @@ URL: https://ziglang.org
Source0: %{archive_name}
Source1: %{archive_name}.minisig
Patch0: 0000-remove-native-lib-directories-from-rpath.patch
Patch3: 0005-link.Elf-add-root-directory-of-libraries-to-linker-p.patch
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++