commit ea9d5934556ead787ff0ef1cd7c5c8eaa4b823f0 (tree)
parent 28022760919655354dd611455be0319862a3c409
Author: Antonin Décimo <antonin.decimo@gmail.com>
Date: Fri, 13 Feb 2026 10:55:20 +0100
Mach-O: accept and skip CIE augmentation string 'S' in .eh_frame
```
* thread #1, name = 'zig', stop reason = breakpoint 1.1
frame #0: 0x00000000028387c3 zig`link.MachO.eh_frame.Cie.parse(cie=0x000000003cd62060, macho_file=0x000000003ca857c0) at eh_frame.zig:56:21
53 else => @panic("unexpected lsda encoding"), // TODO error
54 }
55 },
-> 56 else => @panic("unexpected augmentation string"), // TODO error
^
57 };
58 }
59
(lldb) frame variable
(link.MachO.eh_frame.Cie *) cie = 0x000000003cd62060
(link.MachO *) macho_file = 0x000000003ca857c0
([]u8) data = "\x14\x00\x00\x00\x00\x00\x00\x00\x01zRS\x00\x01x\x1e\x01\x10\x0c\x1f\x00\x00\x00\x00"
([]u8) aug = "zRS"
(Io.Reader) reader = {
vtable = 0x0000000005407ec0
buffer = "\x01x\x1e\x01\x10\x0c\x1f\x00\x00\x00\x00"
seek = 5
end = 11
}
(unsigned char) ch = 'S'
```
zig supports RPL for augmentation strings, and finds zRS (though it
scans RS). It panics on S. Presumably the parser should just ignore
this at this stage. (found [this description][1], and a bit of code [here][2]
and [there][3]).
[1]: https://www.airs.com/blog/archives/460
[2]:
https://github.com/eliben/pyelftools/blob/main/elftools/dwarf/callframe.py#L287
[3]: https://sourceforge.net/p/elftoolchain/tickets/557/
> The character ‘S’ in the augmentation string means that this CIE
> represents a stack frame for the invocation of a signal
> handler. When unwinding the stack, signal stack frames are handled
> slightly differently: the instruction pointer is assumed to be
> before the next instruction to execute rather than after it.
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/link/MachO/eh_frame.zig b/src/link/MachO/eh_frame.zig
@@ -53,6 +53,7 @@ pub const Cie = struct {
else => @panic("unexpected lsda encoding"), // TODO error
}
},
+ 'S' => {}, // skip
else => @panic("unexpected augmentation string"), // TODO error
};
}