1
linux/tools/verification/rv/Makefile

88 lines
1.9 KiB
Makefile
Raw Permalink Normal View History

# SPDX-License-Identifier: GPL-2.0-only
ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
tools/rv: Fix Makefile compiler options for clang The following errors are showing up when compiling rv with clang: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc1\" -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized $(pkg-config --cflags libtracefs) -I include -c -o src/utils.o src/utils.c clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument] warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option] 1 warning generated. clang -o rv -ggdb src/in_kernel.o src/rv.o src/trace.o src/utils.o $(pkg-config --libs libtracefs) src/in_kernel.o: file not recognized: file format not recognized clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:110: rv] Error 1 Solve these issues by: - removing -ffat-lto-objects and -Wno-maybe-uninitialized if using clang - informing the linker about -flto=auto Link: https://lkml.kernel.org/r/ed94a8ddc2ca8c8ef663cfb7ae9dd196c4a66b33.1707217097.git.bristot@kernel.org Cc: stable@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Bill Wendling <morbo@google.com> Cc: Justin Stitt <justinstitt@google.com> Fixes: 4bc4b131d44c ("rv: Add rv tool") Suggested-by: Donald Zickus <dzickus@redhat.com> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
2024-02-06 04:05:33 -07:00
endif
include $(srctree)/tools/scripts/Makefile.include
# O is an alias for OUTPUT
OUTPUT := $(O)
ifeq ($(OUTPUT),)
OUTPUT := $(CURDIR)/
else
# subdir is used by the ../Makefile in $(call descend,)
ifneq ($(subdir),)
OUTPUT := $(OUTPUT)/$(subdir)
endif
endif
ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),)
OUTPUT := $(OUTPUT)/
endif
RV := $(OUTPUT)rv
RV_IN := $(RV)-in.o
VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make")
DOCSRC := ../../../Documentation/tools/rv/
FEATURE_TESTS := libtraceevent
FEATURE_TESTS += libtracefs
FEATURE_DISPLAY := libtraceevent
FEATURE_DISPLAY += libtracefs
ifeq ($(V),1)
Q =
else
Q = @
endif
all: $(RV)
include $(srctree)/tools/build/Makefile.include
include Makefile.rv
# check for dependencies only on required targets
NON_CONFIG_TARGETS := clean install doc doc_clean doc_install
config := 1
ifdef MAKECMDGOALS
ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
config := 0
endif
endif
ifeq ($(config),1)
include $(srctree)/tools/build/Makefile.feature
include Makefile.config
endif
CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
export CFLAGS OUTPUT srctree
$(RV): $(RV_IN)
$(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV) $(RV_IN) $(EXTLIBS)
static: $(RV_IN)
$(eval LDFLAGS += -static)
$(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV)-static $(RV_IN) $(EXTLIBS)
rv.%: fixdep FORCE
make -f $(srctree)/tools/build/Makefile.build dir=. $@
$(RV_IN): fixdep FORCE
make $(build)=rv
clean: doc_clean fixdep-clean
$(call QUIET_CLEAN, rv)
$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
$(Q)rm -f rv rv-static fixdep FEATURE-DUMP rv-*
$(Q)rm -rf feature
.PHONY: FORCE clean