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

examples: generate types via bpf2go #575

Merged
merged 2 commits into from
Feb 24, 2022
Merged

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Feb 18, 2022

examples: generate types via bpf2go

Use bpf2go to generate a type for struct event. This requires an ugly hack to
convince clang to emit struct event into the ELF in the first place.

examples/headers: add bpf_endian.h and LICENSE

Stick to libbpf 0.6.1 for now, since 0.7.0 deprecates non-BTF
map definitions. This requires removing the duplicate definition of PT_REGS_RC.

Also guard struct pt_regs for amd64, the definition isn't valid on
other arches. Finally, get rid of the __VMLINUX_H__ define, it trips up some
logic in bpf_tracing.h.

See https://github.com/libbpf/libbpf/commit/d788cd57b54c179a657f823cbe56c868f6974924

lmb added 2 commits February 18, 2022 11:57
Stick to libbpf 0.6.1 for now, since 0.7.0 deprecates non-BTF
map definitions. This requires removing the duplicate definition of PT_REGS_RC.

Also guard struct pt_regs for amd64, the definition isn't valid on
other arches. Finally, get rid of the __VMLINUX_H__ define, it trips up some
logic in bpf_tracing.h.

See libbpf/libbpf@d788cd5
Use bpf2go to generate a type for struct event. This requires an ugly hack to
convince clang to emit struct event into the ELF in the first place.
@lmb lmb requested a review from ti-mo February 18, 2022 12:20
Copy link
Collaborator

@ti-mo ti-mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now if bpf2go could emit efficient unmarshalers for types, that would be something. 😛

SPDX-License-Identifier: BSD-2-Clause
License-Text:

Copyright (c) <year> <owner> . All rights reserved.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lmb lmb merged commit 11d833e into cilium:master Feb 24, 2022
@lmb lmb deleted the bpf2go-gen-types-examples branch February 24, 2022 17:23
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