macho/reloc: Simplified relocation for REL/BRANCH

It seems like the relocation for the relative reference
to absolute addresses only cares external reference info.
Instead of exiting, reset the external reference flag.

Based-on-code-from: zenith432 <zenith432@users.sourceforge.net>
Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
This commit is contained in:
Chang S. Bae 2018-10-08 18:49:50 -07:00 committed by Cyrill Gorcunov
parent bffd2b7def
commit 4cbbb3940d

View file

@ -531,22 +531,8 @@ static int64_t add_reloc(struct section *sect, int32_t section,
r->type = fmt.reloc_rel;
r->pcrel = 1;
if (section == NO_SEG) {
/* absolute - seems to produce garbage no matter what */
nasm_error(ERR_NONFATAL, "Mach-O does not support relative "
"references to absolute addresses");
goto bail;
#if 0
/* This "seems" to be how it ought to work... */
struct symbol *sym = macho_find_sym(&absolute_sect, offset,
false, false);
if (!sym)
goto bail;
sect->extreloc = 1;
r->snum = NO_SECT;
adjust = -sect->size;
#endif
/* may optionally be converted below by fmt.forcesym */
r->ext = 0;
} else if (fi == NO_SECT) {
/* external */
sect->extreloc = 1;