From bffd2b7deffd9060159cd816db561ed2f89baf06 Mon Sep 17 00:00:00 2001 From: "Chang S. Bae" Date: Mon, 8 Oct 2018 18:49:49 -0700 Subject: [PATCH] macho/sym: Record initial symbol number always The special segment may need this information for future fix-ups. Based-on-code-from: zenith432 Signed-off-by: Chang S. Bae --- output/outmacho.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index cb566f0d..9fa12988 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1123,6 +1123,9 @@ static void macho_symdef(char *name, int32_t section, int64_t offset, special_used = true; } + /* track the initially allocated symbol number for use in future fix-ups */ + sym->initial_snum = nsyms; + if (section == NO_SEG) { /* symbols in no section get absolute */ sym->type |= N_ABS; @@ -1137,9 +1140,6 @@ static void macho_symdef(char *name, int32_t section, int64_t offset, /* get the in-file index of the section the symbol was defined in */ sym->sect = s ? s->fileindex : NO_SECT; - /* track the initially allocated symbol number for use in future fix-ups */ - sym->initial_snum = nsyms; - if (!s) { /* remember symbol number of references to external ** symbols, this works because every external symbol gets