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>
1 files changed, 1 insertions(+), 0 deletions(-)
src/link/MachO/eh_frame.zig+1
| ... | ... | @@ -53,6 +53,7 @@ pub const Cie = struct { |
| 53 | 53 | else => @panic("unexpected lsda encoding"), // TODO error |
| 54 | 54 | } |
| 55 | 55 | }, |
| 56 | 'S' => {}, // skip |
| 56 | 57 | else => @panic("unexpected augmentation string"), // TODO error |
| 57 | 58 | }; |
| 58 | 59 | } |