| ... | ... | @@ -714,7 +714,6 @@ pub fn loadInput(self: *Elf, input: link.Input) !void { |
| 714 | 714 | const target = self.getTarget(); |
| 715 | 715 | const debug_fmt_strip = comp.config.debug_format == .strip; |
| 716 | 716 | const default_sym_version = self.default_sym_version; |
| 717 | | const is_static_lib = self.base.isStaticLib(); |
| 718 | 717 | |
| 719 | 718 | if (comp.verbose_link) { |
| 720 | 719 | comp.mutex.lockUncancelable(io); // protect comp.arena |
| ... | ... | @@ -733,7 +732,11 @@ pub fn loadInput(self: *Elf, input: link.Input) !void { |
| 733 | 732 | .res => unreachable, |
| 734 | 733 | .dso_exact => @panic("TODO"), |
| 735 | 734 | .object => |obj| try parseObject(self, obj), |
| 736 | | .archive => |obj| try parseArchive(gpa, io, diags, &self.file_handles, &self.files, target, debug_fmt_strip, default_sym_version, &self.objects, obj, is_static_lib), |
| 735 | .archive => |obj| if (self.base.isStaticLib()) { |
| 736 | // Ignore static library inputs when generating a static library. |
| 737 | } else { |
| 738 | try parseArchive(gpa, io, diags, &self.file_handles, &self.files, target, debug_fmt_strip, default_sym_version, &self.objects, obj); |
| 739 | }, |
| 737 | 740 | .dso => |dso| try parseDso(gpa, io, diags, dso, &self.shared_objects, &self.files, target), |
| 738 | 741 | } |
| 739 | 742 | } |
| ... | ... | @@ -1083,7 +1086,6 @@ fn parseArchive( |
| 1083 | 1086 | default_sym_version: elf.Versym, |
| 1084 | 1087 | objects: *std.ArrayList(File.Index), |
| 1085 | 1088 | obj: link.Input.Object, |
| 1086 | | is_static_lib: bool, |
| 1087 | 1089 | ) !void { |
| 1088 | 1090 | const tracy = trace(@src()); |
| 1089 | 1091 | defer tracy.end(); |
| ... | ... | @@ -1092,17 +1094,14 @@ fn parseArchive( |
| 1092 | 1094 | var archive = try Archive.parse(gpa, io, diags, file_handles, obj.path, fh); |
| 1093 | 1095 | defer archive.deinit(gpa); |
| 1094 | 1096 | |
| 1095 | | const init_alive = if (is_static_lib) true else obj.must_link; |
| 1096 | | |
| 1097 | 1097 | for (archive.objects) |extracted| { |
| 1098 | 1098 | const index: File.Index = @intCast(try files.addOne(gpa)); |
| 1099 | 1099 | files.set(index, .{ .object = extracted }); |
| 1100 | 1100 | const object = &files.items(.data)[index].object; |
| 1101 | 1101 | object.index = index; |
| 1102 | | object.alive = init_alive; |
| 1102 | object.alive = obj.must_link; |
| 1103 | 1103 | try object.parseCommon(gpa, io, diags, obj.path, obj.file, target); |
| 1104 | | if (!is_static_lib) |
| 1105 | | try object.parse(gpa, io, diags, obj.path, obj.file, target, debug_fmt_strip, default_sym_version); |
| 1104 | try object.parse(gpa, io, diags, obj.path, obj.file, target, debug_fmt_strip, default_sym_version); |
| 1106 | 1105 | try objects.append(gpa, index); |
| 1107 | 1106 | } |
| 1108 | 1107 | } |