linux-stable/tools
Josh Poimboeuf 37ffdca816 objtool: Support Clang non-section symbols in ORC generation
commit e81e072443 upstream.

When compiling the kernel with AS=clang, objtool produces a lot of
warnings:

  warning: objtool: missing symbol for section .text
  warning: objtool: missing symbol for section .init.text
  warning: objtool: missing symbol for section .ref.text

It then fails to generate the ORC table.

The problem is that objtool assumes text section symbols always exist.
But the Clang assembler is aggressive about removing them.

When generating relocations for the ORC table, objtool always tries to
reference instructions by their section symbol offset.  If the section
symbol doesn't exist, it bails.

Do a fallback: when a section symbol isn't available, reference a
function symbol instead.

Reported-by: Dmitry Golovin <dima@golovin.in>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://github.com/ClangBuiltLinux/linux/issues/669
Link: https://lkml.kernel.org/r/9a9cae7fcf628843aabe5a086b1a3c5bf50f42e8.1585761021.git.jpoimboe@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-10 09:12:08 +01:00
..
accounting tools/accounting/getdelays.c: fix netlink attribute length 2020-04-13 10:34:33 +02:00
arch tools headers: Synchronise x86 cpufeatures.h for L1TF additions 2018-08-15 18:13:01 +02:00
build tools build feature: Quote CC and CXX for their arguments 2020-08-21 09:48:23 +02:00
cgroup tools: fix cross-compile var clobbering 2019-01-13 10:01:02 +01:00
firewire License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gpio tools: gpio-hammer: Avoid potential overflow in main 2020-10-01 13:12:39 +02:00
hv Tools: hv: kvp: eliminate 'may be used uninitialized' warning 2019-09-10 10:32:17 +01:00
iio iio: iio-utils: Fix possible incorrect mask calculation 2019-07-31 07:28:53 +02:00
include perf tools: Correct SNOOPX field offset 2020-09-09 19:03:09 +02:00
kvm/kvm_stat tools/kvm_stat: Fix kvm_exit filter name 2020-02-14 16:32:15 -05:00
laptop tools: fix cross-compile var clobbering 2019-01-13 10:01:02 +01:00
leds tools: fix cross-compile var clobbering 2019-01-13 10:01:02 +01:00
lib tools lib traceevent: Fix memory leak in process_dynamic_array_len 2020-08-21 09:48:00 +02:00
net bpf: fix uninitialized variable in bpf tools 2018-06-21 04:02:49 +09:00
nfsd License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
objtool objtool: Support Clang non-section symbols in ORC generation 2021-02-10 09:12:08 +01:00
pci tools: PCI: Fix broken pcitest compilation 2019-11-24 08:23:34 +01:00
pcmcia License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf perf record: Fix memory leak when using '--user-regs=?' to list registers 2020-12-29 13:47:03 +01:00
power tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility 2020-10-01 13:12:32 +02:00
scripts tools: Let O= makes handle a relative path with -C option 2020-04-02 16:34:30 +02:00
spi tools: fix cross-compile var clobbering 2019-01-13 10:01:02 +01:00
testing x86/entry/64/compat: Preserve r8-r11 in int $0x80 2021-02-03 23:22:22 +01:00
thermal/tmon tools/thermal: tmon: fix for segfault 2018-05-30 07:52:28 +02:00
time
usb usbip: Fix unsafe unaligned pointer usage 2020-02-28 16:36:02 +01:00
virtio virtio: fix test build after uio.h change 2019-01-13 10:01:01 +01:00
vm tools/vm: fix cross-compile build 2020-05-02 17:24:22 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00