diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/Elf/Atom.zig | 2 | ||||
| -rw-r--r-- | src/link/Elf/Object.zig | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig index 3420833530..4d12911ad0 100644 --- a/src/link/Elf/Atom.zig +++ b/src/link/Elf/Atom.zig @@ -1172,7 +1172,7 @@ pub const Index = u32; pub const Flags = packed struct { /// Specifies whether this atom is alive or has been garbage collected. - alive: bool = false, + alive: bool = true, /// Specifies if the atom has been visited during garbage collection. visited: bool = false, diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig index 9baa5c07ed..dede48896e 100644 --- a/src/link/Elf/Object.zig +++ b/src/link/Elf/Object.zig @@ -130,7 +130,10 @@ fn initAtoms(self: *Object, elf_file: *Elf) !void { continue; } - const group_signature_off = try self.strings.insert(elf_file.base.allocator, group_signature); + // Note the assumption about a global strtab used here to disambiguate common + // COMDAT owners. + const gpa = elf_file.base.allocator; + const group_signature_off = try elf_file.strtab.insert(gpa, group_signature); const gop = try elf_file.getOrCreateComdatGroupOwner(group_signature_off); const comdat_group_index = try elf_file.addComdatGroup(); const comdat_group = elf_file.comdatGroup(comdat_group_index); @@ -138,7 +141,7 @@ fn initAtoms(self: *Object, elf_file: *Elf) !void { .owner = gop.index, .shndx = shndx, }; - try self.comdat_groups.append(elf_file.base.allocator, comdat_group_index); + try self.comdat_groups.append(gpa, comdat_group_index); }, elf.SHT_SYMTAB_SHNDX => @panic("TODO SHT_SYMTAB_SHNDX"), @@ -184,7 +187,6 @@ fn addAtom( atom.name_offset = try elf_file.strtab.insert(elf_file.base.allocator, name); atom.file_index = self.index; atom.input_section_index = shndx; - atom.flags.alive = true; self.atoms.items[shndx] = atom_index; if (shdr.sh_flags & elf.SHF_COMPRESSED != 0) { |
