For cross-compilation, the two targets bpfeb and bpfel were introduced, thanks to that BPF programs can be compiled on a node running in one endianness (e.g. little endian on x86) and run on a node in another endianness format (e.g. big endian on arm). Note that the front end (clang) needs to run in the target endianness as well. https://docs.cilium.io/en/v1.9/bpf/
@PolynomialDivision started really early today with xdp foo. while googeling and trying to figure stuff out, I stumbled across this post. What are you working on ?
root@OpenWrt:/# ./ubpf -S -d eth1
[ 8149.659858] *** NOT YET: opcode db ***
Success: Loaded BPF-object(xdp_prog_kern.o) and used section(xdp_stats1)
Could u give me your Makefile how you compiled that? I wanted to use xdp-tools, but I had some issues with the linker and include statements. I had no time to work on this again.
I have two cases I want to have a look at:
I want to manipulate IPv6 Header
I want to grep statistics from monitor sockets
With iproute2 I can easily laod xdp-ebpf scripts into the kernel. But actually, I want to use a loader from userspace.
give 1-2 more weeks and I will put ubpf into a git tree. It will be very close to what you want to do. I wrote the central core of the code today and will move onto the application layer next week. I have just been able to drop amd rewrite packets and also send dhcp requests to a userland map. interface redirect is not working yet.
clang -O2 -g -Wall -target bpf -c -o ubf_kern.o ubpf_kern.c -I /usr/include/x86_64-linux-gnu/ is how I compile