Merge branch 'main' into dev

reviewable/pr1325/r1
Xiaobo Liu 3 weeks ago committed by GitHub
commit c992d6b5e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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 }

@ -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 </dev/null)
let target = match arch {
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",
};
let target = arch.target();
bindgen = bindgen.clang_args(&["-target", target]);
// Set the sysroot. This is needed to ensure that the correct arch

@ -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 </dev/null)
let target = match arch {
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",
};
let target = arch.target();
bindgen = bindgen.clang_args(["-target", target]);
// Set the sysroot. This is needed to ensure that the correct arch

@ -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 {

Loading…
Cancel
Save