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

export to ELF64 #4

Open
madsobitsoe opened this issue Mar 9, 2022 · 2 comments
Open

export to ELF64 #4

madsobitsoe opened this issue Mar 9, 2022 · 2 comments

Comments

@madsobitsoe
Copy link

Implement exporting an assembled eBPF bytecode program to an ELF object, similar to e.g. clang -target bpf someProgram -o someProgram.o.

This would allow us to use tools like bpftool to load programs as well as dump both their xlated and JIT'ed versions.
It might be useful for asserting correctness in ebpf-tools, as well as making it easier to use ebpf-tools with projects like the PREVAIL-verifier and uBPF. (Although uBPF accepts non-ELF raw bytecode).

I am unsure of the extent of this proposal, but I am quite certain it amounts to more than "wrap the bytecode in a header".

@kfl
Copy link
Owner

kfl commented Mar 9, 2022

The problem that that there are several "standards" for how to put the bytecode in ELF, different loaders have different standards last I checked.

@kfl
Copy link
Owner

kfl commented Mar 9, 2022

A first step towards this might be to extend the AST and assembler syntax to support named sections.

To generate the ELF object files, the melf package might be used. I think it is the most complete package for working with ELF files, and the only one that allows writing ELF files.

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

No branches or pull requests

2 participants