summaryrefslogtreecommitdiff
path: root/dev-lang/zig-bin/files/zig-bin-0.9.1-fix-detecting-abi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang/zig-bin/files/zig-bin-0.9.1-fix-detecting-abi.patch')
-rw-r--r--dev-lang/zig-bin/files/zig-bin-0.9.1-fix-detecting-abi.patch19
1 files changed, 19 insertions, 0 deletions
diff --git a/dev-lang/zig-bin/files/zig-bin-0.9.1-fix-detecting-abi.patch b/dev-lang/zig-bin/files/zig-bin-0.9.1-fix-detecting-abi.patch
new file mode 100644
index 000000000000..6aa2f49b379a
--- /dev/null
+++ b/dev-lang/zig-bin/files/zig-bin-0.9.1-fix-detecting-abi.patch
@@ -0,0 +1,19 @@
+From: Eric Joldasov <bratishkaerik@getgoogleoff.me>
+
+Upstream parses /usr/bin/env ELF file for detecting C ABI and the dynamic linker.
+However, if sys-apps/coreutils was merged with "multicall" USE flag, it would be a script and not a ELF file.
+This will raise error.UnexpectedEndOfFile, and Zig will fallback to default dynamic linker (i.e. musl),
+which breaks building programs with Zig on glibc systems. This patch changes file from
+/usr/bin/env to /bin/bash, because it is more reliable on Gentoo systems.
+
+--- a/lib/std/zig/system/NativeTargetInfo.zig
++++ b/lib/std/zig/system/NativeTargetInfo.zig
+@@ -355,7 +355,7 @@ fn detectAbiAndDynamicLinker(
+ return result;
+ }
+
+- const env_file = std.fs.openFileAbsoluteZ("/usr/bin/env", .{}) catch |err| switch (err) {
++ const env_file = std.fs.openFileAbsoluteZ("/bin/bash", .{}) catch |err| switch (err) {
+ error.NoSpaceLeft => unreachable,
+ error.NameTooLong => unreachable,
+ error.PathAlreadyExists => unreachable,