aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-02-07 19:27:11 +0100
committerJakub Konka <kubkon@jakubkonka.com>2023-02-08 05:03:14 +0100
commit94c68c1f9ed74cd5e2b4ab4329166ba5e5d7abc3 (patch)
treecc12e73c93487f40db91f1f2ecfdb2d303460bd7 /src/link
parent9ccd8ed0ad4cc9e68c2a2e0c9b1e32d50259357e (diff)
downloadzig-94c68c1f9ed74cd5e2b4ab4329166ba5e5d7abc3.tar.gz
zig-94c68c1f9ed74cd5e2b4ab4329166ba5e5d7abc3.zip
macho: fix incorrect representation of encodings count per page
There can be a maximum of 256 compact encodings per page in compact unwind info, and we were using `u8` to represent the count which is insufficient. This commit bumps it to `u9`.
Diffstat (limited to 'src/link')
-rw-r--r--src/link/MachO/UnwindInfo.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/link/MachO/UnwindInfo.zig b/src/link/MachO/UnwindInfo.zig
index 25bd667610..5e61834bbc 100644
--- a/src/link/MachO/UnwindInfo.zig
+++ b/src/link/MachO/UnwindInfo.zig
@@ -68,7 +68,7 @@ const Page = struct {
start: RecordIndex,
count: u16,
page_encodings: [max_compact_encodings]RecordIndex = undefined,
- page_encodings_count: u8 = 0,
+ page_encodings_count: u9 = 0,
fn appendPageEncoding(page: *Page, record_id: RecordIndex) void {
assert(page.page_encodings_count <= max_compact_encodings);
@@ -81,13 +81,13 @@ const Page = struct {
info: *const UnwindInfo,
enc: macho.compact_unwind_encoding_t,
) ?u8 {
- comptime var index: u8 = 0;
+ comptime var index: u9 = 0;
inline while (index < max_compact_encodings) : (index += 1) {
if (index >= page.page_encodings_count) return null;
const record_id = page.page_encodings[index];
const record = info.records.items[record_id];
if (record.compactUnwindEncoding == enc) {
- return index;
+ return @intCast(u8, index);
}
}
return null;