4
0
Эх сурвалжийг харах

ci,xtask: sort architectures

Tamir Duberstein 1 сар өмнө
parent
commit
34319cba12

+ 6 - 6
.github/workflows/ci.yml

@@ -72,13 +72,13 @@ jobs:
       fail-fast: false
       matrix:
         bpf_target_arch:
-          - x86_64-unknown-linux-gnu
           - aarch64-unknown-linux-gnu
           - armv7-unknown-linux-gnueabi
-          - riscv64gc-unknown-linux-gnu
+          - mips-unknown-linux-gnu
           - powerpc64le-unknown-linux-gnu
+          - riscv64gc-unknown-linux-gnu
           - s390x-unknown-linux-gnu
-          - mips-unknown-linux-gnu
+          - x86_64-unknown-linux-gnu
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v4
@@ -131,13 +131,13 @@ jobs:
       fail-fast: false
       matrix:
         bpf_target_arch:
-          - x86_64
           - aarch64
           - arm
-          - riscv64
+          - mips
           - powerpc64
+          - riscv64
           - s390x
-          - mips
+          - x86_64
         target:
           - bpfel-unknown-none
           - bpfeb-unknown-none

+ 14 - 14
xtask/src/codegen/aya.rs

@@ -36,14 +36,14 @@ fn codegen_internal_btf_bindings(libbpf_dir: &Path) -> Result<()> {
 
 fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
     let SysrootOptions {
-        x86_64_sysroot,
         aarch64_sysroot,
         armv7_sysroot,
-        riscv64_sysroot,
+        loongarch64_sysroot,
+        mips_sysroot,
         powerpc64_sysroot,
+        riscv64_sysroot,
         s390x_sysroot,
-        mips_sysroot,
-        loongarch64_sysroot,
+        x86_64_sysroot,
     } = opts;
     let dir = PathBuf::from("aya-obj");
     let generated = dir.join("src/generated");
@@ -198,28 +198,28 @@ 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::X86_64 => "x86_64-unknown-linux-gnu",
-            Architecture::ARMv7 => "armv7-unknown-linux-gnu",
             Architecture::AArch64 => "aarch64-unknown-linux-gnu",
-            Architecture::RISCV64 => "riscv64-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::Mips => "mips-unknown-linux-gnu",
-            Architecture::LoongArch64 => "loongarch64-unknown-linux-gnu",
+            Architecture::X86_64 => "x86_64-unknown-linux-gnu",
         };
         bindgen = bindgen.clang_args(&["-target", target]);
 
         // Set the sysroot. This is needed to ensure that the correct arch
         // specific headers are imported.
         let sysroot = match arch {
-            Architecture::X86_64 => x86_64_sysroot,
-            Architecture::ARMv7 => armv7_sysroot,
             Architecture::AArch64 => aarch64_sysroot,
-            Architecture::RISCV64 => riscv64_sysroot,
+            Architecture::ARMv7 => armv7_sysroot,
+            Architecture::LoongArch64 => loongarch64_sysroot,
+            Architecture::Mips => mips_sysroot,
             Architecture::PowerPC64 => powerpc64_sysroot,
+            Architecture::RISCV64 => riscv64_sysroot,
             Architecture::S390X => s390x_sysroot,
-            Architecture::Mips => mips_sysroot,
-            Architecture::LoongArch64 => loongarch64_sysroot,
+            Architecture::X86_64 => x86_64_sysroot,
         };
         bindgen = bindgen.clang_args(["-I", sysroot.to_str().unwrap()]);
 

+ 14 - 14
xtask/src/codegen/aya_ebpf_bindings.rs

