Skip to content

Commit f9b2c87

Browse files
author
Daniel Bristot de Oliveira
committed
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: 4bc4b13 ("rv: Add rv tool") Suggested-by: Donald Zickus <dzickus@redhat.com> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
1 parent 084ce16 commit f9b2c87

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tools/verification/rv/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
2828
-fasynchronous-unwind-tables -fstack-clash-protection
2929
WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
3030

31+
ifeq ($(CC),clang)
32+
FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS))
33+
WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS))
34+
endif
35+
3136
TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs)
3237

3338
CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) -I include
34-
LDFLAGS := -ggdb $(EXTRA_LDFLAGS)
39+
LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS)
3540
LIBS := $$($(PKG_CONFIG) --libs libtracefs)
3641

3742
SRC := $(wildcard src/*.c)

0 commit comments

Comments
 (0)