authorgravatar for marionauta@users.noreply.github.comMario Nachbaur <marionauta@users.noreply.github.com> 2024-10-29 22:12:57+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-10-29 22:12:57+01:00
log4661705a0e9b28ea008ffb85258daf1d5510b054
tree078d340cf691e574bf2ec1ec49e4c1582f58e391
parent3450809e3db14226b7f8e57bdfa7fde590e803d8
signaturebadge-check Signed by PGP key B5690EEEBB952194

std.debug: watchOS: fixes for ilp32 ABI (#21765)

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.

2 files changed, 6 insertions(+), 4 deletions(-)

lib/std/debug.zig+1-1
...@@ -656,7 +656,7 @@ pub const StackIterator = struct {...@@ -656,7 +656,7 @@ pub const StackIterator = struct {
656 // The implementation of DWARF unwinding on aarch64-macos is not complete. However, Apple mandates that656 // The implementation of DWARF unwinding on aarch64-macos is not complete. However, Apple mandates that
657 // the frame pointer register is always used, so on this platform we can safely use the FP-based unwinder.657 // the frame pointer register is always used, so on this platform we can safely use the FP-based unwinder.
658 if (builtin.target.isDarwin() and native_arch == .aarch64)658 if (builtin.target.isDarwin() and native_arch == .aarch64)
659 return init(first_address, context.mcontext.ss.fp);659 return init(first_address, @truncate(context.mcontext.ss.fp));
660660
661 if (SelfInfo.supports_unwinding) {661 if (SelfInfo.supports_unwinding) {
662 var iterator = init(first_address, null);662 var iterator = init(first_address, null);
lib/std/debug/SelfInfo.zig+5-3
...@@ -184,10 +184,12 @@ fn lookupModuleDyld(self: *SelfInfo, address: usize) !*Module {...@@ -184,10 +184,12 @@ fn lookupModuleDyld(self: *SelfInfo, address: usize) !*Module {
184 }184 }
185185
186 for (cmd.getSections()) |sect| {186 for (cmd.getSections()) |sect| {
187 const sect_addr: usize = @intCast(sect.addr);
188 const sect_size: usize = @intCast(sect.size);
187 if (mem.eql(u8, "__unwind_info", sect.sectName())) {189 if (mem.eql(u8, "__unwind_info", sect.sectName())) {
188 unwind_info = @as([*]const u8, @ptrFromInt(sect.addr + vmaddr_slide))[0..sect.size];190 unwind_info = @as([*]const u8, @ptrFromInt(sect_addr + vmaddr_slide))[0..sect_size];
189 } else if (mem.eql(u8, "__eh_frame", sect.sectName())) {191 } else if (mem.eql(u8, "__eh_frame", sect.sectName())) {
190 eh_frame = @as([*]const u8, @ptrFromInt(sect.addr + vmaddr_slide))[0..sect.size];192 eh_frame = @as([*]const u8, @ptrFromInt(sect_addr + vmaddr_slide))[0..sect_size];
191 }193 }
192 }194 }
193195
...@@ -590,7 +592,7 @@ pub const Module = switch (native_os) {...@@ -590,7 +592,7 @@ pub const Module = switch (native_os) {
590 const section_bytes = try Dwarf.chopSlice(mapped_mem, sect.offset, sect.size);592 const section_bytes = try Dwarf.chopSlice(mapped_mem, sect.offset, sect.size);
591 sections[section_index.?] = .{593 sections[section_index.?] = .{
592 .data = section_bytes,594 .data = section_bytes,
593 .virtual_address = sect.addr,595 .virtual_address = @intCast(sect.addr),
594 .owned = false,596 .owned = false,
595 };597 };
596 }598 }