linux/tools/objtool
Josh Poimboeuf a2e38dffcd objtool: Don't add empty symbols to the rbtree
Building with the Clang assembler shows the following warning:

  arch/x86/kernel/ftrace_64.o: warning: objtool: missing symbol for insn at offset 0x16

The Clang assembler strips section symbols.  That ends up giving
objtool's find_func_containing() much more test coverage than normal.
Turns out, find_func_containing() doesn't work so well for overlapping
symbols:

     2: 000000000000000e     0 NOTYPE  LOCAL  DEFAULT    2 fgraph_trace
     3: 000000000000000f     0 NOTYPE  LOCAL  DEFAULT    2 trace
     4: 0000000000000000   165 FUNC    GLOBAL DEFAULT    2 __fentry__
     5: 000000000000000e     0 NOTYPE  GLOBAL DEFAULT    2 ftrace_stub

The zero-length NOTYPE symbols are inside __fentry__(), confusing the
rbtree search for any __fentry__() offset coming after a NOTYPE.

Try to avoid this problem by not adding zero-length symbols to the
rbtree.  They're rare and aren't needed in the rbtree anyway.

One caveat, this actually might not end up being the right fix.
Non-empty overlapping symbols, if they exist, could have the same
problem.  But that would need bigger changes, let's see if we can get
away with the easy fix for now.

Reported-by: Arnd Bergmann <arnd@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2021-01-13 16:56:37 -06:00
..
arch/x86 objtool: Decode unwind hint register depending on architecture 2020-09-10 10:43:13 -05:00
Documentation objtool: Add support for intra-function calls 2020-04-30 20:14:33 +02:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
arch.h objtool: Decode unwind hint register depending on architecture 2020-09-10 10:43:13 -05:00
Build objtool: Enable compilation of objtool for all architectures 2020-05-20 09:17:28 -05:00
builtin-check.c objtool: Move ORC logic out of check() 2020-09-01 17:19:11 -05:00
builtin-orc.c objtool: Move ORC logic out of check() 2020-09-01 17:19:11 -05:00
builtin.h objtool: Implement noinstr validation 2020-04-22 10:53:50 +02:00
cfi.h objtool: Fix !CFI insn_state propagation 2020-04-22 10:53:50 +02:00
check.c objtool: Fix seg fault with Clang non-section symbols 2020-12-16 14:35:46 +01:00
check.h objtool: Refactor jump table code to support other architectures 2020-09-10 10:43:13 -05:00
elf.c objtool: Don't add empty symbols to the rbtree 2021-01-13 16:56:37 -06:00
elf.h objtool: Fix seg fault with Clang non-section symbols 2020-12-16 14:35:46 +01:00
Makefile tools: Factor HOSTCC, HOSTLD, HOSTAR definitions 2020-11-11 12:18:22 -08:00
objtool.c objtool: Move object file loading out of check() 2020-09-01 17:19:07 -05:00
objtool.h objtool: Abstract alternative special case handling 2020-09-10 10:43:13 -05:00
orc_dump.c objtool: Make unwind hint definitions available to other architectures 2020-09-10 10:43:13 -05:00
orc_gen.c objtool: Fix seg fault with Clang non-section symbols 2020-12-16 14:35:46 +01:00
special.c objtool: Abstract alternative special case handling 2020-09-10 10:43:13 -05:00
special.h objtool: Refactor jump table code to support other architectures 2020-09-10 10:43:13 -05:00
sync-check.sh objtool: Make unwind hint definitions available to other architectures 2020-09-10 10:43:13 -05:00
warn.h objtool: Rename find_containing_func() 2020-03-25 18:28:29 +01:00
weak.c objtool: Abstract alternative special case handling 2020-09-10 10:43:13 -05:00