Skip to content

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

Merged
merged 4 commits into from
Sep 8, 2020
Merged

BPF: add BTF #6267

merged 4 commits into from
Sep 8, 2020

Conversation

mattnite
Copy link
Contributor

@mattnite mattnite commented Sep 7, 2020

These describe the binary layout of the BTF section in BPF elf objects


pub const Type = packed struct {
name_off: u32,
info: struct {
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible usecase for #4016

Copy link
Contributor Author

@mattnite mattnite Sep 7, 2020

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.

};

pub const FuncLinkage = enum {
Static,
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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.

@andrewrk andrewrk merged commit f6f0e09 into ziglang:master Sep 8, 2020
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.

4 participants