From 2869cb884cd9e042c46e5c0c7c3a42c76a7c881e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 20:19:40 +0000 Subject: [PATCH 1/2] build(deps): update cargo_metadata requirement in the cargo-crates group Updates the requirements on [cargo_metadata](https://github.com/oli-obk/cargo_metadata) to permit the latest version. Updates `cargo_metadata` to 0.21.0 - [Release notes](https://github.com/oli-obk/cargo_metadata/releases) - [Changelog](https://github.com/oli-obk/cargo_metadata/blob/main/CHANGELOG.md) - [Commits](https://github.com/oli-obk/cargo_metadata/compare/0.21.0...0.21.0) --- updated-dependencies: - dependency-name: cargo_metadata dependency-version: 0.21.0 dependency-type: direct:production dependency-group: cargo-crates ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3ff553bc..16825e1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,7 @@ base64 = { version = "0.22.1", default-features = false } bindgen = { version = "0.72", default-features = false } bitflags = { version = "2.2.1", default-features = false } bytes = { version = "1", default-features = false } -cargo_metadata = { version = "0.21.0", default-features = false } +cargo_metadata = { version = "0.22.0", default-features = false } clap = { version = "4", default-features = false } const-assert = { version = "1.0.1", default-features = false } dialoguer = { version = "0.11", default-features = false } From 4fe920f761212a26c1d78a3dc2a3a1a2e19534e7 Mon Sep 17 00:00:00 2001 From: Xiaobo Liu Date: Tue, 19 Aug 2025 20:56:23 +0800 Subject: [PATCH 2/2] xtask: add the target method to Architecture Signed-off-by: Xiaobo Liu --- xtask/src/codegen/aya.rs | 11 +---------- xtask/src/codegen/aya_ebpf_bindings.rs | 11 +---------- xtask/src/codegen/mod.rs | 13 +++++++++++++ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/xtask/src/codegen/aya.rs b/xtask/src/codegen/aya.rs index 381d8b6d..c1d1f377 100644 --- a/xtask/src/codegen/aya.rs +++ b/xtask/src/codegen/aya.rs @@ -182,16 +182,7 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> { // Set target triple. This will set the right flags (which you can see // running clang -target=X -E - -dM "aarch64-unknown-linux-gnu", - Architecture::ARMv7 => "armv7-unknown-linux-gnu", - Architecture::LoongArch64 => "loongarch64-unknown-linux-gnu", - Architecture::Mips => "mips-unknown-linux-gnu", - Architecture::PowerPC64 => "powerpc64le-unknown-linux-gnu", - Architecture::RISCV64 => "riscv64-unknown-linux-gnu", - Architecture::S390X => "s390x-unknown-linux-gnu", - Architecture::X86_64 => "x86_64-unknown-linux-gnu", - }; + let target = arch.target(); bindgen = bindgen.clang_args(&["-target", target]); // Set the sysroot. This is needed to ensure that the correct arch diff --git a/xtask/src/codegen/aya_ebpf_bindings.rs b/xtask/src/codegen/aya_ebpf_bindings.rs index d9ec9a61..a44757fe 100644 --- a/xtask/src/codegen/aya_ebpf_bindings.rs +++ b/xtask/src/codegen/aya_ebpf_bindings.rs @@ -93,16 +93,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> { // Set target triple. This will set the right flags (which you can see // running clang -target=X -E - -dM "aarch64-unknown-linux-gnu", - Architecture::ARMv7 => "armv7-unknown-linux-gnu", - Architecture::LoongArch64 => "loongarch64-unknown-linux-gnu", - Architecture::Mips => "mips-unknown-linux-gnu", - Architecture::PowerPC64 => "powerpc64le-unknown-linux-gnu", - Architecture::RISCV64 => "riscv64-unknown-linux-gnu", - Architecture::S390X => "s390x-unknown-linux-gnu", - Architecture::X86_64 => "x86_64-unknown-linux-gnu", - }; + let target = arch.target(); bindgen = bindgen.clang_args(["-target", target]); // Set the sysroot. This is needed to ensure that the correct arch diff --git a/xtask/src/codegen/mod.rs b/xtask/src/codegen/mod.rs index 6b3f0f55..85442fc2 100644 --- a/xtask/src/codegen/mod.rs +++ b/xtask/src/codegen/mod.rs @@ -34,6 +34,19 @@ impl Architecture { pub fn supported() -> &'static [Architecture] { SUPPORTED_ARCHS } + + pub fn target(&self) -> &'static str { + match self { + Architecture::AArch64 => "aarch64-unknown-linux-gnu", + Architecture::ARMv7 => "armv7-unknown-linux-gnu", + Architecture::LoongArch64 => "loongarch64-unknown-linux-gnu", + Architecture::Mips => "mips-unknown-linux-gnu", + Architecture::PowerPC64 => "powerpc64le-unknown-linux-gnu", + Architecture::RISCV64 => "riscv64-unknown-linux-gnu", + Architecture::S390X => "s390x-unknown-linux-gnu", + Architecture::X86_64 => "x86_64-unknown-linux-gnu", + } + } } impl std::str::FromStr for Architecture {