aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-12-03 16:15:27 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-01-01 17:51:18 -0700
commit04480f72d8993196052375c0f0aca9d33f475fe7 (patch)
treeb742c23c5c60b57676d3d56bc09db49497324a9d /lib/std/Build/Module.zig
parent0ee8fbb15dd32a2bb91696e4765926e9170d2a23 (diff)
downloadzig-04480f72d8993196052375c0f0aca9d33f475fe7.tar.gz
zig-04480f72d8993196052375c0f0aca9d33f475fe7.zip
fix linker test regressions
Caused by problems with transitive dependencies
Diffstat (limited to 'lib/std/Build/Module.zig')
-rw-r--r--lib/std/Build/Module.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig
index 3428581333..f17f296e64 100644
--- a/lib/std/Build/Module.zig
+++ b/lib/std/Build/Module.zig
@@ -229,7 +229,7 @@ pub fn init(m: *Module, owner: *std.Build, options: CreateOptions, compile: ?*St
}
// This logic accesses `depending_steps` which was just modified above.
- var it = m.iterateDependencies(null);
+ var it = m.iterateDependencies(null, false);
while (it.next()) |item| addShallowDependencies(m, item.module);
}
@@ -244,7 +244,7 @@ pub fn addImport(m: *Module, name: []const u8, module: *Module) void {
const b = m.owner;
m.import_table.put(b.allocator, b.dupe(name), module) catch @panic("OOM");
- var it = module.iterateDependencies(null);
+ var it = module.iterateDependencies(null, false);
while (it.next()) |item| addShallowDependencies(m, item.module);
}
@@ -319,6 +319,7 @@ pub const DependencyIterator = struct {
allocator: std.mem.Allocator,
index: usize,
set: std.AutoArrayHashMapUnmanaged(Key, []const u8),
+ chase_dyn_libs: bool,
pub const Key = struct {
/// The compilation that contains the `Module`. Note that a `Module` might be
@@ -361,6 +362,8 @@ pub const DependencyIterator = struct {
if (key.compile != null) {
for (module.link_objects.items) |link_object| switch (link_object) {
.other_step => |compile| {
+ if (!it.chase_dyn_libs and compile.isDynamicLibrary()) continue;
+
it.set.put(it.allocator, .{
.module = &compile.root_module,
.compile = compile,
@@ -381,11 +384,13 @@ pub const DependencyIterator = struct {
pub fn iterateDependencies(
m: *Module,
chase_steps: ?*Step.Compile,
+ chase_dyn_libs: bool,
) DependencyIterator {
var it: DependencyIterator = .{
.allocator = m.owner.allocator,
.index = 0,
.set = .{},
+ .chase_dyn_libs = chase_dyn_libs,
};
it.set.ensureUnusedCapacity(m.owner.allocator, m.import_table.count() + 1) catch @panic("OOM");
it.set.putAssumeCapacity(.{