Merge pull request #1197 from heiher/xtask-loong64

chore(xtask): Add loongarch64 to codegen
reviewable/pr1199/r1
Dave Tucker 1 week ago committed by GitHub
commit 85c0139428
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -28,7 +28,7 @@ jobs:
run: |
set -euxo pipefail
sudo apt -y update
sudo apt -y install libelf-dev libc6-dev libc6-dev-{arm64,armel,riscv64,ppc64el,s390x,mips}-cross
sudo apt -y install libelf-dev libc6-dev libc6-dev-{arm64,armel,loong64,riscv64,ppc64el,s390x,mips}-cross
- run: cargo xtask codegen
- run: cargo xtask public-api --bless

@ -43,6 +43,7 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
powerpc64_sysroot,
s390x_sysroot,
mips_sysroot,
loongarch64_sysroot,
} = opts;
let dir = PathBuf::from("aya-obj");
let generated = dir.join("src/generated");
@ -204,6 +205,7 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
Architecture::PowerPC64 => "powerpc64le-unknown-linux-gnu",
Architecture::S390X => "s390x-unknown-linux-gnu",
Architecture::Mips => "mips-unknown-linux-gnu",
Architecture::LoongArch64 => "loongarch64-unknown-linux-gnu",
};
bindgen = bindgen.clang_args(&["-target", target]);
@ -217,6 +219,7 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
Architecture::PowerPC64 => powerpc64_sysroot,
Architecture::S390X => s390x_sysroot,
Architecture::Mips => mips_sysroot,
Architecture::LoongArch64 => loongarch64_sysroot,
};
bindgen = bindgen.clang_args(["-I", sysroot.to_str().unwrap()]);

@ -28,6 +28,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
powerpc64_sysroot,
s390x_sysroot,
mips_sysroot,
loongarch64_sysroot,
} = opts;
let tmp_dir = tempfile::tempdir().context("tempdir failed")?;
@ -113,6 +114,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
Architecture::PowerPC64 => "powerpc64le-unknown-linux-gnu",
Architecture::S390X => "s390x-unknown-linux-gnu",
Architecture::Mips => "mips-unknown-linux-gnu",
Architecture::LoongArch64 => "loongarch64-unknown-linux-gnu",
};
bindgen = bindgen.clang_args(["-target", target]);
@ -126,6 +128,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
Architecture::PowerPC64 => powerpc64_sysroot,
Architecture::S390X => s390x_sysroot,
Architecture::Mips => mips_sysroot,
Architecture::LoongArch64 => loongarch64_sysroot,
};
bindgen = bindgen.clang_args(["-I", sysroot.to_str().unwrap()]);

@ -15,6 +15,7 @@ const SUPPORTED_ARCHS: &[Architecture] = &[
Architecture::RISCV64,
Architecture::PowerPC64,
Architecture::S390X,
Architecture::LoongArch64,
];
#[derive(Debug, Copy, Clone)]
@ -26,6 +27,7 @@ pub enum Architecture {
PowerPC64,
S390X,
Mips,
LoongArch64,
}
impl Architecture {
@ -46,6 +48,7 @@ impl std::str::FromStr for Architecture {
"riscv64" => Architecture::RISCV64,
"powerpc64" => Architecture::PowerPC64,
"s390x" => Architecture::S390X,
"loongarch64" => Architecture::LoongArch64,
_ => return Err("invalid architecture"),
})
}
@ -61,6 +64,7 @@ impl std::fmt::Display for Architecture {
Architecture::RISCV64 => "riscv64",
Architecture::PowerPC64 => "powerpc64",
Architecture::S390X => "s390x",
Architecture::LoongArch64 => "loongarch64",
})
}
}
@ -89,6 +93,9 @@ pub struct SysrootOptions {
#[arg(long, default_value = "/usr/mips-linux-gnu/include", action)]
mips_sysroot: PathBuf,
#[arg(long, default_value = "/usr/loongarch64-linux-gnu/include", action)]
loongarch64_sysroot: PathBuf,
}
#[derive(Parser)]

Loading…
Cancel
Save