-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
BPF: add BTF #6267
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
BPF: add BTF #6267
Conversation
lib/std/os/linux/bpf/btf.zig
Outdated
|
||
pub const Type = packed struct { | ||
name_off: u32, | ||
info: struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like it needs to be packed
pub const InfoSec = packed struct { | ||
sec_name_off: u32, | ||
num_info: u32, | ||
// TODO: communicate that there is data here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible usecase for #4016
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would be an excellent addition to Zig, we get to put the billion dollar mistake to use and get to emulate something available in C.
lib/std/os/linux/bpf/btf.zig
Outdated
}; | ||
|
||
pub const FuncLinkage = enum { | ||
Static, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is potentially a bit nitpicky, but according to the style guide, enum literals should be camel case. I know most of the standard library does not follow this yet, but it might be good for new code to already conform to the guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicks are completely welcome, this particular piece of code was written a while ago and I forgot to update it
@@ -0,0 +1,151 @@ | |||
const magic = 0xeb9f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All standard library source files now have a license notice at the top of the file. It would make sense to add them to new files as well.
These describe the binary layout of the BTF section in BPF elf objects