diff options
author | Zenith432 <zenith432@users.sourceforge.net> | 2016-05-09 11:16:10 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2016-05-09 11:16:10 -0700 |
commit | 84f6860ed53492976c9d79e9a8a0bdc60da78bc6 (patch) | |
tree | 29807a9a8f6409a22b338a1f8c8b9490a7132efc | |
parent | ccb16787d5210596bd6e54305898868ba79379fc (diff) | |
download | nasm-84f6860ed53492976c9d79e9a8a0bdc60da78bc6.tar.gz |
outmacho: Fix relative relocations for 32-bit Mach-O
IP-relative relocations were broken for 32-bit Mach-O when referencing
external symbols after the Mach-O backends were merged.
This fixes bug reports 3392348, 3392352, and 3392346.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | output/outmacho.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/output/outmacho.c b/output/outmacho.c index 26a62ea6..70936ecb 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -465,6 +465,8 @@ static int64_t add_reloc(struct section *sect, int32_t section, r->snum = raa_read(extsyms, section); if (reltype == RL_BRANCH) r->type = X86_64_RELOC_BRANCH; + else if (reltype == GENERIC_RELOC_VANILLA) + adjust = -sect->size; } else { /* local */ r->ext = 0; @@ -1321,6 +1323,8 @@ static void macho_write_section (void) l += sectstab[r->snum]->addr; if (r->pcrel) l -= s->addr; + } else if (r->pcrel && r->type == GENERIC_RELOC_VANILLA) + l -= s->addr; } /* write new offset back */ |