bpftool, selftests/hid/bpf: fix 29 clang warnings
PATCH 1/1 bpftool, selftests/hid/bpf: fix 29 clang warnings
When building either tools/bpf/bpftool, or tools/testing/selftests/hid, (the same Makefile is used for these), clang generates many instances of a warning that is useless here:
"clang: warning: -lLLVM-17: 'linker' input unused"
Silence this in both locations, by disabling that warning when building with clang.
--- tools/bpf/bpftool/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
tools/bpf/bpftool/Makefile +4 -0
@@ -133,6 +133,10 @@ CFLAGS += -DUSE_LIBCAP LIBS += -lcap endif +ifneq ($(LLVM),) + CFLAGS += -Wno-unused-command-line-argument +endif + include $(wildcard $(OUTPUT)*.d) all: $(OUTPUT)bpftool
base-commit: f462ae0edd3703edd6f22fe41d336369c38b884b
prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
Signature · 1 line
2.45.0
Quentin Monnet
maintainerQuoted 19 lines · John Hubbard
When building either
tools/bpf/bpftool, ortools/testing/selftests/hid, (the sameMakefileis used for these), clang generates many instances of a warning that is useless here:"clang: warning: -lLLVM-17: 'linker' input unused"
Silence this in both locations, by disabling that warning when building with clang.
Signed-off-by John Hubbard <[email protected]>--- tools/bpf/bpftool/Makefile | 4 ++++ 1 file changed, 4 insertions(+)tools/bpf/bpftool/Makefile +0
-0
tools/bpf/bpftool/Makefile CFLAGS += -DUSE_LIBCAP · line 138
Quoted 6 lines
tools/bpf/bpftool/Makefile +3
-0@@ -133,6 +133,10 @@ CFLAGS += -DUSE_LIBCAP LIBS += -lcap endif +ifneq ($(LLVM),) + CFLAGS += -Wno-unused-command-line-argument +endif
Thanks! If possible, I'd rather keep the warning enabled, and fix the command line instead. Looking at the error and the Makefile, we may not need the -lLLVM<version> in the CFLAGS at all, but only in $(LIBS). On my setup, I can build successfully, without the warnings, with the following patch:
------
tools/bpf/bpftool/Makefile +1 -1
@@ -147,7 +147,7 @@ ifeq ($(feature-llvm),1) # If LLVM is available, use it for JIT disassembly CFLAGS += -DHAVE_LLVM_SUPPORT LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets - CFLAGS += $(shell $(LLVM_CONFIG) --cflags --libs $(LLVM_CONFIG_LIB_COMPONENTS)) + CFLAGS += $(shell $(LLVM_CONFIG) --cflags) LIBS += $(shell $(LLVM_CONFIG) --libs $(LLVM_CONFIG_LIB_COMPONENTS)) ifeq ($(shell $(LLVM_CONFIG) --shared-mode),static) LIBS += $(shell $(LLVM_CONFIG) --system-libs $(LLVM_CONFIG_LIB_COMPONENTS))
------
Could you please check whether that works on your side, too?
Quentin
Quoted 1 line · Quentin Monnet
On 05/05/2024 22:56, John Hubbard wrote:
...
Quoted 22 lines
Thanks! If possible, I'd rather keep the warning enabled, and fix the command line instead. Looking at the error and the
Makefile, we may not need the -lLLVM<version> in the CFLAGS at all, but only in $(LIBS). On my setup, I can build successfully, without the warnings, with the following patch:------
tools/bpf/bpftool/Makefile +1
-2@@ -147,7 +147,7 @@ ifeq ($(feature-llvm),1) # If LLVM is available, use it for JIT disassembly CFLAGS += -DHAVE_LLVM_SUPPORT LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets - CFLAGS += $(shell $(LLVM_CONFIG) --cflags --libs $(LLVM_CONFIG_LIB_COMPONENTS)) + CFLAGS += $(shell $(LLVM_CONFIG) --cflags) LIBS += $(shell $(LLVM_CONFIG) --libs $(LLVM_CONFIG_LIB_COMPONENTS)) ifeq ($(shell $(LLVM_CONFIG) --shared-mode),static) LIBS += $(shell $(LLVM_CONFIG) --system-libs $(LLVM_CONFIG_LIB_COMPONENTS)) ------
Quoted 2 lines
Could you please check whether that works on your side, too?
Yes, that works, and of course that's much better. Please let me know if you prefer me to post a v2 with that, or if you plan on sending it yourself?
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Quentin Monnet
maintainerQuoted 28 lines · John Hubbard
Quoted 1 line · Quentin Monnet
On 05/05/2024 22:56, John Hubbard wrote:
...
Quoted 25 lines
Thanks! If possible, I'd rather keep the warning enabled, and fix the command line instead. Looking at the error and the
Makefile, we may not need the -lLLVM<version> in the CFLAGS at all, but only in $(LIBS). On my setup, I can build successfully, without the warnings, with the following patch:------
tools/bpf/bpftool/Makefile +0
-0@@ -147,7 +147,7 @@ ifeq ($(feature-llvm),1) # If LLVM is available, use it for JIT disassemblyCFLAGS += -DHAVE_LLVM_SUPPORT
LLVM_CONFIG_LIB_COMPONENTS:= mcdisassembler all-targets - CFLAGS += $(shell $(LLVM_CONFIG) --cflags --libs $(LLVM_CONFIG_LIB_COMPONENTS))
+ CFLAGS += $(shell $(LLVM_CONFIG) --cflags) LIBS += $(shell $(LLVM_CONFIG) --libs $(LLVM_CONFIG_LIB_COMPONENTS))
ifeq ($(shell $(LLVM_CONFIG) --shared-mode),static) LIBS += $(shell $(LLVM_CONFIG) --system-libs $(LLVM_CONFIG_LIB_COMPONENTS))
------
Quoted 6 lines
Quoted 2 lines
Could you please check whether that works on your side, too?
Yes, that works, and of course that's much better. Please let me know if you prefer me to post a v2 with that, or if you plan on sending it yourself?
Please go ahead!
Quentin