From 567a78dbd5b352977f0be9fcfa2dcf5d35f64e8f Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 1 Mar 2022 14:47:50 +0900 Subject: [PATCH] [ELF] Do not directly read st_shndx If st_shndx is 0xffff, the actual section index value is in a SHT_SYMTAB_SHNDX section. --- elf/input-files.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elf/input-files.cc b/elf/input-files.cc index de51b02f..ef61a2de 100644 --- a/elf/input-files.cc +++ b/elf/input-files.cc @@ -388,7 +388,7 @@ void ObjectFile::initialize_symbols(Context &ctx) { sym.sym_idx = i; if (!esym.is_abs()) - sym.shndx = esym.is_abs() ? 0 : esym.st_shndx; + sym.shndx = esym.is_abs() ? 0 : get_shndx(esym); } this->symbols.resize(this->elf_syms.size());