@@ -21,14 +21,14 @@ use crate::{
 
 pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
     let SysrootOptions {
-        x86_64_sysroot,
         aarch64_sysroot,
         armv7_sysroot,
-        riscv64_sysroot,
+        loongarch64_sysroot,
+        mips_sysroot,
         powerpc64_sysroot,
+        riscv64_sysroot,
         s390x_sysroot,
-        mips_sysroot,
-        loongarch64_sysroot,
+        x86_64_sysroot,
     } = opts;
 
     let tmp_dir = tempfile::tempdir().context("tempdir failed")?;
@@ -107,28 +107,28 @@ 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::X86_64 => "x86_64-unknown-linux-gnu",
-            Architecture::ARMv7 => "armv7-unknown-linux-gnu",
             Architecture::AArch64 => "aarch64-unknown-linux-gnu",
-            Architecture::RISCV64 => "riscv64-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::Mips => "mips-unknown-linux-gnu",
-            Architecture::LoongArch64 => "loongarch64-unknown-linux-gnu",
+            Architecture::X86_64 => "x86_64-unknown-linux-gnu",
         };
         bindgen = bindgen.clang_args(["-target", target]);
 
         // Set the sysroot. This is needed to ensure that the correct arch
         // specific headers are imported.
         let sysroot = match arch {
-            Architecture::X86_64 => x86_64_sysroot,
-            Architecture::ARMv7 => armv7_sysroot,
             Architecture::AArch64 => aarch64_sysroot,
-            Architecture::RISCV64 => riscv64_sysroot,
+            Architecture::ARMv7 => armv7_sysroot,
+            Architecture::LoongArch64 => loongarch64_sysroot,
+            Architecture::Mips => mips_sysroot,
             Architecture::PowerPC64 => powerpc64_sysroot,
+            Architecture::RISCV64 => riscv64_sysroot,
             Architecture::S390X => s390x_sysroot,
-            Architecture::Mips => mips_sysroot,
-            Architecture::LoongArch64 => loongarch64_sysroot,
+            Architecture::X86_64 => x86_64_sysroot,
         };
         bindgen = bindgen.clang_args(["-I", sysroot.to_str().unwrap()]);
 

+ 20 - 20
xtask/src/codegen/mod.rs

@@ -41,14 +41,14 @@ impl std::str::FromStr for Architecture {
 
     fn from_str(s: &str) -> Result<Self, Self::Err> {
         Ok(match s {
-            "mips" => Architecture::Mips,
-            "x86_64" => Architecture::X86_64,
-            "armv7" => Architecture::ARMv7,
             "aarch64" => Architecture::AArch64,
-            "riscv64" => Architecture::RISCV64,
+            "armv7" => Architecture::ARMv7,
+            "loongarch64" => Architecture::LoongArch64,
+            "mips" => Architecture::Mips,
             "powerpc64" => Architecture::PowerPC64,
+            "riscv64" => Architecture::RISCV64,
             "s390x" => Architecture::S390X,
-            "loongarch64" => Architecture::LoongArch64,
+            "x86_64" => Architecture::X86_64,
             _ => return Err("invalid architecture"),
         })
     }
@@ -57,14 +57,14 @@ impl std::str::FromStr for Architecture {
 impl std::fmt::Display for Architecture {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         f.write_str(match self {
-            Architecture::Mips => "mips",
-            Architecture::X86_64 => "x86_64",
-            Architecture::ARMv7 => "armv7",
             Architecture::AArch64 => "aarch64",
-            Architecture::RISCV64 => "riscv64",
+            Architecture::ARMv7 => "armv7",
+            Architecture::LoongArch64 => "loongarch64",
+            Architecture::Mips => "mips",
             Architecture::PowerPC64 => "powerpc64",
+            Architecture::RISCV64 => "riscv64",
             Architecture::S390X => "s390x",
-            Architecture::LoongArch64 => "loongarch64",
+            Architecture::X86_64 => "x86_64",
         })
     }
 }
@@ -73,29 +73,29 @@ impl std::fmt::Display for Architecture {
 // libc6-dev-{arm64,armel}-cross packages.
 #[derive(Parser)]
 pub struct SysrootOptions {
-    #[arg(long, default_value = "/usr/include/x86_64-linux-gnu", action)]
-    x86_64_sysroot: PathBuf,
-
     #[arg(long, default_value = "/usr/aarch64-linux-gnu/include", action)]
     aarch64_sysroot: PathBuf,
 
     #[arg(long, default_value = "/usr/arm-linux-gnueabi/include", action)]
     armv7_sysroot: PathBuf,
 
-    #[arg(long, default_value = "/usr/riscv64-linux-gnu/include", action)]
-    riscv64_sysroot: PathBuf,
+    #[arg(long, default_value = "/usr/loongarch64-linux-gnu/include", action)]
+    loongarch64_sysroot: PathBuf,
+
+    #[arg(long, default_value = "/usr/mips-linux-gnu/include", action)]
+    mips_sysroot: PathBuf,
 
     #[arg(long, default_value = "/usr/powerpc64le-linux-gnu/include", action)]
     powerpc64_sysroot: PathBuf,
 
+    #[arg(long, default_value = "/usr/riscv64-linux-gnu/include", action)]
+    riscv64_sysroot: PathBuf,
+
     #[arg(long, default_value = "/usr/s390x-linux-gnu/include", action)]
     s390x_sysroot: PathBuf,
 
-    #[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,
+    #[arg(long, default_value = "/usr/include/x86_64-linux-gnu", action)]
+    x86_64_sysroot: PathBuf,
 }
 
 #[derive(Parser)]