Skip to content

Commit

Permalink
std.debug: watchOS: fixes for ilp32 ABI (#21765)
Browse files Browse the repository at this point in the history
Xcode requires target arm64_32 (aarch64-watchos-ilp32) in order to
build code for Apple Watches. This commit fixes compilation errors
that appear when compiling with that target.
  • Loading branch information
marionauta authored Oct 29, 2024
1 parent 3450809 commit 4661705
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/std/debug.zig
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ pub const StackIterator = struct {
// The implementation of DWARF unwinding on aarch64-macos is not complete. However, Apple mandates that
// the frame pointer register is always used, so on this platform we can safely use the FP-based unwinder.
if (builtin.target.isDarwin() and native_arch == .aarch64)
return init(first_address, context.mcontext.ss.fp);
return init(first_address, @truncate(context.mcontext.ss.fp));

if (SelfInfo.supports_unwinding) {
var iterator = init(first_address, null);
Expand Down
8 changes: 5 additions & 3 deletions lib/std/debug/SelfInfo.zig
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ fn lookupModuleDyld(self: *SelfInfo, address: usize) !*Module {
}

for (cmd.getSections()) |sect| {
const sect_addr: usize = @intCast(sect.addr);
const sect_size: usize = @intCast(sect.size);
if (mem.eql(u8, "__unwind_info", sect.sectName())) {
unwind_info = @as([*]const u8, @ptrFromInt(sect.addr + vmaddr_slide))[0..sect.size];
unwind_info = @as([*]const u8, @ptrFromInt(sect_addr + vmaddr_slide))[0..sect_size];
} else if (mem.eql(u8, "__eh_frame", sect.sectName())) {
eh_frame = @as([*]const u8, @ptrFromInt(sect.addr + vmaddr_slide))[0..sect.size];
eh_frame = @as([*]const u8, @ptrFromInt(sect_addr + vmaddr_slide))[0..sect_size];
}
}

Expand Down Expand Up @@ -590,7 +592,7 @@ pub const Module = switch (native_os) {
const section_bytes = try Dwarf.chopSlice(mapped_mem, sect.offset, sect.size);
sections[section_index.?] = .{
.data = section_bytes,
.virtual_address = sect.addr,
.virtual_address = @intCast(sect.addr),
.owned = false,
};
}
Expand Down

0 comments on commit 4661705

Please sign in to comment.