Commit 11bb2f7a authored by Jiri Olsa's avatar Jiri Olsa Committed by Alexei Starovoitov

bpf: Fix cross build for CONFIG_DEBUG_INFO_BTF option

Stephen and 0-DAY CI Kernel Test Service reported broken cross build
for arm (arm-linux-gnueabi-gcc (GCC) 9.3.0), with following output:

   /tmp/ccMS5uth.s: Assembler messages:
   /tmp/ccMS5uth.s:69: Error: unrecognized symbol type ""
   /tmp/ccMS5uth.s:82: Error: unrecognized symbol type ""

Having '@object' for .type  diretive is  wrong because '@' is comment
character for some architectures. Using STT_OBJECT instead that should
work everywhere.

Also using HOST* variables to build resolve_btfids so it's properly
build in crossbuilds (stolen from objtool's Makefile).
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/bpf/20200714102534.299280-2-jolsa@kernel.org
parent 079ef536
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
asm( \ asm( \
".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \
".local " #symbol " ; \n" \ ".local " #symbol " ; \n" \
".type " #symbol ", @object; \n" \ ".type " #symbol ", STT_OBJECT; \n" \
".size " #symbol ", 4; \n" \ ".size " #symbol ", 4; \n" \
#symbol ": \n" \ #symbol ": \n" \
".zero 4 \n" \ ".zero 4 \n" \
......
...@@ -16,6 +16,20 @@ else ...@@ -16,6 +16,20 @@ else
MAKEFLAGS=--no-print-directory MAKEFLAGS=--no-print-directory
endif endif
# always use the host compiler
ifneq ($(LLVM),)
HOSTAR ?= llvm-ar
HOSTCC ?= clang
HOSTLD ?= ld.lld
else
HOSTAR ?= ar
HOSTCC ?= gcc
HOSTLD ?= ld
endif
AR = $(HOSTAR)
CC = $(HOSTCC)
LD = $(HOSTLD)
OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
LIBBPF_SRC := $(srctree)/tools/lib/bpf/ LIBBPF_SRC := $(srctree)/tools/lib/bpf/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment