-
Notifications
You must be signed in to change notification settings - Fork 699
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
bpf2go: export core functionality #1494
Conversation
cmd/bpf2go/internal/module.go
Outdated
return "github.com/cilium/ebpf" | ||
} | ||
|
||
return bi.Main.Path |
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.
https://pkg.go.dev/runtime/debug#BuildInfo
This means that any outside program trying to use the code template will insert its own package instead of github.com/cilium/ebpf
.
So even though the template functions are now public, it is not possible to use them outside of this repo and generate functional bindings.
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.
Ugh, good point. I guess removing the parameter outright it is.
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.
Testing this properly is a headache as well.
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.
Goodbye BuildInfo, it was probably a bad idea from the start.
88c83d4
to
20f267d
Compare
@wdullaer does this work for you now (sans the identifier stuff)? |
Looks great. I appreciate the speedy follow up! |
Moves the code to generate go bindings to its own dedicated package and export the necessary functions to use it in bpf2go. This change will make it possible to reuse this code in other tools, without having to compile the C programs. The behaviour of bpf2go is unchanged. [ Lorenz: move code and backed out changes around module and identifier. These can come later, with tests. ] Co-authored-by: Lorenz Bauer <[email protected]> Signed-off-by: Wouter Dullaert <[email protected]>
Move the code necessary to compile a C to an ELF. The behaviour of bpf2go is unchanged. The code to fix up make-style depfiles remains in bpf2go since it has little tests, and is probably used only seldomly. Signed-off-by: Lorenz Bauer <[email protected]>
Move target and force users to use one of the predefined targets. Also export logic to generate build contraints from goarches. Signed-off-by: Lorenz Bauer <[email protected]>
bpf2go: export binding generator
bpf2go: export compilation
bpf2go: export targets