summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGuilherme Amadio <amadio@gentoo.org>2023-05-29 19:56:04 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-08-23 15:33:18 -0300
commit9e1f16939b3ea08e6685ecd1f6d9fe5d8c7c7a48 (patch)
treefdccd9f0371bb3fdde97f868e3312fb8102e949b /tools
parent838a8c5f40dd272f0b684cde6bf681c5a4d33c0d (diff)
downloadlinux-stable-9e1f16939b3ea08e6685ecd1f6d9fe5d8c7c7a48.tar.gz
linux-stable-9e1f16939b3ea08e6685ecd1f6d9fe5d8c7c7a48.tar.bz2
linux-stable-9e1f16939b3ea08e6685ecd1f6d9fe5d8c7c7a48.zip
perf build: Allow customization of clang options for BPF target
This also puts an unconditional -Werror under control of WERROR. The clang includes added during the build can lead to a warning that may be turned into an error. In addition, hardened clang produces a warning about lack of support for -fstack-protector* options for the BPF target: clang -g -O2 -target bpf -Wall -Werror -Ilinux/tools/perf/util/bpf_skel/.tmp/.. \ -I -idirafter /usr/lib/llvm/16/bin/../../../../lib/clang/16/include -idirafter /usr/local/include \ -idirafter /usr/include -Ilinux/tools/include/uapi -c util/bpf_skel/bperf_follower.bpf.c \ -o linux/tools/perf/util/bpf_skel/.tmp/bperf_follower.bpf.o && llvm-strip -g linux/tools/perf/util/bpf_skel/.tmp/bperf_follower.bpf.o clang-16: error: /usr/lib/llvm/16/bin/../../../../lib/clang/16/include: 'linker' input unused [-Werror,-Wunused-command-line-argument] clang-16: error: ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored] make[1]: *** [Makefile.perf:1082: linux/tools/perf/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o] Error 1 Signed-off-by: Guilherme Amadio <amadio@gentoo.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/lkml/ZOZQ2LDA+3Wg8x2T@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile.perf7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a5dd1ba0fb5f..37af6df7b978 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1056,10 +1056,15 @@ ifneq ($(CROSS_COMPILE),)
CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
endif
+CLANG_OPTIONS = -Wall
CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES)
TOOLS_UAPI_INCLUDE := -I$(srctree)/tools/include/uapi
+ifneq ($(WERROR),0)
+ CLANG_OPTIONS += -Werror
+endif
+
$(BPFTOOL): | $(SKEL_TMP_OUT)
$(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
@@ -1101,7 +1106,7 @@ else
endif
$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h | $(SKEL_TMP_OUT)
- $(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf -Wall -Werror $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
+ $(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
-c $(filter util/bpf_skel/%.bpf.c,$^) -o $@
$(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)