authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-03-05 00:37:25+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-03-17 19:59:13+01:00
logdc34ac2b9e283ac4ca6c07ed9f4e201f860639d0
treeb886a93da2fc27af0d67481608fd252456cde885
parent5d8944edc1361aeb36a55d8435ef1feecf714958

zld: fix incorrect offset calc for DICE


1 files changed, 1 insertions(+), 2 deletions(-)

src/link/MachO/Zld.zig+1-2
......@@ -2787,13 +2787,12 @@ fn writeDataInCode(self: *Zld) !void {
27872787 .source_sect_id = object.text_section_index.?,
27882788 }) orelse continue;
27892789
2790 // TODO Currently assume that Dice will always be within the __TEXT,__text section.
27912790 try buf.ensureCapacity(
27922791 buf.items.len + object.data_in_code_entries.items.len * @sizeOf(macho.data_in_code_entry),
27932792 );
27942793 for (object.data_in_code_entries.items) |dice| {
27952794 const new_dice: macho.data_in_code_entry = .{
2796 .offset = text_sect.offset + target_mapping.offset + dice.offset - source_sect.offset,
2795 .offset = text_sect.offset + target_mapping.offset + dice.offset,
27972796 .length = dice.length,
27982797 .kind = dice.kind,
27992798 };