| ... | @@ -1038,6 +1038,10 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod | ... | @@ -1038,6 +1038,10 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod |
| 1038 | | 1038 | |
| 1039 | // Beyond this point, everything has been allocated a virtual address and we can resolve | 1039 | // Beyond this point, everything has been allocated a virtual address and we can resolve |
| 1040 | // the relocations, and commit objects to file. | 1040 | // the relocations, and commit objects to file. |
| | 1041 | for (self.objects.items) |index| { |
| | 1042 | self.file(index).?.object.dirty = false; |
| | 1043 | } |
| | 1044 | |
| 1041 | if (self.zigObjectPtr()) |zo| { | 1045 | if (self.zigObjectPtr()) |zo| { |
| 1042 | var has_reloc_errors = false; | 1046 | var has_reloc_errors = false; |
| 1043 | for (zo.atoms_indexes.items) |atom_index| { | 1047 | for (zo.atoms_indexes.items) |atom_index| { |
| ... | @@ -1399,7 +1403,6 @@ pub fn parseLibraryReportingFailure(self: *Elf, lib: SystemLib, must_link: bool) | ... | @@ -1399,7 +1403,6 @@ pub fn parseLibraryReportingFailure(self: *Elf, lib: SystemLib, must_link: bool) |
| 1399 | fn parseLibrary(self: *Elf, lib: SystemLib, must_link: bool) ParseError!void { | 1403 | fn parseLibrary(self: *Elf, lib: SystemLib, must_link: bool) ParseError!void { |
| 1400 | const tracy = trace(@src()); | 1404 | const tracy = trace(@src()); |
| 1401 | defer tracy.end(); | 1405 | defer tracy.end(); |
| 1402 | | | |
| 1403 | if (try Archive.isArchive(lib.path)) { | 1406 | if (try Archive.isArchive(lib.path)) { |
| 1404 | try self.parseArchive(lib.path, must_link); | 1407 | try self.parseArchive(lib.path, must_link); |
| 1405 | } else if (try SharedObject.isSharedObject(lib.path)) { | 1408 | } else if (try SharedObject.isSharedObject(lib.path)) { |
| ... | @@ -2799,9 +2802,10 @@ pub fn resolveMergeSections(self: *Elf) !void { | ... | @@ -2799,9 +2802,10 @@ pub fn resolveMergeSections(self: *Elf) !void { |
| 2799 | | 2802 | |
| 2800 | var has_errors = false; | 2803 | var has_errors = false; |
| 2801 | for (self.objects.items) |index| { | 2804 | for (self.objects.items) |index| { |
| 2802 | const file_ptr = self.file(index).?; | 2805 | const object = self.file(index).?.object; |
| 2803 | if (!file_ptr.isAlive()) continue; | 2806 | if (!object.alive) continue; |
| 2804 | file_ptr.object.initInputMergeSections(self) catch |err| switch (err) { | 2807 | if (!object.dirty) continue; |
| | 2808 | object.initInputMergeSections(self) catch |err| switch (err) { |
| 2805 | error.LinkFailure => has_errors = true, | 2809 | error.LinkFailure => has_errors = true, |
| 2806 | else => |e| return e, | 2810 | else => |e| return e, |
| 2807 | }; | 2811 | }; |
| ... | @@ -2810,15 +2814,17 @@ pub fn resolveMergeSections(self: *Elf) !void { | ... | @@ -2810,15 +2814,17 @@ pub fn resolveMergeSections(self: *Elf) !void { |
| 2810 | if (has_errors) return error.FlushFailure; | 2814 | if (has_errors) return error.FlushFailure; |
| 2811 | | 2815 | |
| 2812 | for (self.objects.items) |index| { | 2816 | for (self.objects.items) |index| { |
| 2813 | const file_ptr = self.file(index).?; | 2817 | const object = self.file(index).?.object; |
| 2814 | if (!file_ptr.isAlive()) continue; | 2818 | if (!object.alive) continue; |
| 2815 | try file_ptr.object.initOutputMergeSections(self); | 2819 | if (!object.dirty) continue; |
| | 2820 | try object.initOutputMergeSections(self); |
| 2816 | } | 2821 | } |
| 2817 | | 2822 | |
| 2818 | for (self.objects.items) |index| { | 2823 | for (self.objects.items) |index| { |
| 2819 | const file_ptr = self.file(index).?; | 2824 | const object = self.file(index).?.object; |
| 2820 | if (!file_ptr.isAlive()) continue; | 2825 | if (!object.alive) continue; |
| 2821 | file_ptr.object.resolveMergeSubsections(self) catch |err| switch (err) { | 2826 | if (!object.dirty) continue; |
| | 2827 | object.resolveMergeSubsections(self) catch |err| switch (err) { |
| 2822 | error.LinkFailure => has_errors = true, | 2828 | error.LinkFailure => has_errors = true, |
| 2823 | else => |e| return e, | 2829 | else => |e| return e, |
| 2824 | }; | 2830 | }; |