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

example/c: fix uprobe cross compiling issue #211

Merged
merged 1 commit into from
Sep 6, 2023
Merged

Conversation

setNull
Copy link

@setNull setNull commented Aug 29, 2023

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.

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 <[email protected]>
@setNull
Copy link
Author

setNull commented Aug 29, 2023

@chenhengqi @anakryiko please help review this PR.

I hit this issue when cross build uprobe example for arm64 on x86 host.

@chenhengqi
Copy link
Contributor

#159 (comment)

I am good with this change.

@setNull
Copy link
Author

setNull commented Sep 1, 2023

hi @anakryiko , could you help merge this?

@anakryiko anakryiko merged commit 93596cd into libbpf:master Sep 6, 2023
9 checks passed
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.

3 participants