Skip to content

Commit 93596cd

Browse files
wangjieanakryiko
authored andcommitted
example/c: fix uprobe cross compiling issue
Some archs, like arm64, use userspace pt_regs in bpf_tracing.h. When cross compiling arm64 bpf examples in x86_64 host, clang cannot find the arch specific uapi ptrace.h, which causing below compiling errror, " uprobe.bpf.c:11:5: error: incomplete definition of type 'struct user_pt_regs' 11 | int BPF_KPROBE(uprobe_add, int a, int b) " Using arch specific vmlinux.h fix this issue. Signed-off-by: wangjie <wangjie22@lixiang.com>
1 parent 11750e4 commit 93596cd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

examples/c/uprobe.bpf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22
/* Copyright (c) 2020 Facebook */
3-
#include <linux/bpf.h>
4-
#include <linux/ptrace.h>
3+
#include "vmlinux.h"
54
#include <bpf/bpf_helpers.h>
65
#include <bpf/bpf_tracing.h>
76

0 commit comments

Comments
 (0)