| ... | ... | @@ -3868,22 +3868,7 @@ pub fn allocateAllocSections(self: *Elf) !void { |
| 3868 | 3868 | |
| 3869 | 3869 | if (shdr.sh_offset > 0) { |
| 3870 | 3870 | // Get size actually commited to the output file. |
| 3871 | | const existing_size = if (self.zigObjectPtr()) |zo| for ([_]?Symbol.Index{ |
| 3872 | | zo.text_index, |
| 3873 | | zo.rodata_index, |
| 3874 | | zo.data_relro_index, |
| 3875 | | zo.data_index, |
| 3876 | | zo.tdata_index, |
| 3877 | | zo.eh_frame_index, |
| 3878 | | }) |maybe_sym_index| { |
| 3879 | | const sect_sym_index = maybe_sym_index orelse continue; |
| 3880 | | const sect_atom_ptr = zo.symbol(sect_sym_index).atom(self).?; |
| 3881 | | if (sect_atom_ptr.output_section_index != shndx) continue; |
| 3882 | | break sect_atom_ptr.size; |
| 3883 | | } else 0 else 0 + if (!slice.items(.atom_list_2)[shndx].dirty) |
| 3884 | | slice.items(.atom_list_2)[shndx].size |
| 3885 | | else |
| 3886 | | 0; |
| 3871 | const existing_size = self.sectionSize(shndx); |
| 3887 | 3872 | const amt = try self.base.file.?.copyRangeAll( |
| 3888 | 3873 | shdr.sh_offset, |
| 3889 | 3874 | self.base.file.?, |
| ... | ... | @@ -5682,6 +5667,12 @@ const Section = struct { |
| 5682 | 5667 | free_list: std.ArrayListUnmanaged(Ref) = .empty, |
| 5683 | 5668 | }; |
| 5684 | 5669 | |
| 5670 | pub fn sectionSize(self: *Elf, shndx: u32) u64 { |
| 5671 | const last_atom_ref = self.sections.items(.last_atom)[shndx]; |
| 5672 | const atom_ptr = self.atom(last_atom_ref) orelse return 0; |
| 5673 | return @as(u64, @intCast(atom_ptr.value)) + atom_ptr.size; |
| 5674 | } |
| 5675 | |
| 5685 | 5676 | fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 { |
| 5686 | 5677 | return switch (cpu_arch) { |
| 5687 | 5678 | .mips, .mipsel, .mips64, .mips64el => "__start", |