aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO/thunks.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-06-24 16:58:19 -0700
committerGitHub <noreply@github.com>2023-06-24 16:58:19 -0700
commit146b79af153bbd5dafda0ba12a040385c7fc58f8 (patch)
tree67e3db8b444d65c667e314770fc983a7fc8ba293 /src/link/MachO/thunks.zig
parent13853bef0df3c90633021850cc6d6abaeea03282 (diff)
parent21ac0beb436f49fe49c6982a872f2dc48e4bea5e (diff)
downloadzig-146b79af153bbd5dafda0ba12a040385c7fc58f8.tar.gz
zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.zip
Merge pull request #16163 from mlugg/feat/builtins-infer-dest-ty
Infer destination type of cast builtins using result type
Diffstat (limited to 'src/link/MachO/thunks.zig')
-rw-r--r--src/link/MachO/thunks.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/link/MachO/thunks.zig b/src/link/MachO/thunks.zig
index f3289e544b..82d0451225 100644
--- a/src/link/MachO/thunks.zig
+++ b/src/link/MachO/thunks.zig
@@ -131,7 +131,7 @@ pub fn createThunks(zld: *Zld, sect_id: u8) !void {
log.debug("GROUP END at {d}", .{group_end});
// Insert thunk at group_end
- const thunk_index = @intCast(u32, zld.thunks.items.len);
+ const thunk_index = @as(u32, @intCast(zld.thunks.items.len));
try zld.thunks.append(gpa, .{ .start_index = undefined, .len = 0 });
// Scan relocs in the group and create trampolines for any unreachable callsite.
@@ -174,7 +174,7 @@ pub fn createThunks(zld: *Zld, sect_id: u8) !void {
}
}
- header.size = @intCast(u32, offset);
+ header.size = @as(u32, @intCast(offset));
}
fn allocateThunk(
@@ -223,7 +223,7 @@ fn scanRelocs(
const base_offset = if (object.getSourceSymbol(atom.sym_index)) |source_sym| blk: {
const source_sect = object.getSourceSection(source_sym.n_sect - 1);
- break :blk @intCast(i32, source_sym.n_value - source_sect.addr);
+ break :blk @as(i32, @intCast(source_sym.n_value - source_sect.addr));
} else 0;
const code = Atom.getAtomCode(zld, atom_index);
@@ -289,7 +289,7 @@ fn scanRelocs(
}
inline fn relocNeedsThunk(rel: macho.relocation_info) bool {
- const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type);
+ const rel_type = @as(macho.reloc_type_arm64, @enumFromInt(rel.r_type));
return rel_type == .ARM64_RELOC_BRANCH26;
}
@@ -315,7 +315,7 @@ fn isReachable(
if (!allocated.contains(target_atom_index)) return false;
- const source_addr = source_sym.n_value + @intCast(u32, rel.r_address - base_offset);
+ const source_addr = source_sym.n_value + @as(u32, @intCast(rel.r_address - base_offset));
const is_via_got = Atom.relocRequiresGot(zld, rel);
const target_addr = Atom.getRelocTargetAddress(zld, target, is_via_got, false) catch unreachable;
_ = Relocation.calcPcRelativeDisplacementArm64(source_addr, target_addr) catch
@@ -349,7 +349,7 @@ fn getThunkIndex(zld: *Zld, atom_index: AtomIndex) ?ThunkIndex {
const end_addr = start_addr + thunk.getSize();
if (start_addr <= sym.n_value and sym.n_value < end_addr) {
- return @intCast(u32, i);
+ return @as(u32, @intCast(i));
}
}
return null;