mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
macho: fix dead stripping logic to exclude debug sections
This commit is contained in:
parent
10a5536a7c
commit
ef9aea75d0
@ -173,6 +173,7 @@ pub fn initOutputSection(sect: macho.section_64, macho_file: *MachO) !u8 {
|
||||
pub fn scanRelocs(self: Atom, macho_file: *MachO) !void {
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
assert(self.flags.alive);
|
||||
|
||||
const object = self.getFile(macho_file).object;
|
||||
const relocs = self.getRelocs(macho_file);
|
||||
|
||||
@ -91,7 +91,12 @@ fn mark(roots: []*Atom, objects: []const File.Index, macho_file: *MachO) void {
|
||||
for (macho_file.getFile(index).?.getAtoms()) |atom_index| {
|
||||
const atom = macho_file.getAtom(atom_index).?;
|
||||
const isec = atom.getInputSection(macho_file);
|
||||
if (isec.isDontDeadStripIfReferencesLive() and !atom.flags.alive and refersLive(atom, macho_file)) {
|
||||
if (isec.isDontDeadStripIfReferencesLive() and
|
||||
!(mem.eql(u8, isec.sectName(), "__eh_frame") or
|
||||
mem.eql(u8, isec.sectName(), "__compact_unwind") or
|
||||
isec.attrs() & macho.S_ATTR_DEBUG != 0) and
|
||||
!atom.flags.alive and refersLive(atom, macho_file))
|
||||
{
|
||||
markLive(atom, macho_file);
|
||||
loop = true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user