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: print out the symbol type when complaining about it

The objtool warning that the kvm instruction emulation code triggered
wasn't very useful:

arch/x86/kvm/emulate.o: warning: objtool: __ex_table+0x4: don't know how to handle reloc symbol type: kvm_fastop_exception

in that it helpfully tells you which symbol name it had trouble figuring
out the relocation for, but it doesn't actually say what the unknown
symbol type was that triggered it all.

In this case it was because of missing type information (type 0, aka
STT_NOTYPE), but on the whole it really should just have printed that
out as part of the message.

Because if this warning triggers, that's very much the first thing you
want to know - why did reloc2sec_off() return failure for that symbol?

So rather than just saying you can't handle some type of symbol without
saying what the type _was_, just print out the type number too.

Fixes: 24ff65257375 ("objtool: Teach get_alt_entry() about more relocation types")
Link: https://lore.kernel.org/lkml/CAHk-=wiZwq-0LknKhXN4M+T8jbxn_2i9mcKpO+OaBSSq_Eh7tg@mail.gmail.com/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+8 -4
+8 -4
tools/objtool/special.c
··· 110 110 return -1; 111 111 } 112 112 if (!reloc2sec_off(orig_reloc, &alt->orig_sec, &alt->orig_off)) { 113 - WARN_FUNC("don't know how to handle reloc symbol type: %s", 114 - sec, offset + entry->orig, orig_reloc->sym->name); 113 + WARN_FUNC("don't know how to handle reloc symbol type %d: %s", 114 + sec, offset + entry->orig, 115 + orig_reloc->sym->type, 116 + orig_reloc->sym->name); 115 117 return -1; 116 118 } 117 119 ··· 134 132 return 1; 135 133 136 134 if (!reloc2sec_off(new_reloc, &alt->new_sec, &alt->new_off)) { 137 - WARN_FUNC("don't know how to handle reloc symbol type: %s", 138 - sec, offset + entry->new, new_reloc->sym->name); 135 + WARN_FUNC("don't know how to handle reloc symbol type %d: %s", 136 + sec, offset + entry->new, 137 + new_reloc->sym->type, 138 + new_reloc->sym->name); 139 139 return -1; 140 140 } 141 141