diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-01-06 20:07:13 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-01-06 20:07:13 +0000 |
| commit | fba2c04f31e119eacf142fcbbaabd5a9e63a39ed (patch) | |
| tree | 59eba88ea527759edb2c98d294ae369f95f57e33 /lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp | |
| parent | 5a5c549fe9a3fef595297bd21d36bed8409dc37d (diff) | |
Notes
Diffstat (limited to 'lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp')
| -rw-r--r-- | lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp b/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp index c57a00359e33..8b4d1cf38cba 100644 --- a/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp +++ b/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp @@ -647,13 +647,33 @@ void ArchHandler_x86_64::applyFixupRelocatable(const Reference &ref, *loc32 = ref.addend() + inAtomAddress - fixupAddress; return; case delta32Anon: - *loc32 = (targetAddress - fixupAddress) + ref.addend(); + // The value we write here should be the the delta to the target + // after taking in to account the difference from the fixup back to the + // last defined label + // ie, if we have: + // _base: ... + // Lfixup: .quad Ltarget - . + // ... + // Ltarget: + // + // Then we want to encode the value (Ltarget + addend) - (LFixup - _base) + *loc32 = (targetAddress + ref.addend()) - (fixupAddress - inAtomAddress); return; case delta64: *loc64 = ref.addend() + inAtomAddress - fixupAddress; return; case delta64Anon: - *loc64 = (targetAddress - fixupAddress) + ref.addend(); + // The value we write here should be the the delta to the target + // after taking in to account the difference from the fixup back to the + // last defined label + // ie, if we have: + // _base: ... + // Lfixup: .quad Ltarget - . + // ... + // Ltarget: + // + // Then we want to encode the value (Ltarget + addend) - (LFixup - _base) + *loc64 = (targetAddress + ref.addend()) - (fixupAddress - inAtomAddress); return; case negDelta32: *loc32 = fixupAddress - targetAddress + ref.addend(); |
