Skip to content

Commit 77e7169

Browse files
d-e-s-oanakryiko
authored andcommitted
Use vmlinux.h provided headers
Switch over to using the architecture specific vmlinux.h headers from the vmlinux.h submodule. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent c9f26c5 commit 77e7169

File tree

6 files changed

+12
-39
lines changed

6 files changed

+12
-39
lines changed

examples/c/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "loongarch64")
6868
endif()
6969

7070
set(BPFOBJECT_BPFTOOL_EXE ${CMAKE_CURRENT_BINARY_DIR}/bpftool/bootstrap/bpftool)
71-
set(BPFOBJECT_VMLINUX_H ${CMAKE_CURRENT_SOURCE_DIR}/../../vmlinux/${ARCH}/vmlinux.h)
71+
set(BPFOBJECT_VMLINUX_H ${CMAKE_CURRENT_SOURCE_DIR}/../../vmlinux.h/include/${ARCH}/vmlinux.h)
7272
set(LIBBPF_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libbpf)
7373
set(LIBBPF_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/libbpf/libbpf.a)
7474
find_package(BpfObject REQUIRED)

examples/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ARCH ?= $(shell uname -m | sed 's/x86_64/x86/' \
1616
| sed 's/mips.*/mips/' \
1717
| sed 's/riscv64/riscv/' \
1818
| sed 's/loongarch64/loongarch/')
19-
VMLINUX := ../../vmlinux/$(ARCH)/vmlinux.h
19+
VMLINUX := ../../vmlinux.h/include/$(ARCH)/vmlinux.h
2020
# Use our own libbpf API headers and Linux UAPI headers distributed with
2121
# libbpf to avoid dependency on system-wide headers, which could be missing or
2222
# outdated

examples/c/xmake.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ end
2626
set_symbols("none")
2727

2828
if is_arch("arm64", "arm64-v8a") then
29-
add_includedirs("../../vmlinux/arm64")
29+
add_includedirs("../../vmlinux.h/include/arm64")
3030
elseif is_arch("arm.*") then
31-
add_includedirs("../../vmlinux/arm")
31+
add_includedirs("../../vmlinux.h/include/arm")
3232
elseif is_arch("riscv32", "riscv64") then
33-
add_includedirs("../../vmlinux/riscv")
33+
add_includedirs("../../vmlinux.h/include/riscv")
3434
elseif is_arch("loongarch") then
35-
add_includedirs("../../vmlinux/loongarch")
35+
add_includedirs("../../vmlinux.h/include/loongarch")
3636
elseif is_arch("ppc", "powerpc") then
37-
add_includedirs("../../vmlinux/powerpc")
37+
add_includedirs("../../vmlinux.h/include/powerpc")
3838
elseif is_arch("x86_64", "i386") then
39-
add_includedirs("../../vmlinux/x86")
39+
add_includedirs("../../vmlinux.h/include/x86")
4040
else
41-
add_includedirs("../../vmlinux")
41+
add_includedirs("../../vmlinux.h/include")
4242
end
4343

4444
-- we can run `xmake f --require-bpftool=y` to pull bpftool from xmake-repo repository

examples/rust/profile/build.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@ fn main() {
1818
.source(SRC)
1919
.clang_args(format!(
2020
"-I{}",
21-
Path::new("../../../vmlinux")
22-
.join(match arch.as_ref() {
23-
"aarch64" => "arm64",
24-
"loongarch64" => "loongarch",
25-
"powerpc64" => "powerpc",
26-
"riscv64" => "riscv",
27-
"x86_64" => "x86",
28-
_ => &arch,
29-
})
30-
.display()
21+
Path::new("../../../vmlinux.h/include").join(arch).display()
3122
))
3223
.build_and_generate(out)
3324
.expect("bpf compilation failed");

examples/rust/tracecon/build.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@ fn main() {
1818
.source(SRC)
1919
.clang_args(format!(
2020
"-I{}",
21-
Path::new("../../../vmlinux")
22-
.join(match arch.as_ref() {
23-
"aarch64" => "arm64",
24-
"loongarch64" => "loongarch",
25-
"powerpc64" => "powerpc",
26-
"riscv64" => "riscv",
27-
"x86_64" => "x86",
28-
_ => &arch,
29-
})
30-
.display()
21+
Path::new("../../../vmlinux.h/include").join(arch).display()
3122
))
3223
.build_and_generate(&out)
3324
.expect("bpf compilation failed");

examples/rust/xdp/build.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@ fn main() {
1818
.source(SRC)
1919
.clang_args(format!(
2020
"-I{}",
21-
Path::new("../../../vmlinux")
22-
.join(match arch.as_ref() {
23-
"aarch64" => "arm64",
24-
"loongarch64" => "loongarch",
25-
"powerpc64" => "powerpc",
26-
"riscv64" => "riscv",
27-
"x86_64" => "x86",
28-
_ => &arch,
29-
})
30-
.display()
21+
Path::new("../../../vmlinux.h/include").join(arch).display()
3122
))
3223
.build_and_generate(out)
3324
.unwrap();

0 commit comments

Comments
 (0)