From b10435f06e65df9e8fd2e1d8e8e62524e79ebec2 Mon Sep 17 00:00:00 2001 From: "Chang S. Bae" Date: Thu, 23 Aug 2018 14:13:45 -0700 Subject: [PATCH] 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: Signed-off-by: Chang S. Bae --- output/outmacho.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/output/outmacho.c b/output/outmacho.c index d092cf23..cb566f0d 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -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; -- 2.11.4.GIT