zig-master: drop merged patches, add remote patch locally (#5270) (#5275)

* chore(zig-master): drop merged patches, add remote patch locally

* chore(zig-master): drop merged patches, add remote patch locally

---------


(cherry picked from commit 07a51f8e93)

Co-authored-by: Jan <sentrycraft123@gmail.com>
Co-authored-by: Gilver <rockgrub@disroot.org>
This commit is contained in:
Raboneko
2025-06-07 07:54:55 -07:00
committed by GitHub
parent 19c0b1e958
commit c5ced60055
8 changed files with 82 additions and 64 deletions
@@ -1,11 +0,0 @@
--- a/build.zig 2025-05-21 00:23:29.485933582 -0500
+++ b/build.zig 2025-05-21 00:25:06.001631897 -0500
@@ -690,7 +690,7 @@
fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Step.Compile {
const exe = b.addExecutable(.{
.name = "zig",
- .max_rss = 7_800_000_000,
+ .max_rss = 10_000_000_000,
.root_module = addCompilerMod(b, options),
});
exe.stack_size = stack_size;
@@ -1,18 +0,0 @@
--- a/build.zig 2025-04-25 05:56:25.033100994 -0500
+++ b/build.zig 2025-04-25 05:57:16.965173352 -0500
@@ -1392,7 +1392,14 @@
// in a temporary directory
"--cache-root", b.cache_root.path orelse ".",
});
- cmd.addArgs(&.{ "--zig-lib-dir", b.fmt("{}", .{b.graph.zig_lib_directory}) });
+ if (b.graph.zig_lib_directory.path) |zig_lib_dir| {
+ cmd.addArgs(&.{"--zig-lib-dir"});
+ if (fs.path.isAbsolute(zig_lib_dir)) {
+ cmd.addArgs(&.{zig_lib_dir});
+ } else {
+ cmd.addDirectoryArg(b.path(zig_lib_dir));
+ }
+ }
cmd.addArgs(&.{"-i"});
cmd.addFileArg(b.path(b.fmt("doc/langref/{s}", .{entry.name})));
@@ -0,0 +1,40 @@
From 48aa23307d1a47b444854fc09478da6d4ee8e624 Mon Sep 17 00:00:00 2001
From: Jan200101 <sentrycraft123@gmail.com>
Date: Sun, 11 May 2025 01:09:41 +0200
Subject: [PATCH 5/5] 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/Elf.zig | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index 53f88101b1..fe2b7abd48 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -1938,9 +1938,19 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
// 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 (self.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
@@ -46,9 +46,7 @@ URL: https://ziglang.org
Source0: %{url}/builds/zig-%{ver}.tar.xz
Source1: %{url}/builds/zig-%{ver}.tar.xz.minisig
Patch0: 0000-remove-native-lib-directories-from-rpath.patch
Patch1: 0001-increase-upper-bounds-of-main-zig-executable-to-10G.patch
Patch2: 0002-build-pass-zig-lib-dir-as-directory-instead-of-as-st.patch
Patch3: https://src.fedoraproject.org/rpms/zig/raw/rawhide/f/0005-link.Elf-add-root-directory-of-libraries-to-linker-p.patch
Patch3: 0005-link.Elf-add-root-directory-of-libraries-to-linker-p.patch
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
@@ -1,11 +0,0 @@
--- a/build.zig 2025-05-21 00:23:29.485933582 -0500
+++ b/build.zig 2025-05-21 00:25:06.001631897 -0500
@@ -690,7 +690,7 @@
fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Step.Compile {
const exe = b.addExecutable(.{
.name = "zig",
- .max_rss = 7_800_000_000,
+ .max_rss = 10_000_000_000,
.root_module = addCompilerMod(b, options),
});
exe.stack_size = stack_size;
@@ -1,18 +0,0 @@
--- a/build.zig 2025-04-25 05:56:25.033100994 -0500
+++ b/build.zig 2025-04-25 05:57:16.965173352 -0500
@@ -1392,7 +1392,14 @@
// in a temporary directory
"--cache-root", b.cache_root.path orelse ".",
});
- cmd.addArgs(&.{ "--zig-lib-dir", b.fmt("{}", .{b.graph.zig_lib_directory}) });
+ if (b.graph.zig_lib_directory.path) |zig_lib_dir| {
+ cmd.addArgs(&.{"--zig-lib-dir"});
+ if (fs.path.isAbsolute(zig_lib_dir)) {
+ cmd.addArgs(&.{zig_lib_dir});
+ } else {
+ cmd.addDirectoryArg(b.path(zig_lib_dir));
+ }
+ }
cmd.addArgs(&.{"-i"});
cmd.addFileArg(b.path(b.fmt("doc/langref/{s}", .{entry.name})));
@@ -0,0 +1,40 @@
From 48aa23307d1a47b444854fc09478da6d4ee8e624 Mon Sep 17 00:00:00 2001
From: Jan200101 <sentrycraft123@gmail.com>
Date: Sun, 11 May 2025 01:09:41 +0200
Subject: [PATCH 5/5] 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/Elf.zig | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index 53f88101b1..fe2b7abd48 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -1938,9 +1938,19 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
// 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 (self.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 -3
View File
@@ -21,9 +21,7 @@ URL: https://ziglang.org
Source0: %{url}/builds/zig-%{version_no_tilde}.tar.xz
Source1: %{url}/builds/zig-%{version_no_tilde}.tar.xz.minisig
Patch0: 0000-remove-native-lib-directories-from-rpath.patch
Patch1: 0001-increase-upper-bounds-of-main-zig-executable-to-10G.patch
Patch2: 0002-build-pass-zig-lib-dir-as-directory-instead-of-as-st.patch
Patch3: https://src.fedoraproject.org/rpms/zig/raw/rawhide/f/0005-link.Elf-add-root-directory-of-libraries-to-linker-p.patch
Patch3: 0005-link.Elf-add-root-directory-of-libraries-to-linker-p.patch
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++