| author | |
| committer | |
| log | 760ce69734e8c6fca02356c53729909ccb5d8ff9 |
| tree | f9e0348529eab5458b6db4407aaefe381ef7f711 |
| parent | 0c6cb8d8c80f0a316a77eddfebaa42cb77c8bf7d |
2 files changed, 11 insertions(+), 18 deletions(-)
src/link/Elf.zig+9-12| ... | ... | @@ -4819,15 +4819,12 @@ fn updateSymtabSize(self: *Elf) !void { |
| 4819 | 4819 | const gpa = self.base.allocator; |
| 4820 | 4820 | var files = std.ArrayList(File.Index).init(gpa); |
| 4821 | 4821 | defer files.deinit(); |
| 4822 | try files.ensureTotalCapacityPrecise(self.objects.items.len + self.shared_objects.items.len + 1); | |
| 4822 | try files.ensureTotalCapacityPrecise(self.objects.items.len + self.shared_objects.items.len + 2); | |
| 4823 | 4823 | |
| 4824 | 4824 | if (self.zig_object_index) |index| files.appendAssumeCapacity(index); |
| 4825 | for (self.objects.items) |index| { | |
| 4826 | files.appendAssumeCapacity(index); | |
| 4827 | } | |
| 4828 | for (self.shared_objects.items) |index| { | |
| 4829 | files.appendAssumeCapacity(index); | |
| 4830 | } | |
| 4825 | for (self.objects.items) |index| files.appendAssumeCapacity(index); | |
| 4826 | for (self.shared_objects.items) |index| files.appendAssumeCapacity(index); | |
| 4827 | if (self.linker_defined_index) |index| files.appendAssumeCapacity(index); | |
| 4831 | 4828 | |
| 4832 | 4829 | // Section symbols |
| 4833 | 4830 | for (self.output_sections.keys()) |_| { |
| ... | ... | @@ -5166,6 +5163,11 @@ fn writeSymtab(self: *Elf) !void { |
| 5166 | 5163 | file_ptr.writeSymtab(self); |
| 5167 | 5164 | } |
| 5168 | 5165 | |
| 5166 | if (self.linker_defined_index) |index| { | |
| 5167 | const file_ptr = self.file(index).?; | |
| 5168 | file_ptr.writeSymtab(self); | |
| 5169 | } | |
| 5170 | ||
| 5169 | 5171 | if (self.zig_got_section_index) |_| { |
| 5170 | 5172 | self.zig_got.writeSymtab(self); |
| 5171 | 5173 | } |
| ... | ... | @@ -5182,11 +5184,6 @@ fn writeSymtab(self: *Elf) !void { |
| 5182 | 5184 | self.plt_got.writeSymtab(self); |
| 5183 | 5185 | } |
| 5184 | 5186 | |
| 5185 | if (self.linker_defined_index) |index| { | |
| 5186 | const file_ptr = self.file(index).?; | |
| 5187 | file_ptr.writeSymtab(self); | |
| 5188 | } | |
| 5189 | ||
| 5190 | 5187 | const foreign_endian = self.base.options.target.cpu.arch.endian() != builtin.cpu.arch.endian(); |
| 5191 | 5188 | switch (self.ptr_width) { |
| 5192 | 5189 | .p32 => { |
src/link/Elf/synthetic_sections.zig+2-6| ... | ... | @@ -917,8 +917,7 @@ pub const PltSection = struct { |
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | pub fn writeSymtab(plt: PltSection, elf_file: *Elf) void { |
| 920 | var ilocal = plt.output_symtab_ctx.ilocal; | |
| 921 | for (plt.symbols.items) |sym_index| { | |
| 920 | for (plt.symbols.items, plt.output_symtab_ctx.ilocal..) |sym_index, ilocal| { | |
| 922 | 921 | const sym = elf_file.symbol(sym_index); |
| 923 | 922 | const st_name = @as(u32, @intCast(elf_file.strtab.items.len)); |
| 924 | 923 | elf_file.strtab.appendSliceAssumeCapacity(sym.name(elf_file)); |
| ... | ... | @@ -932,7 +931,6 @@ pub const PltSection = struct { |
| 932 | 931 | .st_value = sym.pltAddress(elf_file), |
| 933 | 932 | .st_size = 16, |
| 934 | 933 | }; |
| 935 | ilocal += 1; | |
| 936 | 934 | } |
| 937 | 935 | } |
| 938 | 936 | |
| ... | ... | @@ -1046,8 +1044,7 @@ pub const PltGotSection = struct { |
| 1046 | 1044 | } |
| 1047 | 1045 | |
| 1048 | 1046 | pub fn writeSymtab(plt_got: PltGotSection, elf_file: *Elf) void { |
| 1049 | var ilocal = plt_got.output_symtab_ctx.ilocal; | |
| 1050 | for (plt_got.symbols.items) |sym_index| { | |
| 1047 | for (plt_got.symbols.items, plt_got.output_symtab_ctx.ilocal..) |sym_index, ilocal| { | |
| 1051 | 1048 | const sym = elf_file.symbol(sym_index); |
| 1052 | 1049 | const st_name = @as(u32, @intCast(elf_file.strtab.items.len)); |
| 1053 | 1050 | elf_file.strtab.appendSliceAssumeCapacity(sym.name(elf_file)); |
| ... | ... | @@ -1061,7 +1058,6 @@ pub const PltGotSection = struct { |
| 1061 | 1058 | .st_value = sym.pltGotAddress(elf_file), |
| 1062 | 1059 | .st_size = 16, |
| 1063 | 1060 | }; |
| 1064 | ilocal += 1; | |
| 1065 | 1061 | } |
| 1066 | 1062 | } |
| 1067 | 1063 | }; |