diff options
| author | Xavier Bouchoux <xavierb@gmail.com> | 2023-05-14 11:46:59 +0200 |
|---|---|---|
| committer | Xavier Bouchoux <xavierb@gmail.com> | 2023-07-11 11:46:59 +0200 |
| commit | cea8645423604b758208d94ff4d404a0fbae51f8 (patch) | |
| tree | 7252ed54bcf70c645e24319d8875e8d982e0aef1 /lib/std/Build/Step/Compile.zig | |
| parent | 8142bc20ea8bcffc076fcbde074a7e315ff0060a (diff) | |
| download | zig-cea8645423604b758208d94ff4d404a0fbae51f8.tar.gz zig-cea8645423604b758208d94ff4d404a0fbae51f8.zip | |
build: avoid repeating objects when linking a static library
Don't pass the object files from a static library to the linker invocation.
The lib.a file already contains them.
Avoids "duplicate symbol" errors (and useless work by the linker)
Diffstat (limited to 'lib/std/Build/Step/Compile.zig')
| -rw-r--r-- | lib/std/Build/Step/Compile.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index 7ca8748dbf..c83f72328c 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -2192,7 +2192,8 @@ const TransitiveDeps = struct { if ((try td.seen_steps.fetchPut(&inner_other.step, {})) != null) continue; - if (!dyn) + const included_in_lib = (other.kind == .lib and inner_other.kind == .obj); + if (!dyn and !included_in_lib) try td.link_objects.append(other_link_object); try addInner(td, inner_other, dyn or inner_other.isDynamicLibrary()); |
