Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Simplify special symbol handling in elf_update_symbol()

!sym->sec isn't actually a thing: even STT_UNDEF and other special
symbol types belong to NULL section 0.

Simplify the initialization of 'shndx' accordingly.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+2 -3
+2 -3
tools/objtool/elf.c
··· 637 637 static int elf_update_symbol(struct elf *elf, struct section *symtab, 638 638 struct section *symtab_shndx, struct symbol *sym) 639 639 { 640 - Elf32_Word shndx = sym->sec ? sym->sec->idx : SHN_UNDEF; 640 + Elf32_Word shndx; 641 641 Elf_Data *symtab_data = NULL, *shndx_data = NULL; 642 642 Elf64_Xword entsize = symtab->sh.sh_entsize; 643 643 int max_idx, idx = sym->idx; ··· 645 645 bool is_special_shndx = sym->sym.st_shndx >= SHN_LORESERVE && 646 646 sym->sym.st_shndx != SHN_XINDEX; 647 647 648 - if (is_special_shndx) 649 - shndx = sym->sym.st_shndx; 648 + shndx = is_special_shndx ? sym->sym.st_shndx : sym->sec->idx; 650 649 651 650 s = elf_getscn(elf->elf, symtab->idx); 652 651 if (!s) {