Skip to content

Commit 7fab1c1

Browse files
committed
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: 24ff652 ("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 <[email protected]>
1 parent 291073a commit 7fab1c1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/objtool/special.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ static int get_alt_entry(struct elf *elf, struct special_entry *entry,
110110
return -1;
111111
}
112112
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);
115117
return -1;
116118
}
117119

@@ -132,8 +134,10 @@ static int get_alt_entry(struct elf *elf, struct special_entry *entry,
132134
return 1;
133135

134136
if (!reloc2sec_off(new_reloc, &alt->new_sec, &alt->new_off)) {
135-
WARN_FUNC("don't know how to handle reloc symbol type: %s",
136-
sec, offset + entry->new, new_reloc->sym->name);
137+
WARN_FUNC("don't know how to handle reloc symbol type %d: %s",
138+
sec, offset + entry->new,
139+
new_reloc->sym->type,
140+
new_reloc->sym->name);
137141
return -1;
138142
}
139143

0 commit comments

Comments
 (0)