macho: Fix relocation type for relative direct branch

Previously, X86_64_RELOC_BRANCH is only set for external
relocations. Internal relocation also needs this type to be
set, instead of the default (X86_64_RELOC_SIGNED) or
anything.

Reported-by: <zenith432@users.sourceforge.net>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
This commit is contained in:
Chang S. Bae 2018-08-23 14:13:45 -07:00 committed by Cyrill Gorcunov
parent 1fd4c45c96
commit b10435f06e

View File

@ -559,6 +559,8 @@ static int64_t add_reloc(struct section *sect, int32_t section,
/* local */
r->ext = 0;
r->snum = fi;
if (reltype == RL_BRANCH)
r->type = X86_64_RELOC_BRANCH;
adjust = -sect->size;
}
break;