Skip to content

Commit ef48409

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 78bd52b commit ef48409

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

0 commit comments

Comments
 (0)