| author | |
| committer | |
| log | 02db9933a4a0a99836f33757932f07263945166a |
| tree | e50c82d038f70815f9f753071a91fcec85e17ebd |
| parent | 3dff040ca58effc5aaf1c7313a7baa28ec2ac6dd |
2 files changed, 12 insertions(+), 4 deletions(-)
src/link/MachO/eh_frame.zig+9-1| ... | ... | @@ -159,6 +159,14 @@ pub fn write(zld: *Zld, unwind_info: *UnwindInfo) !void { |
| 159 | 159 | switch (cpu_arch) { |
| 160 | 160 | .aarch64 => {}, // relocs take care of LSDA pointers |
| 161 | 161 | .x86_64 => { |
| 162 | // We need to relocate target symbol address ourselves. | |
| 163 | const atom = zld.getAtom(atom_index); | |
| 164 | const atom_sym = zld.getSymbol(atom.getSymbolWithLoc()); | |
| 165 | try fde_record.setTargetSymbolAddress(atom_sym.n_value, .{ | |
| 166 | .base_addr = sect.addr, | |
| 167 | .base_offset = eh_frame_offset, | |
| 168 | }); | |
| 169 | ||
| 162 | 170 | // We need to parse LSDA pointer and relocate ourselves. |
| 163 | 171 | const cie_record = eh_records.get( |
| 164 | 172 | eh_frame_offset + 4 - fde_record.getCiePointer(), |
| ... | ... | @@ -267,7 +275,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { |
| 267 | 275 | }) !void { |
| 268 | 276 | assert(rec.tag == .fde); |
| 269 | 277 | const addend = @intCast(i64, value) - @intCast(i64, ctx.base_addr + ctx.base_offset + 8); |
| 270 | mem.writeIntLittle(i64, addend, rec.data[4..][0..8]); | |
| 278 | mem.writeIntLittle(i64, rec.data[4..][0..8], addend); | |
| 271 | 279 | } |
| 272 | 280 | |
| 273 | 281 | pub fn getPersonalityPointerReloc( |
test/link/macho/uuid/build.zig+3-3| ... | ... | @@ -21,9 +21,9 @@ pub fn build(b: *Builder) void { |
| 21 | 21 | .os_tag = .macos, |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | testUuid(b, test_step, .ReleaseSafe, x86_64_macos, "63f47191c7153f5fba48bd63cb2f5f57"); | |
| 25 | testUuid(b, test_step, .ReleaseFast, x86_64_macos, "63f47191c7153f5fba48bd63cb2f5f57"); | |
| 26 | testUuid(b, test_step, .ReleaseSmall, x86_64_macos, "e7bba66220e33eda9e73ab293ccf93d2"); | |
| 24 | testUuid(b, test_step, .ReleaseSafe, x86_64_macos, "5b7071b4587c3071b0d2352fadce0e48"); | |
| 25 | testUuid(b, test_step, .ReleaseFast, x86_64_macos, "5b7071b4587c3071b0d2352fadce0e48"); | |
| 26 | testUuid(b, test_step, .ReleaseSmall, x86_64_macos, "4b58f2583c383169bbe3a716bd240048"); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | fn testUuid( |