41 lines
1.6 KiB
Diff
41 lines
1.6 KiB
Diff
|
From ef02f49f11a80492cc3792fe573167a6aa743f52 Mon Sep 17 00:00:00 2001
|
||
|
From: Jan200101 <sentrycraft123@gmail.com>
|
||
|
Date: Thu, 20 Jan 2022 18:57:39 +0100
|
||
|
Subject: [PATCH] ignore target lib dirs when invoked with -feach-lib-rpath
|
||
|
|
||
|
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
|
||
|
---
|
||
|
src/link/Elf.zig | 15 +++++++++++++++
|
||
|
1 file changed, 15 insertions(+)
|
||
|
|
||
|
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
|
||
|
index 24f8a02b9..9e27dc786 100644
|
||
|
--- a/src/link/Elf.zig
|
||
|
+++ b/src/link/Elf.zig
|
||
|
@@ -1551,7 +1551,22 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
|
||
|
if (self.base.options.each_lib_rpath) {
|
||
|
var test_path = std.ArrayList(u8).init(self.base.allocator);
|
||
|
defer test_path.deinit();
|
||
|
+
|
||
|
+ const cross_target = std.zig.CrossTarget.fromTarget(target);
|
||
|
+ const target_info = try std.zig.system.NativeTargetInfo.detect(self.base.allocator, cross_target);
|
||
|
+ const native_paths = try std.zig.system.NativePaths.detect(self.base.allocator, target_info);
|
||
|
+
|
||
|
for (self.base.options.lib_dirs) |lib_dir_path| {
|
||
|
+ var is_target_lib_dir = false;
|
||
|
+ for (native_paths.lib_dirs.items) |lib_dir| {
|
||
|
+ if (mem.eql(u8, lib_dir, lib_dir_path)) {
|
||
|
+ is_target_lib_dir = true;
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ }
|
||
|
+ if (is_target_lib_dir) {
|
||
|
+ continue;
|
||
|
+ }
|
||
|
for (self.base.options.system_libs.keys()) |link_lib| {
|
||
|
test_path.clearRetainingCapacity();
|
||
|
const sep = fs.path.sep_str;
|
||
|
--
|
||
|
2.34.1
|
||
|
|