diff options
author | Martin Storsjö <martin@martin.st> | 2015-06-09 10:03:36 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2015-07-24 00:45:59 +0300 |
commit | 561242bd43ab748af68f498ba2fa30c75c4cdb7c (patch) | |
tree | 8455a9e99a0f672d0e61e592a4adcfe617a46889 | |
parent | 6f05b8008c883e9898c1582a72b5b96db940943c (diff) | |
download | nasm-561242bd43ab748af68f498ba2fa30c75c4cdb7c.tar.gz |
out: maco64 -- Properly update the full 64 bit value when adding relocations
Previously only the first byte was updated (since @mydata
is a an uint8_t[]).
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | output/outmac64.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/output/outmac64.c b/output/outmac64.c index 785ca658..d4ddeaa6 100644 --- a/output/outmac64.c +++ b/output/outmac64.c @@ -600,7 +600,7 @@ static void macho_output(int32_t secto, const void *data, " section base references"); } else { if (wrt == NO_SEG) { - *mydata -= add_reloc(s, section, 1, 4, *(int64_t *)mydata); // X86_64_RELOC_SIGNED/BRANCH + *(int64_t *)mydata -= add_reloc(s, section, 1, 4, *(int64_t *)mydata); // X86_64_RELOC_SIGNED/BRANCH } else if (wrt == macho_gotpcrel_sect) { if (s->data->datalen > 1) { saa_fread(s->data, s->data->datalen-2, &gotload, 1); // Retrieve Instruction Opcode @@ -608,9 +608,9 @@ static void macho_output(int32_t secto, const void *data, gotload = 0; } if (gotload == 0x8B) { // Check for MOVQ Opcode - *mydata -= add_reloc(s, section, 4, 4, *(int64_t *)mydata); // X86_64_GOT_LOAD (MOVQ load) + *(int64_t *)mydata -= add_reloc(s, section, 4, 4, *(int64_t *)mydata); // X86_64_GOT_LOAD (MOVQ load) } else { - *mydata -= add_reloc(s, section, 3, 4, *(int64_t *)mydata); // X86_64_GOT + *(int64_t *)mydata -= add_reloc(s, section, 3, 4, *(int64_t *)mydata); // X86_64_GOT } } else { nasm_error(ERR_NONFATAL, "Mach-O format does not support" |