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: kernel test robot <lkp@intel.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/bpf/20200714102534.299280-2-jolsa@kernel.org
91 lines
2.1 KiB
Makefile
91 lines
2.1 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0-only
|
|
include ../../scripts/Makefile.include
|
|
|
|
ifeq ($(srctree),)
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
endif
|
|
|
|
ifeq ($(V),1)
|
|
Q =
|
|
msg =
|
|
else
|
|
Q = @
|
|
msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
|
|
MAKEFLAGS=--no-print-directory
|
|
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/
|
|
|
|
LIBBPF_SRC := $(srctree)/tools/lib/bpf/
|
|
SUBCMD_SRC := $(srctree)/tools/lib/subcmd/
|
|
|
|
BPFOBJ := $(OUTPUT)/libbpf.a
|
|
SUBCMDOBJ := $(OUTPUT)/libsubcmd.a
|
|
|
|
BINARY := $(OUTPUT)/resolve_btfids
|
|
BINARY_IN := $(BINARY)-in.o
|
|
|
|
all: $(BINARY)
|
|
|
|
$(OUTPUT):
|
|
$(call msg,MKDIR,,$@)
|
|
$(Q)mkdir -p $(OUTPUT)
|
|
|
|
$(SUBCMDOBJ): fixdep FORCE
|
|
$(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT)
|
|
|
|
$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)
|
|
$(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
|
|
|
|
CFLAGS := -g \
|
|
-I$(srctree)/tools/include \
|
|
-I$(srctree)/tools/include/uapi \
|
|
-I$(LIBBPF_SRC) \
|
|
-I$(SUBCMD_SRC)
|
|
|
|
LIBS = -lelf -lz
|
|
|
|
export srctree OUTPUT CFLAGS Q
|
|
include $(srctree)/tools/build/Makefile.include
|
|
|
|
$(BINARY_IN): fixdep FORCE
|
|
$(Q)$(MAKE) $(build)=resolve_btfids
|
|
|
|
$(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
|
|
$(call msg,LINK,$@)
|
|
$(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS)
|
|
|
|
libsubcmd-clean:
|
|
$(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) clean
|
|
|
|
libbpf-clean:
|
|
$(Q)$(MAKE) -C $(LIBBPF_SRC) OUTPUT=$(OUTPUT) clean
|
|
|
|
clean: libsubcmd-clean libbpf-clean fixdep-clean
|
|
$(call msg,CLEAN,$(BINARY))
|
|
$(Q)$(RM) -f $(BINARY); \
|
|
find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
|
|
|
|
tags:
|
|
$(call msg,GEN,,tags)
|
|
$(Q)ctags -R . $(LIBBPF_SRC) $(SUBCMD_SRC)
|
|
|
|
FORCE:
|
|
|
|
.PHONY: all FORCE clean tags
|