diff --git a/test/integration-test/bpf/ext.bpf.c b/test/integration-test/bpf/ext.bpf.c index 6ec95229..2996fcf7 100644 --- a/test/integration-test/bpf/ext.bpf.c +++ b/test/integration-test/bpf/ext.bpf.c @@ -1,5 +1,5 @@ // clang-format off -#include +#include #include // clang-format on diff --git a/test/integration-test/bpf/main.bpf.c b/test/integration-test/bpf/main.bpf.c index f60e42a9..b9365622 100644 --- a/test/integration-test/bpf/main.bpf.c +++ b/test/integration-test/bpf/main.bpf.c @@ -1,5 +1,5 @@ // clang-format off -#include +#include #include // clang-format on diff --git a/test/integration-test/bpf/multimap-btf.bpf.c b/test/integration-test/bpf/multimap-btf.bpf.c index 07fcc60f..2bd7978b 100644 --- a/test/integration-test/bpf/multimap-btf.bpf.c +++ b/test/integration-test/bpf/multimap-btf.bpf.c @@ -1,5 +1,5 @@ // clang-format off -#include +#include #include // clang-format on diff --git a/test/integration-test/bpf/reloc.bpf.c b/test/integration-test/bpf/reloc.bpf.c index f426874f..cb15dfc3 100644 --- a/test/integration-test/bpf/reloc.bpf.c +++ b/test/integration-test/bpf/reloc.bpf.c @@ -1,5 +1,5 @@ // clang-format off -#include +#include #include #include // clang-format on diff --git a/test/integration-test/bpf/reloc.btf.c b/test/integration-test/bpf/reloc.btf.c index ec396552..d50cd943 100644 --- a/test/integration-test/bpf/reloc.btf.c +++ b/test/integration-test/bpf/reloc.btf.c @@ -1,5 +1,5 @@ // clang-format off -#include +#include #include #include // clang-format on diff --git a/test/integration-test/bpf/text_64_64_reloc.c b/test/integration-test/bpf/text_64_64_reloc.c index cd273a35..067350cc 100644 --- a/test/integration-test/bpf/text_64_64_reloc.c +++ b/test/integration-test/bpf/text_64_64_reloc.c @@ -1,5 +1,5 @@ // clang-format off -#include +#include #include // clang-format on diff --git a/test/integration-test/build.rs b/test/integration-test/build.rs index bf4a0234..c1a8992f 100644 --- a/test/integration-test/build.rs +++ b/test/integration-test/build.rs @@ -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