Message ID | 20210410164946.770575-1-yhs@fb.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | support build selftests/bpf with clang | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 11 maintainers not CCed: linux-kselftest@vger.kernel.org netdev@vger.kernel.org kpsingh@kernel.org daniel@iogearbox.net kafai@fb.com clang-built-linux@googlegroups.com ast@kernel.org nathan@kernel.org john.fastabend@gmail.com songliubraving@fb.com shuah@kernel.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Sat, Apr 10, 2021 at 6:49 PM Yonghong Song <yhs@fb.com> wrote: > > With clang compiler: > make -j60 LLVM=1 LLVM_IAS=1 <=== compile kernel > make -j60 -C tools/testing/selftests/bpf LLVM=1 LLVM_IAS=1 > Some linker flags are not used/effective for some binaries and > we have warnings like: > warning: -lelf: 'linker' input unused [-Wunused-command-line-argument] > > We also have warnings like: > .../selftests/bpf/prog_tests/ns_current_pid_tgid.c:74:57: note: treat the string as an argument to avoid this > if (CHECK(waitpid(cpid, &wstatus, 0) == -1, "waitpid", strerror(errno))) > ^ > "%s", > .../selftests/bpf/test_progs.h:129:35: note: expanded from macro 'CHECK' > _CHECK(condition, tag, duration, format) > ^ > .../selftests/bpf/test_progs.h:108:21: note: expanded from macro '_CHECK' > fprintf(stdout, ##format); \ > ^ > Let us add proper compilation flags to silence the above two kinds of warnings. > > Signed-off-by: Yonghong Song <yhs@fb.com> > --- > tools/testing/selftests/bpf/Makefile | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index bbd61cc3889b..a9c0a64a4c49 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -24,6 +24,8 @@ SAN_CFLAGS ?= > CFLAGS += -g -Og -rdynamic -Wall $(GENFLAGS) $(SAN_CFLAGS) \ > -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ > -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) \ > + -Wno-unused-command-line-argument \ > + -Wno-format-security \ Are both compliler flags available for GCC (I simply don't know or have checked)? - Sedat - > -Dbpf_prog_load=bpf_prog_test_load \ > -Dbpf_load_program=bpf_test_load_program > LDLIBS += -lcap -lelf -lz -lrt -lpthread > -- > 2.30.2 >
On 4/11/21 4:12 AM, Sedat Dilek wrote: > On Sat, Apr 10, 2021 at 6:49 PM Yonghong Song <yhs@fb.com> wrote: >> >> With clang compiler: >> make -j60 LLVM=1 LLVM_IAS=1 <=== compile kernel >> make -j60 -C tools/testing/selftests/bpf LLVM=1 LLVM_IAS=1 >> Some linker flags are not used/effective for some binaries and >> we have warnings like: >> warning: -lelf: 'linker' input unused [-Wunused-command-line-argument] >> >> We also have warnings like: >> .../selftests/bpf/prog_tests/ns_current_pid_tgid.c:74:57: note: treat the string as an argument to avoid this >> if (CHECK(waitpid(cpid, &wstatus, 0) == -1, "waitpid", strerror(errno))) >> ^ >> "%s", >> .../selftests/bpf/test_progs.h:129:35: note: expanded from macro 'CHECK' >> _CHECK(condition, tag, duration, format) >> ^ >> .../selftests/bpf/test_progs.h:108:21: note: expanded from macro '_CHECK' >> fprintf(stdout, ##format); \ >> ^ >> Let us add proper compilation flags to silence the above two kinds of warnings. >> >> Signed-off-by: Yonghong Song <yhs@fb.com> >> --- >> tools/testing/selftests/bpf/Makefile | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile >> index bbd61cc3889b..a9c0a64a4c49 100644 >> --- a/tools/testing/selftests/bpf/Makefile >> +++ b/tools/testing/selftests/bpf/Makefile >> @@ -24,6 +24,8 @@ SAN_CFLAGS ?= >> CFLAGS += -g -Og -rdynamic -Wall $(GENFLAGS) $(SAN_CFLAGS) \ >> -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ >> -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) \ >> + -Wno-unused-command-line-argument \ >> + -Wno-format-security \ > > Are both compliler flags available for GCC (I simply don't know or > have checked)? Good question. gcc/g++ (8.4.1) does not complain these two flags and I assume they are okay as well. But further digging shows gcc only support -W[no-]format-security https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html and does not support -Wno-unused-command-line-argument. gcc/g++ simply just ignored it. I will make -Wno-unused-command-line-argument for clang only in v2. Thanks for catching this. > > - Sedat - > >> -Dbpf_prog_load=bpf_prog_test_load \ >> -Dbpf_load_program=bpf_test_load_program >> LDLIBS += -lcap -lelf -lz -lrt -lpthread >> -- >> 2.30.2 >>
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index bbd61cc3889b..a9c0a64a4c49 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -24,6 +24,8 @@ SAN_CFLAGS ?= CFLAGS += -g -Og -rdynamic -Wall $(GENFLAGS) $(SAN_CFLAGS) \ -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) \ + -Wno-unused-command-line-argument \ + -Wno-format-security \ -Dbpf_prog_load=bpf_prog_test_load \ -Dbpf_load_program=bpf_test_load_program LDLIBS += -lcap -lelf -lz -lrt -lpthread
With clang compiler: make -j60 LLVM=1 LLVM_IAS=1 <=== compile kernel make -j60 -C tools/testing/selftests/bpf LLVM=1 LLVM_IAS=1 Some linker flags are not used/effective for some binaries and we have warnings like: warning: -lelf: 'linker' input unused [-Wunused-command-line-argument] We also have warnings like: .../selftests/bpf/prog_tests/ns_current_pid_tgid.c:74:57: note: treat the string as an argument to avoid this if (CHECK(waitpid(cpid, &wstatus, 0) == -1, "waitpid", strerror(errno))) ^ "%s", .../selftests/bpf/test_progs.h:129:35: note: expanded from macro 'CHECK' _CHECK(condition, tag, duration, format) ^ .../selftests/bpf/test_progs.h:108:21: note: expanded from macro '_CHECK' fprintf(stdout, ##format); \ ^ Let us add proper compilation flags to silence the above two kinds of warnings. Signed-off-by: Yonghong Song <yhs@fb.com> --- tools/testing/selftests/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+)