diff options
author | Chang S. Bae <changseok.bae@gmail.com> | 2018-10-08 18:49:55 -0700 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-10-09 10:23:05 +0300 |
commit | 195e735a81d6b07e62d606558fb3a5cb8f0f2d4a (patch) | |
tree | dc5cb1dcb88e31d0016bac26ecf59c4984374628 /output/outmacho.c | |
parent | f63d211bcf9a2015276682ce4a9be5960b0aaad4 (diff) | |
download | nasm-195e735a81d6b07e62d606558fb3a5cb8f0f2d4a.tar.gz |
macho/reloc: Fix macho_output() to get the offset adjustments by add_reloc()
Unlike the relative relocations, OUT_ADDRESS had ignored the adjustments
made by add_reloc(), and writes the offset of the target symbol in the
target section.
Based-on-code-from: zenith432 <zenith432@users.sourceforge.net>
Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
Diffstat (limited to 'output/outmacho.c')
-rw-r--r-- | output/outmacho.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/output/outmacho.c b/output/outmacho.c index d1f81803..45f91b0d 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -705,8 +705,11 @@ static void macho_output(int32_t secto, const void *data, "Mach-O 64-bit format does not support" " 32-bit absolute addresses"); } else { - add_reloc(s, section, addr, RL_ABS, asize); + addr += add_reloc(s, section, addr, RL_ABS, asize); } + } else if (wrt == macho_tlvp_sect && fmt.ptrsize != 8 && + asize == (int) fmt.ptrsize) { + addr += add_reloc(s, section, addr, RL_TLV, asize); } else { nasm_error(ERR_NONFATAL, "Mach-O format does not support" " this use of WRT"); |