Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libbpf-tools: pass -Wall explicitly while compiling the BPF C code #3681

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evverx
Copy link
Contributor

@evverx evverx commented Oct 28, 2021

This partly reverts the part of 531b698 where CFLAGS were passed
to clang to turn on all the warnings to make it possible to build
libbpf and the libbpf tools with ASan/UBsan again. Without this patch
clang complains that -fsanitize isn't supported for target bpf:

clang -fsanitize=address,undefined -g -target bpf -D__TARGET_ARCH_x86	      \
	     -Ix86/ -I.output -I../src/cc/libbpf/include/uapi -c bindsnoop.bpf.c -o .output/bindsnoop.bpf.o &&      \
llvm-strip -g .output/bindsnoop.bpf.o
clang-11: error: unsupported option '-fsanitize=address' for target 'bpf'
make: *** [Makefile:107: .output/bindsnoop.bpf.o] Error 1

Signed-off-by: Evgeny Vereshchagin [email protected]

This partly reverts the part of 531b698 where CFLAGS were passed
to clang to turn on all the warnings to make it possible to build
libbpf and the libbpf tools with ASan/UBsan again. Without this patch
clang complains that `-fsanitize` isn't supported for target `bpf`:

```
clang -fsanitize=address,undefined -g -target bpf -D__TARGET_ARCH_x86	      \
	     -Ix86/ -I.output -I../src/cc/libbpf/include/uapi -c bindsnoop.bpf.c -o .output/bindsnoop.bpf.o &&      \
llvm-strip -g .output/bindsnoop.bpf.o
clang-11: error: unsupported option '-fsanitize=address' for target 'bpf'
make: *** [Makefile:107: .output/bindsnoop.bpf.o] Error 1
```

Signed-off-by: Evgeny Vereshchagin <[email protected]>
@chenhengqi
Copy link
Collaborator

I think it would be better to define a BPF_CFLAGS for BPF programs.

https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/Makefile#L281

@evverx
Copy link
Contributor Author

evverx commented Oct 28, 2021

As far as I can tell, that variable is defined there mostly because it's used in more than one place. I'm not sure it should be introduced here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants