Skip to content

Commit 4ed0692

Browse files
ViralBShahclaude
andcommitted
add CI coverage for the RISC-V single-float ABI (#262)
The lp64f / ilp32f ABI used to be rejected by openlibm_fenv_riscv.h with an #error. Add a compile-only cross job that rebuilds the static library with -mabi=lp64f so the removed #error stays removed. A full lp64f shared-lib link or qemu run is impossible because Ubuntu's gcc-riscv64-linux-gnu ships only the lp64d sysroot; the static archive needs no libc link, so it still compiles riscv64/fenv.c (and every other source) under the single-float ABI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1022929 commit 4ed0692

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/cross.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,35 @@ jobs:
6363
QEMU_LD_PREFIX: /usr/${{ matrix.config.triple }}
6464
LD_LIBRARY_PATH: .
6565
run: make test
66+
67+
# Regression test for #262 / #349: the RISC-V single-float ABI (lp64f /
68+
# ilp32f) used to be rejected by include/openlibm_fenv_riscv.h with an
69+
# `#error`. This job rebuilds the whole library with `-mabi=lp64f` to make
70+
# sure the header (and the rest of openlibm) accepts that ABI.
71+
#
72+
# This is a COMPILE-ONLY check (build the static libopenlibm.a, no qemu run).
73+
# Ubuntu's gcc-riscv64-linux-gnu ships only the default lp64d sysroot, so a
74+
# full shared-library link or a qemu execution under lp64f is impossible
75+
# without a custom single-float sysroot the distro does not provide. Building
76+
# the static archive needs no libc/CRT link, so it compiles every source file
77+
# (including riscv64/fenv.c, which pulls in the fixed header) under the
78+
# single-float ABI and directly regresses the removed `#error`. Adding a
79+
# bespoke lp64f sysroot would be exactly the kind of fragile, unmaintainable
80+
# toolchain dependency that got mips64 disabled in #347, so we deliberately
81+
# avoid it.
82+
build-cross-riscv64-lp64f:
83+
runs-on: ubuntu-24.04
84+
timeout-minutes: 10
85+
name: build-cross-riscv64-lp64f
86+
steps:
87+
- uses: actions/checkout@v7
88+
- name: Install RISC-V toolchain
89+
run: |
90+
sudo apt update
91+
sudo apt install -y gcc-riscv64-linux-gnu
92+
- name: Build libopenlibm.a for the single-float ABI (lp64f)
93+
run: |
94+
make -j$(nproc) ARCH=riscv64 TOOLPREFIX=riscv64-linux-gnu- \
95+
CFLAGS_arch='-march=rv64imafc -mabi=lp64f' \
96+
SFLAGS_arch='-march=rv64imafc -mabi=lp64f' \
97+
libopenlibm.a

0 commit comments

Comments
 (0)