|
|
|
@ -116,10 +116,22 @@ fn main() {
|
|
|
|
|
target_arch.push(arch);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// NB: libbpf's documentation suggests that vmlinux.h be generated by running `bpftool btf
|
|
|
|
|
// dump file /sys/kernel/btf/vmlinux format c`; this allows CO-RE to work.
|
|
|
|
|
//
|
|
|
|
|
// However in our tests we do not make use of kernel data structures, and so any vmlinux.h
|
|
|
|
|
// which defines the constants we need (e.g. `__u8`, `__u64`, `BPF_MAP_TYPE_ARRAY`,
|
|
|
|
|
// `BPF_ANY`, `XDP_PASS`, `XDP_DROP`, etc.) will suffice. Since we already have a libbpf
|
|
|
|
|
// submodule which happens to include such a file, we use it.
|
|
|
|
|
let libbpf_vmlinux_dir = libbpf_dir.join(".github/actions/build-selftests");
|
|
|
|
|
|
|
|
|
|
let clang = || {
|
|
|
|
|
let mut cmd = Command::new("clang");
|
|
|
|
|
cmd.arg("-I")
|
|
|
|
|
cmd.arg("-nostdlibinc")
|
|
|
|
|
.arg("-I")
|
|
|
|
|
.arg(&libbpf_headers_dir)
|
|
|
|
|
.arg("-I")
|
|
|
|
|
.arg(&libbpf_vmlinux_dir)
|
|
|
|
|
.args(["-g", "-O2", "-target", target, "-c"])
|
|
|
|
|
.arg(&target_arch);
|
|
|
|
|
cmd
|
|
|
|
|