mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
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>
This commit is contained in:
parent
6f05b8008c
commit
561242bd43
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user