-
Notifications
You must be signed in to change notification settings - Fork 6
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
samples/bpf: remove unnecessary -I flags from libbpf EXTRA_CFLAGS #4730
Conversation
Upstream branch: 537a252 |
f8fc3a6
to
a55dd53
Compare
Upstream branch: 537a252 |
2231d31
to
0e07c1a
Compare
a55dd53
to
d6e0f06
Compare
Upstream branch: d4c4435 |
0e07c1a
to
a8ced2e
Compare
d6e0f06
to
9c9d649
Compare
Upstream branch: bd74e23 |
a8ced2e
to
12367a4
Compare
9c9d649
to
de5336c
Compare
Upstream branch: bd74e23 |
12367a4
to
4a95982
Compare
Upstream branch: bd74e23 |
4a95982
to
8fa4fe4
Compare
Commit [0] breaks samples/bpf build: $ make M=samples/bpf ... make -C /path/to/kernel/samples/bpf/../../tools/lib/bpf \ ... EXTRA_CFLAGS=" \ ... -fsanitize=bounds \ -I/path/to/kernel/usr/include \ ... /path/to/kernel/samples/bpf/libbpf/libbpf.a install_headers CC /path/to/kernel/samples/bpf/libbpf/staticobjs/libbpf.o In file included from libbpf.c:29: /path/to/kernel/tools/include/linux/err.h:35:8: error: 'inline' can only appear on functions 35 | static inline void * __must_check ERR_PTR(long error_) | ^ The error is caused by `objtree` variable changing definition from `.` (dot) to an absolute path: - The variable TPROGS_CFLAGS is constructed as follows: ... TPROGS_CFLAGS += -I$(objtree)/usr/include - It is passed as EXTRA_CFLAGS for libbpf compilation: $(LIBBPF): ... ... $(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" - Before commit [0], the line passed to libbpf makefile was '-I./usr/include', where '.' referred to LIBBPF_SRC due to -C flag. The directory $(LIBBPF_SRC)/usr/include does not exist and thus was never resolved by C compiler. - After commit [0], the line passed to libbpf makefile became: '<output-dir>/usr/include', this directory exists and is resolved by C compiler. - Both 'tools/include' and 'usr/include' define files err.h and types.h. - libbpf expects headers like 'linux/err.h' and 'linux/types.h' defined in 'tools/include', not 'usr/include', hence the compilation error. This commit removes unnecessary -I flags from libbpf compilation. (libbpf sets up the necessary includes at lib/bpf/Makefile:63). Changes v1 [1] -> v2: - dropped unnecessary replacement of KBUILD_OUTPUT with $(objtree) (Andrii) Changes v2 [2] -> v3: - make sure --sysroot option is set for libbpf's EXTRA_CFLAGS, if $(SYSROOT) is set (Stanislav) [0] commit 13b2548 ("kbuild: change working directory to external module directory with M=") [1] https://lore.kernel.org/bpf/[email protected]/ [2] https://lore.kernel.org/bpf/[email protected]/ Fixes: 13b2548 ("kbuild: change working directory to external module directory with M=") Acked-by: Stanislav Fomichev <[email protected]> Signed-off-by: Eduard Zingerman <[email protected]>
Upstream branch: bd74e23 |
8fa4fe4
to
4fb6668
Compare
de5336c
to
1590fbf
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=914290 irrelevant now. Closing PR. |
Pull request for series with
subject: samples/bpf: remove unnecessary -I flags from libbpf EXTRA_CFLAGS
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=913926