Skip to content

Commit b8a6426

Browse files
fujitaanakryiko
authored andcommitted
libbpf-cargo: fix bpf code build on aarch64
set __TARGET_ARCH_arm64.
1 parent 217d298 commit b8a6426

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libbpf-cargo/src/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ fn check_clang(debug: bool, clang: &Path, skip_version_checks: bool) -> Result<(
111111
///
112112
/// for each prog.
113113
fn compile_one(debug: bool, source: &Path, out: &Path, clang: &Path, options: &str) -> Result<()> {
114-
let arch = if std::env::consts::ARCH == "x86_64" {
115-
"x86"
116-
} else {
117-
std::env::consts::ARCH
114+
let arch = match std::env::consts::ARCH {
115+
"x86_64" => "x86",
116+
"aarch64" => "arm64",
117+
_ => std::env::consts::ARCH,
118118
};
119119

120120
if debug {

0 commit comments

Comments
 (0)