| ... | ... | @@ -691,7 +691,7 @@ pub const DwarfInfo = struct { |
| 691 | 691 | is_macho: bool, |
| 692 | 692 | |
| 693 | 693 | pub fn section(di: DwarfInfo, dwarf_section: DwarfSection) ?[]const u8 { |
| 694 | | return if (di.sections[@enumToInt(dwarf_section)]) |s| s.data else null; |
| 694 | return if (di.sections[@intFromEnum(dwarf_section)]) |s| s.data else null; |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | pub fn deinit(di: *DwarfInfo, allocator: mem.Allocator) void { |
| ... | ... | @@ -1506,12 +1506,12 @@ pub const DwarfInfo = struct { |
| 1506 | 1506 | if (table_enc == EH.PE.omit) break :blk; |
| 1507 | 1507 | |
| 1508 | 1508 | const eh_frame_ptr = std.math.cast(usize, try readEhPointer(reader, eh_frame_ptr_enc, @sizeOf(usize), .{ |
| 1509 | | .pc_rel_base = @ptrToInt(&eh_frame_hdr[stream.pos]), |
| 1509 | .pc_rel_base = @intFromPtr(&eh_frame_hdr[stream.pos]), |
| 1510 | 1510 | .follow_indirect = true, |
| 1511 | 1511 | }, builtin.cpu.arch.endian()) orelse return badDwarf()) orelse return badDwarf(); |
| 1512 | 1512 | |
| 1513 | 1513 | const fde_count = std.math.cast(usize, try readEhPointer(reader, fde_count_enc, @sizeOf(usize), .{ |
| 1514 | | .pc_rel_base = @ptrToInt(&eh_frame_hdr[stream.pos]), |
| 1514 | .pc_rel_base = @intFromPtr(&eh_frame_hdr[stream.pos]), |
| 1515 | 1515 | .follow_indirect = true, |
| 1516 | 1516 | }, builtin.cpu.arch.endian()) orelse return badDwarf()) orelse return badDwarf(); |
| 1517 | 1517 | |
| ... | ... | @@ -1538,7 +1538,7 @@ pub const DwarfInfo = struct { |
| 1538 | 1538 | .cie => { |
| 1539 | 1539 | const cie = try CommonInformationEntry.parse( |
| 1540 | 1540 | entry_header.entry_bytes, |
| 1541 | | -@intCast(isize, @ptrToInt(binary_mem.ptr)), |
| 1541 | -@intCast(isize, @intFromPtr(binary_mem.ptr)), |
| 1542 | 1542 | //@ptrToInt(eh_frame.ptr), |
| 1543 | 1543 | //@ptrToInt(eh_frame.ptr) - @ptrToInt(binary_mem.ptr), |
| 1544 | 1544 | true, |
| ... | ... | @@ -1552,7 +1552,7 @@ pub const DwarfInfo = struct { |
| 1552 | 1552 | const cie = di.cie_map.get(cie_offset) orelse return badDwarf(); |
| 1553 | 1553 | const fde = try FrameDescriptionEntry.parse( |
| 1554 | 1554 | entry_header.entry_bytes, |
| 1555 | | -@intCast(isize, @ptrToInt(binary_mem.ptr)), |
| 1555 | -@intCast(isize, @intFromPtr(binary_mem.ptr)), |
| 1556 | 1556 | //@ptrToInt(eh_frame.ptr), |
| 1557 | 1557 | //@ptrToInt(eh_frame.ptr) - @ptrToInt(binary_mem.ptr), |
| 1558 | 1558 | true, |
| ... | ... | @@ -1594,7 +1594,7 @@ pub const DwarfInfo = struct { |
| 1594 | 1594 | |
| 1595 | 1595 | if (di.eh_frame_hdr) |header| { |
| 1596 | 1596 | mapped_pc = context.pc; |
| 1597 | | try header.findEntry(context.isValidMemory, @ptrToInt(di.section(.eh_frame_hdr).?.ptr), mapped_pc, &cie, &fde); |
| 1597 | try header.findEntry(context.isValidMemory, @intFromPtr(di.section(.eh_frame_hdr).?.ptr), mapped_pc, &cie, &fde); |
| 1598 | 1598 | } else { |
| 1599 | 1599 | mapped_pc = context.pc - module_base_address; |
| 1600 | 1600 | const index = std.sort.binarySearch(FrameDescriptionEntry, mapped_pc, di.fde_list.items, {}, struct { |
| ... | ... | @@ -1790,7 +1790,7 @@ fn readEhPointer(reader: anytype, enc: u8, addr_size_bytes: u8, ctx: EhPointerCo |
| 1790 | 1790 | |
| 1791 | 1791 | const native_ptr = math.cast(usize, ptr) orelse return error.PointerOverflow; |
| 1792 | 1792 | return switch (addr_size_bytes) { |
| 1793 | | 2, 4, 8 => return @intToPtr(*const usize, native_ptr).*, |
| 1793 | 2, 4, 8 => return @ptrFromInt(*const usize, native_ptr).*, |
| 1794 | 1794 | else => return error.UnsupportedAddrSize, |
| 1795 | 1795 | }; |
| 1796 | 1796 | } else { |
| ... | ... | @@ -1842,7 +1842,7 @@ pub const ExceptionFrameHeader = struct { |
| 1842 | 1842 | |
| 1843 | 1843 | try stream.seekTo(mid * entry_size); |
| 1844 | 1844 | const pc_begin = try readEhPointer(reader, self.table_enc, @sizeOf(usize), .{ |
| 1845 | | .pc_rel_base = @ptrToInt(&self.entries[stream.pos]), |
| 1845 | .pc_rel_base = @intFromPtr(&self.entries[stream.pos]), |
| 1846 | 1846 | .follow_indirect = true, |
| 1847 | 1847 | .data_rel_base = eh_frame_hdr_ptr, |
| 1848 | 1848 | }, builtin.cpu.arch.endian()) orelse return badDwarf(); |
| ... | ... | @@ -1857,13 +1857,13 @@ pub const ExceptionFrameHeader = struct { |
| 1857 | 1857 | |
| 1858 | 1858 | // Read past pc_begin |
| 1859 | 1859 | _ = try readEhPointer(reader, self.table_enc, @sizeOf(usize), .{ |
| 1860 | | .pc_rel_base = @ptrToInt(&self.entries[stream.pos]), |
| 1860 | .pc_rel_base = @intFromPtr(&self.entries[stream.pos]), |
| 1861 | 1861 | .follow_indirect = true, |
| 1862 | 1862 | .data_rel_base = eh_frame_hdr_ptr, |
| 1863 | 1863 | }, builtin.cpu.arch.endian()) orelse return badDwarf(); |
| 1864 | 1864 | |
| 1865 | 1865 | const fde_ptr = math.cast(usize, try readEhPointer(reader, self.table_enc, @sizeOf(usize), .{ |
| 1866 | | .pc_rel_base = @ptrToInt(&self.entries[stream.pos]), |
| 1866 | .pc_rel_base = @intFromPtr(&self.entries[stream.pos]), |
| 1867 | 1867 | .follow_indirect = true, |
| 1868 | 1868 | .data_rel_base = eh_frame_hdr_ptr, |
| 1869 | 1869 | }, builtin.cpu.arch.endian()) orelse return badDwarf()) orelse return badDwarf(); |
| ... | ... | @@ -1872,20 +1872,20 @@ pub const ExceptionFrameHeader = struct { |
| 1872 | 1872 | |
| 1873 | 1873 | // The length of the .eh_frame section is unknown at this point, since .eh_frame_hdr only provides the start |
| 1874 | 1874 | if (!isValidMemory(fde_ptr) or fde_ptr < self.eh_frame_ptr) return badDwarf(); |
| 1875 | | const eh_frame = @intToPtr([*]const u8, self.eh_frame_ptr)[0..math.maxInt(usize)]; |
| 1875 | const eh_frame = @ptrFromInt([*]const u8, self.eh_frame_ptr)[0..math.maxInt(usize)]; |
| 1876 | 1876 | const fde_offset = fde_ptr - self.eh_frame_ptr; |
| 1877 | 1877 | |
| 1878 | 1878 | var eh_frame_stream = io.fixedBufferStream(eh_frame); |
| 1879 | 1879 | try eh_frame_stream.seekTo(fde_offset); |
| 1880 | 1880 | |
| 1881 | 1881 | const fde_entry_header = try EntryHeader.read(&eh_frame_stream, builtin.cpu.arch.endian()); |
| 1882 | | if (!isValidMemory(@ptrToInt(&fde_entry_header.entry_bytes[fde_entry_header.entry_bytes.len - 1]))) return badDwarf(); |
| 1882 | if (!isValidMemory(@intFromPtr(&fde_entry_header.entry_bytes[fde_entry_header.entry_bytes.len - 1]))) return badDwarf(); |
| 1883 | 1883 | if (fde_entry_header.type != .fde) return badDwarf(); |
| 1884 | 1884 | |
| 1885 | 1885 | const cie_offset = fde_entry_header.type.fde; |
| 1886 | 1886 | try eh_frame_stream.seekTo(cie_offset); |
| 1887 | 1887 | const cie_entry_header = try EntryHeader.read(&eh_frame_stream, builtin.cpu.arch.endian()); |
| 1888 | | if (!isValidMemory(@ptrToInt(&cie_entry_header.entry_bytes[cie_entry_header.entry_bytes.len - 1]))) return badDwarf(); |
| 1888 | if (!isValidMemory(@intFromPtr(&cie_entry_header.entry_bytes[cie_entry_header.entry_bytes.len - 1]))) return badDwarf(); |
| 1889 | 1889 | if (cie_entry_header.type != .cie) return badDwarf(); |
| 1890 | 1890 | |
| 1891 | 1891 | cie.* = try CommonInformationEntry.parse( |
| ... | ... | @@ -2083,7 +2083,7 @@ pub const CommonInformationEntry = struct { |
| 2083 | 2083 | personality_enc.?, |
| 2084 | 2084 | addr_size_bytes, |
| 2085 | 2085 | .{ |
| 2086 | | .pc_rel_base = try pcRelBase(@ptrToInt(&cie_bytes[stream.pos]), pc_rel_offset), |
| 2086 | .pc_rel_base = try pcRelBase(@intFromPtr(&cie_bytes[stream.pos]), pc_rel_offset), |
| 2087 | 2087 | .follow_indirect = is_runtime, |
| 2088 | 2088 | }, |
| 2089 | 2089 | endian, |
| ... | ... | @@ -2161,7 +2161,7 @@ pub const FrameDescriptionEntry = struct { |
| 2161 | 2161 | cie.fde_pointer_enc, |
| 2162 | 2162 | addr_size_bytes, |
| 2163 | 2163 | .{ |
| 2164 | | .pc_rel_base = try pcRelBase(@ptrToInt(&fde_bytes[stream.pos]), pc_rel_offset), |
| 2164 | .pc_rel_base = try pcRelBase(@intFromPtr(&fde_bytes[stream.pos]), pc_rel_offset), |
| 2165 | 2165 | .follow_indirect = is_runtime, |
| 2166 | 2166 | }, |
| 2167 | 2167 | endian, |
| ... | ... | @@ -2190,7 +2190,7 @@ pub const FrameDescriptionEntry = struct { |
| 2190 | 2190 | cie.lsda_pointer_enc, |
| 2191 | 2191 | addr_size_bytes, |
| 2192 | 2192 | .{ |
| 2193 | | .pc_rel_base = try pcRelBase(@ptrToInt(&fde_bytes[stream.pos]), pc_rel_offset), |
| 2193 | .pc_rel_base = try pcRelBase(@intFromPtr(&fde_bytes[stream.pos]), pc_rel_offset), |
| 2194 | 2194 | .follow_indirect = is_runtime, |
| 2195 | 2195 | }, |
| 2196 | 2196 | endian, |