summaryrefslogtreecommitdiff
path: root/tools/objtool/elf.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2025-03-24 14:55:51 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:44:35 +0200
commit88e923d140fa77cad6d5d6ea44d6fa6b55c59d7b (patch)
tree4d8c38fdd78e668cf80ccce147b5862bcc3675e9 /tools/objtool/elf.c
parenta7a8e0ccaf730b25b36d63bd4260307e99c5cda8 (diff)
downloadlinux-88e923d140fa77cad6d5d6ea44d6fa6b55c59d7b.tar.gz
linux-88e923d140fa77cad6d5d6ea44d6fa6b55c59d7b.tar.bz2
linux-88e923d140fa77cad6d5d6ea44d6fa6b55c59d7b.zip
objtool: Fix detection of consecutive jump tables on Clang 20
[ Upstream commit ef753d66051ca03bee1982ce047f9eaf90f81ab4 ] The jump table detection code assumes jump tables are in the same order as their corresponding indirect branches. That's apparently not always true with Clang 20. Fix that by changing how multiple jump tables are detected. In the first detection pass, mark the beginning of each jump table so the second pass can tell where one ends and the next one begins. Fixes the following warnings: vmlinux.o: warning: objtool: SiS_GetCRT2Ptr+0x1ad: stack state mismatch: cfa1=4+8 cfa2=5+16 sound/core/seq/snd-seq.o: warning: objtool: cc_ev_to_ump_midi2+0x589: return with modified stack frame Fixes: be2f0b1e1264 ("objtool: Get rid of reloc->jump_table_start") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/141752fff614eab962dba6bdfaa54aa67ff03bba.1742852846.git.jpoimboe@kernel.org Closes: https://lore.kernel.org/oe-kbuild-all/202503171547.LlCTJLQL-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202503200535.J3hAvcjw-lkp@intel.com/ Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/objtool/elf.c')
-rw-r--r--tools/objtool/elf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 6f64d611faea..934855be631c 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -583,7 +583,7 @@ static int elf_update_sym_relocs(struct elf *elf, struct symbol *sym)
{
struct reloc *reloc;
- for (reloc = sym->relocs; reloc; reloc = reloc->sym_next_reloc)
+ for (reloc = sym->relocs; reloc; reloc = sym_next_reloc(reloc))
set_reloc_sym(elf, reloc, reloc->sym->idx);
return 0;
@@ -880,7 +880,7 @@ static struct reloc *elf_init_reloc(struct elf *elf, struct section *rsec,
set_reloc_addend(elf, reloc, addend);
elf_hash_add(reloc, &reloc->hash, reloc_hash(reloc));
- reloc->sym_next_reloc = sym->relocs;
+ set_sym_next_reloc(reloc, sym->relocs);
sym->relocs = reloc;
return reloc;
@@ -979,7 +979,7 @@ static int read_relocs(struct elf *elf)
}
elf_hash_add(reloc, &reloc->hash, reloc_hash(reloc));
- reloc->sym_next_reloc = sym->relocs;
+ set_sym_next_reloc(reloc, sym->relocs);
sym->relocs = reloc;
nr_reloc++;