authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-08-19 07:54:21-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-08-20 08:09:33-04:00
logef90eb0d4d88e0f4ab4ba72bfb2b523dbd5001fa
tree0caaaf5bc3d35494bc6757dedd7f5e373e9d51be
parent78dec0a3da4bdf617841062d42c172acb1a5dcbb

Dwarf: delete incorrect logic that also has the possibility of crashing


1 files changed, 3 insertions(+), 30 deletions(-)

src/link/Dwarf.zig+3-30
...@@ -1608,16 +1608,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -1608,16 +1608,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
1608 try wip_nav.exprloc(.{ .addr = .{ .sym = sym_index } });1608 try wip_nav.exprloc(.{ .addr = .{ .sym = sym_index } });
1609 try uleb128(diw, nav.status.resolved.alignment.toByteUnits() orelse1609 try uleb128(diw, nav.status.resolved.alignment.toByteUnits() orelse
1610 ty.abiAlignment(pt).toByteUnits().?);1610 ty.abiAlignment(pt).toByteUnits().?);
1611 const func_unit = InternPool.AnalUnit.wrap(.{ .func = nav_val.toIntern() });1611 try diw.writeByte(@intFromBool(false));
1612 try diw.writeByte(@intFromBool(for (if (zcu.single_exports.get(func_unit)) |export_index|
1613 zcu.all_exports.items[export_index..][0..1]
1614 else if (zcu.multi_exports.get(func_unit)) |export_range|
1615 zcu.all_exports.items[export_range.index..][0..export_range.len]
1616 else
1617 &.{}) |@"export"|
1618 {
1619 if (@"export".exported == .nav and @"export".exported.nav == nav_index) break true;
1620 } else false));
1621 wip_nav.finishForward(ty_reloc_index);1612 wip_nav.finishForward(ty_reloc_index);
1622 try uleb128(diw, @intFromEnum(AbbrevCode.is_const));1613 try uleb128(diw, @intFromEnum(AbbrevCode.is_const));
1623 try wip_nav.refType(ty);1614 try wip_nav.refType(ty);
...@@ -1668,16 +1659,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -1668,16 +1659,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
1668 try wip_nav.exprloc(if (variable.is_threadlocal) .{ .form_tls_address = &addr } else addr);1659 try wip_nav.exprloc(if (variable.is_threadlocal) .{ .form_tls_address = &addr } else addr);
1669 try uleb128(diw, nav.status.resolved.alignment.toByteUnits() orelse1660 try uleb128(diw, nav.status.resolved.alignment.toByteUnits() orelse
1670 ty.abiAlignment(pt).toByteUnits().?);1661 ty.abiAlignment(pt).toByteUnits().?);
1671 const func_unit = InternPool.AnalUnit.wrap(.{ .func = nav_val.toIntern() });1662 try diw.writeByte(@intFromBool(false));
1672 try diw.writeByte(@intFromBool(for (if (zcu.single_exports.get(func_unit)) |export_index|
1673 zcu.all_exports.items[export_index..][0..1]
1674 else if (zcu.multi_exports.get(func_unit)) |export_range|
1675 zcu.all_exports.items[export_range.index..][0..export_range.len]
1676 else
1677 &.{}) |@"export"|
1678 {
1679 if (@"export".exported == .nav and @"export".exported.nav == nav_index) break true;
1680 } else false));
1681 },1663 },
1682 .func => |func| {1664 .func => |func| {
1683 assert(file.zir_loaded);1665 assert(file.zir_loaded);
...@@ -1739,16 +1721,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -1739,16 +1721,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
1739 try diw.writeByteNTimes(0, @intFromEnum(dwarf.address_size));1721 try diw.writeByteNTimes(0, @intFromEnum(dwarf.address_size));
1740 try uleb128(diw, nav.status.resolved.alignment.toByteUnits() orelse1722 try uleb128(diw, nav.status.resolved.alignment.toByteUnits() orelse
1741 target_info.defaultFunctionAlignment(file.mod.resolved_target.result).toByteUnits().?);1723 target_info.defaultFunctionAlignment(file.mod.resolved_target.result).toByteUnits().?);
1742 const func_unit = InternPool.AnalUnit.wrap(.{ .func = nav_val.toIntern() });1724 try diw.writeByte(@intFromBool(false));
1743 try diw.writeByte(@intFromBool(for (if (zcu.single_exports.get(func_unit)) |export_index|
1744 zcu.all_exports.items[export_index..][0..1]
1745 else if (zcu.multi_exports.get(func_unit)) |export_range|
1746 zcu.all_exports.items[export_range.index..][0..export_range.len]
1747 else
1748 &.{}) |@"export"|
1749 {
1750 if (@"export".exported == .nav and @"export".exported.nav == nav_index) break true;
1751 } else false));
1752 try diw.writeByte(@intFromBool(func_type.return_type == .noreturn_type));1725 try diw.writeByte(@intFromBool(func_type.return_type == .noreturn_type));
17531726
1754 const dlw = wip_nav.debug_line.writer(dwarf.gpa);1727 const dlw = wip_nav.debug_line.writer(dwarf.gpa);