From: nasm-bot f. M. Storsjö <ma...@ma...> - 2015-07-23 21:48:38
|
Commit-ID: 561242bd43ab748af68f498ba2fa30c75c4cdb7c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=561242bd43ab748af68f498ba2fa30c75c4cdb7c Author: Martin Storsjö <ma...@ma...> AuthorDate: Tue, 9 Jun 2015 10:03:36 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 24 Jul 2015 00:45:59 +0300 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ö <ma...@ma...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/outmac64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/output/outmac64.c b/output/outmac64.c index 785ca65..d4ddeaa 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" |