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
adding support for clang relocations #102
Conversation
@mdr78 Can you please add tests for this change? |
Ok will do, needs some tidyup in places also. |
Any update on this? |
This patch separates out the JITter from the interpreter. It adds a "null" JIT which just errors out. After this patch is applied it is possible to build on non-x86-64 platforms and run the interpreter without worrying about the JIT. This is achieved by adding a translate function-pointer member to the ubpf_vm struct. ubpf_create() then sets the pointer up to the correct JIT. Finally ubpf_translate() now delegates to that function pointer. To enable code reuse some common code from ubpf_jit_x86_64.c is moved into a new file ubpf_jit.c. Also what was ubpf_translate() in ubpf_jit_x86_64.c is renmaed ubpf_translate_x86_64.c. The build process assumes that all backends can be compiled on all platforms. It then relies on the linker to not link in unused backends. The code also assumes that only the JIT backend targeting the platform the code is run on will is needed. Finally, the testing infrastructure is updated to support non-x86-64 platforms.
The elf tests fail on Arm but not x86-64. This seems to be due to the local field of st_other not eing set on symbols. We work around this issue by setting local to 0 on all symbols. This is a good catch-all value as it generally means "default".
This can be useful to: - Inspect registers after program execution. - Determine where registers should be stored. Signed-off-by: Martin Ichilevici de Oliveira <martin.i.oliveira@gmail.com>
This adds initial implementation of the Arm64 JIT.
Added support for clang function and string relocations, these show as up as R_BPF_64_64 and R_BPF_64_32 in *-readelf relocations. Support for nosetests elf tests is still TBD. Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Looking at it now. |
Looks like I have made a mess of this PR - I might have to close it and open a new one. |
Made a mess of this one, will create a new pr. |
Added support for clang function and string relocations, these show as up as
R_BPF_64_64 and R_BPF_64_32 in *-readelf relocations. Support for nosetests elf
tests is still TBD.
Signed-off-by: Ray Kinsella mdr@ashroe.eu