diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/objtool/elf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 5aa3b4e76479..a2ea3931e01d 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -578,6 +578,11 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, Elf64_Xword entsize = symtab->sh.sh_entsize; int max_idx, idx = sym->idx; Elf_Scn *s, *t = NULL; + bool is_special_shndx = sym->sym.st_shndx >= SHN_LORESERVE && + sym->sym.st_shndx != SHN_XINDEX; + + if (is_special_shndx) + shndx = sym->sym.st_shndx; s = elf_getscn(elf->elf, symtab->idx); if (!s) { @@ -663,7 +668,7 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, } /* setup extended section index magic and write the symbol */ - if (shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) { + if ((shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) || is_special_shndx) { sym->sym.st_shndx = shndx; if (!shndx_data) shndx = 0; |