summaryrefslogtreecommitdiffstats
path: root/samples/bpf/test_probe_write_user_user.c
diff options
context:
space:
mode:
authorDaniel T. Lee <danieltimlee@gmail.com>2022-12-24 08:15:24 +0100
committerAndrii Nakryiko <andrii@kernel.org>2022-12-29 23:22:34 +0100
commitd4fffba4d04b8d605ff07f1ed987399f6af0ad5b (patch)
tree0405767945159b3efca7c39d81853d0dea6f7a5c /samples/bpf/test_probe_write_user_user.c
parentsamples/bpf: Use vmlinux.h instead of implicit headers in syscall tracing pro... (diff)
downloadlinux-d4fffba4d04b8d605ff07f1ed987399f6af0ad5b.tar.xz
linux-d4fffba4d04b8d605ff07f1ed987399f6af0ad5b.zip
samples/bpf: Change _kern suffix to .bpf with syscall tracing program
Currently old compile rule (CLANG-bpf) doesn't contains VMLINUX_H define flag which is essential for the bpf program that includes "vmlinux.h". Also old compile rule doesn't directly specify the compile target as bpf, instead it uses bunch of extra options with clang followed by long chain of commands. (e.g. clang | opt | llvm-dis | llc) In Makefile, there is already new compile rule which is more simple and neat. And it also has -D__VMLINUX_H__ option. By just changing the _kern suffix to .bpf will inherit the benefit of the new CLANG-BPF compile target. Also, this commit adds dummy gnu/stub.h to the samples/bpf directory. As commit 1c2dd16add7e ("selftests/bpf: get rid of -D__x86_64__") noted, compiling with 'clang -target bpf' will raise an error with stubs.h unless workaround (-D__x86_64) is used. This commit solves this problem by adding dummy stub.h to make /usr/include/features.h to follow the expected path as the same way selftests/bpf dealt with. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20221224071527.2292-4-danieltimlee@gmail.com
Diffstat (limited to 'samples/bpf/test_probe_write_user_user.c')
-rw-r--r--samples/bpf/test_probe_write_user_user.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/test_probe_write_user_user.c b/samples/bpf/test_probe_write_user_user.c
index 00ccfb834e45..2a539aec4116 100644
--- a/samples/bpf/test_probe_write_user_user.c
+++ b/samples/bpf/test_probe_write_user_user.c
@@ -24,7 +24,7 @@ int main(int ac, char **argv)
mapped_addr_in = (struct sockaddr_in *)&mapped_addr;
tmp_addr_in = (struct sockaddr_in *)&tmp_addr;
- snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
+ snprintf(filename, sizeof(filename), "%s.bpf.o", argv[0]);
obj = bpf_object__open_file(filename, NULL);
if (libbpf_get_error(obj)) {
fprintf(stderr, "ERROR: opening BPF object file failed\n");