[llvm] [libc] Add riscv64 qemu precommit CI for overlay mode. (PR #192816)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 17:23:36 PDT 2026


https://github.com/lntue updated https://github.com/llvm/llvm-project/pull/192816

>From 5f882354d57430a75271456c07631409861ef06d Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Sun, 19 Apr 2026 08:03:20 +0800
Subject: [PATCH 1/4] [libc] Add riscv64 qemu precommit CI for overlay mode.

---
 .github/workflows/libc-overlay-tests.yml | 70 ++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index 1bc773ca7eaf7..651f2249544db 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -114,3 +114,73 @@ jobs:
         --build ${{ steps.strings.outputs.build-output-dir }} 
         --parallel 
         --target check-libc
+
+  qemu-riscv64:
+    runs-on: ubuntu-24.04
+
+    steps:
+      - name: Checkout LLVM
+        uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+        with:
+          persist-credentials: false
+
+      - name: Prepare dependencies
+        run: |
+          sudo apt-get update -y
+          sudo apt-get install -y cmake ninja-build clang lld qemu-user-static \
+            libc6-dev-riscv64-cross libstdc++6-riscv64-cross \
+            gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
+
+      - name: Setup GMP
+        run: |
+          mkdir build
+          cd build
+          wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz
+          tar -xf gmp-6.3.0.tar.xz
+          cd gmp-6.3.0
+          ./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu
+          make -j8
+          sudo make install
+          cd ../..
+      
+      - name: Setup MPFR
+        run: |
+          cd build
+          wget https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.xz
+          tar -xf mpfr-4.2.1.tar.xz
+          cd mpfr-4.2.1
+          ./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu \
+                      --with-gmp=/usr/riscv64-linux-gnu
+          make -j8
+          sudo make install
+          cd ../..
+      
+      - name: Configure CMake - Clang
+        run: |
+          cmake -B build/clang -S runtimes -G Ninja \
+            -DLLVM_ENABLE_RUNTIMES=libc \
+            -DCMAKE_C_COMPILER=clang \
+            -DCMAKE_CXX_COMPILER=clang++ \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DLIBC_TARGET_TRIPLE=riscv64-linux-gnu
+
+      - name: Build and Run - Clang
+        env:
+          QEMU_LD_PREFIX: /usr/riscv64-linux-gnu
+        run: |
+          cmake --build build/clang --target libc-shared-tests
+
+      - name: Configure CMake - gcc
+        run: |
+          cmake -B build/gcc -S runtimes -G Ninja \
+            -DLLVM_ENABLE_RUNTIMES=libc \
+            -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc \
+            -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++ \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DLIBC_TARGET_TRIPLE=riscv64-linux-gnu
+
+      - name: Build and Run - gcc
+        env:
+          QEMU_LD_PREFIX: /usr/riscv64-linux-gnu
+        run: |
+          cmake --build build/gcc --target libc-shared-tests

>From 2b9f585f90f20d71e724b32d237306686c659343 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Sun, 19 Apr 2026 08:08:43 +0800
Subject: [PATCH 2/4] Fix mpfr address.

---
 .github/workflows/libc-overlay-tests.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index 651f2249544db..014cbbf6e99ff 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -146,7 +146,7 @@ jobs:
       - name: Setup MPFR
         run: |
           cd build
-          wget https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.xz
+          wget https://www.mpfr.org/mpfr-4.2.1/mpfr-4.2.1.tar.xz
           tar -xf mpfr-4.2.1.tar.xz
           cd mpfr-4.2.1
           ./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu \

>From 267fa24c1c82b1be1d98789bcf569031b9280f3b Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Sun, 19 Apr 2026 08:18:45 +0800
Subject: [PATCH 3/4] Skip GMP and MPFR for now.

---
 .github/workflows/libc-overlay-tests.yml | 46 ++++++++++++------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index 014cbbf6e99ff..eab8d10ba9c43 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -131,29 +131,31 @@ jobs:
             libc6-dev-riscv64-cross libstdc++6-riscv64-cross \
             gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
 
-      - name: Setup GMP
-        run: |
-          mkdir build
-          cd build
-          wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz
-          tar -xf gmp-6.3.0.tar.xz
-          cd gmp-6.3.0
-          ./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu
-          make -j8
-          sudo make install
-          cd ../..
+      # TODO: Need to find a better way for GMP and MPFR instead of downloading
+      # and setting them up every time.
+      # - name: Setup GMP
+      #   run: |
+      #     mkdir build
+      #     cd build
+      #     wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz
+      #     tar -xf gmp-6.3.0.tar.xz
+      #     cd gmp-6.3.0
+      #     ./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu
+      #     make -j8
+      #     sudo make install
+      #     cd ../..
       
-      - name: Setup MPFR
-        run: |
-          cd build
-          wget https://www.mpfr.org/mpfr-4.2.1/mpfr-4.2.1.tar.xz
-          tar -xf mpfr-4.2.1.tar.xz
-          cd mpfr-4.2.1
-          ./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu \
-                      --with-gmp=/usr/riscv64-linux-gnu
-          make -j8
-          sudo make install
-          cd ../..
+      # - name: Setup MPFR
+      #   run: |
+      #     cd build
+      #     wget https://www.mpfr.org/mpfr-4.2.1/mpfr-4.2.1.tar.xz
+      #     tar -xf mpfr-4.2.1.tar.xz
+      #     cd mpfr-4.2.1
+      #     ./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu \
+      #                 --with-gmp=/usr/riscv64-linux-gnu
+      #     make -j8
+      #     sudo make install
+      #     cd ../..
       
       - name: Configure CMake - Clang
         run: |

>From 0881f5f6f57873ba05d9eabca94ee41e1e033de4 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Sun, 19 Apr 2026 08:23:16 +0800
Subject: [PATCH 4/4] Update targets.

---
 .github/workflows/libc-overlay-tests.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index eab8d10ba9c43..6c8d8488f5c02 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -166,11 +166,11 @@ jobs:
             -DCMAKE_BUILD_TYPE=Release \
             -DLIBC_TARGET_TRIPLE=riscv64-linux-gnu
 
-      - name: Build and Run - Clang
+      - name: Build and Test - Clang
         env:
           QEMU_LD_PREFIX: /usr/riscv64-linux-gnu
         run: |
-          cmake --build build/clang --target libc-shared-tests
+          cmake --build build/clang --target libc check-libc
 
       - name: Configure CMake - gcc
         run: |
@@ -185,4 +185,4 @@ jobs:
         env:
           QEMU_LD_PREFIX: /usr/riscv64-linux-gnu
         run: |
-          cmake --build build/gcc --target libc-shared-tests
+          cmake --build build/gcc --target libc check-libc



More information about the llvm-commits mailing list