Conversation
cmd/bpf2go/internal/module.go
Outdated
| return "github.com/cilium/ebpf" | ||
| } | ||
|
|
||
| return bi.Main.Path |
There was a problem hiding this comment.
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.
Ugh, good point. I guess removing the parameter outright it is.
There was a problem hiding this comment.
Testing this properly is a headache as well.
There was a problem hiding this comment.
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 <lmb@isovalent.com> Signed-off-by: Wouter Dullaert <wouter.dullaert@exoscale.ch>
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 <lmb@isovalent.com>
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 <lmb@isovalent.com>
bpf2go: export binding generator
bpf2go: export compilation
bpf2go: export targets