mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
macho/reloc: Fixed in handling GOT/GOTLOAD/TLV relocations
- Changed to search all symbols, instead of only global symbols. - Will do immediate exits when unsupported use of WRT - Fixed to mark (got)pcrel flag only for macho64 output. GOT is supported only for 64-bit. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
This commit is contained in:
parent
4cbbb3940d
commit
e859ece378
@ -569,18 +569,22 @@ static int64_t add_reloc(struct section *sect, int32_t section,
|
||||
goto needsym;
|
||||
|
||||
needsym:
|
||||
r->pcrel = 1;
|
||||
r->pcrel = (fmt.ptrsize == 8 ? 1 : 0);
|
||||
if (section == NO_SEG) {
|
||||
nasm_error(ERR_NONFATAL, "Unsupported use of use of WRT");
|
||||
goto bail;
|
||||
} else if (fi == NO_SECT) {
|
||||
/* external */
|
||||
r->snum = raa_read(extsyms, section);
|
||||
} else {
|
||||
/* internal - does it really need to be global? */
|
||||
struct symbol *sym = macho_find_sym(s, offset, true,
|
||||
reltype != RL_TLV);
|
||||
if (!sym)
|
||||
/* internal - GOTPCREL doesn't need to be in global */
|
||||
struct symbol *sym = macho_find_sym(s, offset,
|
||||
false, /* reltype != RL_TLV */
|
||||
true);
|
||||
if (!sym) {
|
||||
nasm_error(ERR_NONFATAL, "Symbol for WRT not found");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
r->snum = sym->initial_snum;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user