Skip to content

Commit f84e833

Browse files
willieyzmkannwischer
authored andcommitted
Add cross tests for RISCV32
Signed-off-by: willieyz <willie.zhao@chelpis.com>
1 parent c9cf63c commit f84e833

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.github/actions/multi-functest/action.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ inputs:
2828
description: LDFLAGS to pass to linking
2929
default: ""
3030
compile_mode:
31-
description: all | native | cross-x86_64 | cross-aarch64 | cross-riscv64
31+
description: all | native | cross-x86_64 | cross-aarch64 | cross-riscv64 | cross-riscv32
3232
default: "native"
3333
opt:
3434
description: all | opt | no_opt
@@ -229,3 +229,24 @@ runs:
229229
examples: ${{ inputs.examples }}
230230
stack: ${{ inputs.stack }}
231231
extra_args: ${{ inputs.extra_args }}
232+
- name: Cross riscv32 Tests
233+
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-riscv32') && (success() || failure()) }}
234+
uses: ./.github/actions/functest
235+
with:
236+
nix-shell: ${{ inputs.nix-shell }}
237+
nix-cache: ${{ inputs.nix-cache }}
238+
nix-verbose: ${{ inputs.nix-verbose }}
239+
gh_token: ${{ inputs.gh_token }}
240+
custom_shell: ${{ inputs.custom_shell }}
241+
cflags: "${{ inputs.cflags }} -DMLD_FORCE_RISCV32"
242+
ldflags: ${{ inputs.ldflags }}
243+
cross_prefix: riscv32-unknown-linux-gnu-
244+
exec_wrapper: qemu-riscv32
245+
opt: ${{ inputs.opt }}
246+
func: ${{ inputs.func }}
247+
kat: ${{ inputs.kat }}
248+
acvp: ${{ inputs.acvp }}
249+
examples: ${{ inputs.examples }}
250+
stack: ${{ inputs.stack }}
251+
extra_args: ${{ inputs.extra_args }}
252+

mldsa/mldsa_native.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@
421421
#undef MLD_SYS_H
422422
#undef MLD_SYS_LITTLE_ENDIAN
423423
#undef MLD_SYS_PPC64LE
424+
#undef MLD_SYS_RISCV32
424425
#undef MLD_SYS_RISCV64
425426
#undef MLD_SYS_WINDOWS
426427
#undef MLD_SYS_X86_64

mldsa/src/sys.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
#define MLD_SYS_RISCV64
5151
#endif
5252

53+
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32
54+
#define MLD_SYS_RISCV32
55+
#endif
56+
5357
#if defined(_WIN64) || defined(_WIN32)
5458
#define MLD_SYS_WINDOWS
5559
#endif
@@ -80,6 +84,10 @@
8084
#error "MLD_FORCE_RISCV64 is set, but we don't seem to be on a RISCV64 system."
8185
#endif
8286

87+
#if defined(MLD_FORCE_RISCV32) && !defined(MLD_SYS_RISCV32)
88+
#error "MLD_FORCE_RISCV32 is set, but we don't seem to be on a RISCV32 system."
89+
#endif
90+
8391
/*
8492
* C90 does not have the inline compiler directive yet.
8593
* We don't use it in C90 builds.

0 commit comments

Comments
 (0)