diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-02-07 02:54:18 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-02-07 03:14:26 +0100 |
| commit | 4b1a883d35565766d30f587d2cb2ccfe8c065c8b (patch) | |
| tree | b44064a12274e2b7adcfaea3adbca93ba8ce1af2 /src/link/MachO/Dylib.zig | |
| parent | f63eda3f6ae4369e12b68bb13e36b23957a9d809 (diff) | |
| download | zig-4b1a883d35565766d30f587d2cb2ccfe8c065c8b.tar.gz zig-4b1a883d35565766d30f587d2cb2ccfe8c065c8b.zip | |
macho: ensure local syms buffer is nlist_64 aligned when re-reading from file
Diffstat (limited to 'src/link/MachO/Dylib.zig')
| -rw-r--r-- | src/link/MachO/Dylib.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index 1c1842aaed..a2c4bad942 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -166,6 +166,8 @@ pub fn parseFromBinary( const symtab_cmd = cmd.cast(macho.symtab_command).?; const symtab = @ptrCast( [*]const macho.nlist_64, + // Alignment is guaranteed as a dylib is a final linked image and has to have sections + // properly aligned in order to be correctly loaded by the loader. @alignCast(@alignOf(macho.nlist_64), &data[symtab_cmd.symoff]), )[0..symtab_cmd.nsyms]; const strtab = data[symtab_cmd.stroff..][0..symtab_cmd.strsize]; |
