Skip to content

Commit 1d497b1

Browse files
committed
CI: Integrate macOS/arm64
Specify using gcc-14 instead of gcc (which typically points to the latest version of gcc) due to a macOS limitation in the rlalik/setup-cpp-compiler@master action. According to [1], each gcc must have specified version. softfloat build warning error using gcc-14 with optimization flag O1: In file included from src/softfloat/source/include/internals.h:42, from src/softfloat/source/s_mulAddF64.c:40: In function 'softfloat_sub128', inlined from 'softfloat_mulAddF64' at src/softfloat/source/s_mulAddF64.c:185:17: src/softfloat/source/include/primitives.h:526:17: error: 'sig128C.v64' may be used uninitialized [-Werror=maybe-uninitialized] 526 | z.v64 = a64 - b64; | ~~~~^~~~~ src/softfloat/source/s_mulAddF64.c: In function 'softfloat_mulAddF64': src/softfloat/source/s_mulAddF64.c:66:20: note: 'sig128C.v64' was declared here 66 | struct uint128 sig128C; | ^~~~~~~ In function 'softfloat_sub128', inlined from 'softfloat_mulAddF64' at src/softfloat/source/s_mulAddF64.c:185:17: src/softfloat/source/include/primitives.h:527:18: error: 'sig128C.v0' may be used uninitialized [-Werror=maybe-uninitialized] 527 | z.v64 -= (a0 < b0); | ~~~~^~~~~ src/softfloat/source/s_mulAddF64.c: In function 'softfloat_mulAddF64': src/softfloat/source/s_mulAddF64.c:66:20: note: 'sig128C.v0' was declared here 66 | struct uint128 sig128C; Add -Wno-initialized to surpress them. Drop the undefined behavior test on macOS/arm64 using gcc-14, as its libsanitizer's configure.txt does not yet support it, check [2]. [1] https://github.com/rlalik/setup-cpp-compiler [2] https://github.com/iains/gcc-darwin-arm64/blob/master-wip-apple-si/ libsanitizer/configure.tgt Close #519
1 parent a4f8041 commit 1d497b1

File tree

2 files changed

+214
-3
lines changed

2 files changed

+214
-3
lines changed

.github/workflows/main.yml

Lines changed: 213 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ jobs:
266266
githubToken: ${{ github.token }}
267267
# No 'sudo' is available
268268
install: |
269-
apt update -qq
270-
apt install -yqq make git clang libsdl2-dev libsdl2-mixer-dev lsb-release wget software-properties-common gnupg bc
269+
apt-get update -q=2
270+
apt-get install -q=2 make git clang python3 python3-pip python3-venv libsdl2-dev libsdl2-mixer-dev lsb-release wget software-properties-common gnupg bc
271271
git config --global --add safe.directory ${{ github.workspace }}
272272
git config --global --add safe.directory ${{ github.workspace }}/src/softfloat
273273
git config --global --add safe.directory ${{ github.workspace }}/src/mini-gdbstub
274274
wget https://apt.llvm.org/llvm.sh
275275
chmod +x ./llvm.sh
276276
./llvm.sh 18
277-
# FIXME: gcc build fails on Aarch64/Linux hosts
277+
# FIXME: gcc build fails on Aarch64/Linux hosts
278278
env: |
279279
CC: clang-18
280280
# Append custom commands here
@@ -286,6 +286,216 @@ jobs:
286286
make ENABLE_JIT=1 clean && make ENABLE_EXT_A=0 ENABLE_JIT=1 check -j$(nproc)
287287
make ENABLE_JIT=1 clean && make ENABLE_EXT_F=0 ENABLE_JIT=1 check -j$(nproc)
288288
make ENABLE_JIT=1 clean && make ENABLE_EXT_C=0 ENABLE_JIT=1 check -j$(nproc)
289+
.ci/riscv-toolchain-install.sh && export PATH=$PWD/toolchain/bin:$PATH
290+
python3 -m venv venv
291+
. venv/bin/activate
292+
.ci/riscv-tests.sh
293+
294+
macOS-arm64:
295+
needs: [detect-code-related-file-changes]
296+
if: needs.detect-code-related-file-changes.outputs.has_code_related_changes == 'true'
297+
strategy:
298+
fail-fast: false
299+
matrix:
300+
compiler: [gcc-14, clang]
301+
runs-on: macos-latest # M1 chip
302+
steps:
303+
- uses: actions/checkout@v4
304+
- name: install-dependencies
305+
run: |
306+
brew install make dtc expect sdl2 sdl2_mixer bc e2fsprogs p7zip llvm@18 dcfldd
307+
.ci/riscv-toolchain-install.sh
308+
echo "${{ github.workspace }}/toolchain/bin" >> $GITHUB_PATH
309+
- name: Install compiler
310+
id: install_cc
311+
uses: rlalik/setup-cpp-compiler@master
312+
with:
313+
compiler: ${{ matrix.compiler }}
314+
- name: Symlink gcc-14 due to the default /usr/local/bin/gcc links to system's clang
315+
run: |
316+
ln -s /opt/homebrew/opt/gcc/bin/gcc-14 /usr/local/bin/gcc-14
317+
- name: fetch artifact first to reduce HTTP requests
318+
env:
319+
CC: ${{ steps.install_cc.outputs.cc }}
320+
run: |
321+
make artifact
322+
make ENABLE_SYSTEM=1 artifact
323+
make ENABLE_ARCH_TEST=1 artifact
324+
if: ${{ always() }}
325+
- name: default build with -g
326+
env:
327+
CC: ${{ steps.install_cc.outputs.cc }}
328+
run: |
329+
make distclean
330+
make OPT_LEVEL=-g -j$(sysctl -n hw.logicalcpu)
331+
if: ${{ always() }}
332+
- name: default build with -Og
333+
env:
334+
CC: ${{ steps.install_cc.outputs.cc }}
335+
run: |
336+
make distclean
337+
make OPT_LEVEL=-Og -j$(sysctl -n hw.logicalcpu)
338+
if: ${{ always() }}
339+
- name: default build with -O0
340+
env:
341+
CC: ${{ steps.install_cc.outputs.cc }}
342+
run: |
343+
make distclean
344+
make OPT_LEVEL=-O0 -j$(sysctl -n hw.logicalcpu)
345+
if: ${{ always() }}
346+
- name: default build with -O1
347+
env:
348+
CC: ${{ steps.install_cc.outputs.cc }}
349+
run: |
350+
make distclean
351+
make OPT_LEVEL=-O1 -j$(sysctl -n hw.logicalcpu)
352+
if: ${{ always() }}
353+
- name: default build with -O2
354+
env:
355+
CC: ${{ steps.install_cc.outputs.cc }}
356+
run: |
357+
make distclean
358+
make OPT_LEVEL=-O2 -j$(sysctl -n hw.logicalcpu)
359+
if: ${{ always() }}
360+
- name: default build with -O3
361+
env:
362+
CC: ${{ steps.install_cc.outputs.cc }}
363+
run: |
364+
make distclean
365+
make OPT_LEVEL=-O3 -j$(sysctl -n hw.logicalcpu)
366+
if: ${{ always() }}
367+
- name: default build with -Ofast
368+
env:
369+
CC: ${{ steps.install_cc.outputs.cc }}
370+
run: |
371+
make distclean
372+
make OPT_LEVEL=-Ofast -j$(sysctl -n hw.logicalcpu)
373+
if: ${{ always() }}
374+
- name: default build for system emulation with -g
375+
env:
376+
CC: ${{ steps.install_cc.outputs.cc }}
377+
run: |
378+
make distclean
379+
make OPT_LEVEL=-g ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu)
380+
if: ${{ always() }}
381+
- name: default build for system emulation with -Og
382+
env:
383+
CC: ${{ steps.install_cc.outputs.cc }}
384+
run: |
385+
make distclean
386+
make OPT_LEVEL=-Og ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu)
387+
if: ${{ always() }}
388+
- name: default build for system emulation with -O0
389+
env:
390+
CC: ${{ steps.install_cc.outputs.cc }}
391+
run: |
392+
make distclean
393+
make OPT_LEVEL=-O0 ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu)
394+
if: ${{ always() }}
395+
- name: default build for system emulation with -O1
396+
env:
397+
CC: ${{ steps.install_cc.outputs.cc }}
398+
run: |
399+
make distclean
400+
make OPT_LEVEL=-O1 ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu)
401+
if: ${{ always() }}
402+
- name: default build for system emulation with -O2
403+
env:
404+
CC: ${{ steps.install_cc.outputs.cc }}
405+
run: |
406+
make distclean
407+
make OPT_LEVEL=-O2 ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu)
408+
if: ${{ always() }}
409+
- name: default build for system emulation with -O3
410+
env:
411+
CC: ${{ steps.install_cc.outputs.cc }}
412+
run: |
413+
make distclean
414+
make OPT_LEVEL=-O3 ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu)
415+
if: ${{ always() }}
416+
- name: default build for system emulation with -Ofast
417+
env:
418+
CC: ${{ steps.install_cc.outputs.cc }}
419+
run: |
420+
make distclean
421+
make OPT_LEVEL=-Ofast ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu)
422+
if: ${{ always() }}
423+
- name: check + tests
424+
env:
425+
CC: ${{ steps.install_cc.outputs.cc }}
426+
run: |
427+
make distclean
428+
make check -j$(sysctl -n hw.logicalcpu)
429+
make tests -j$(sysctl -n hw.logicalcpu)
430+
make misalign -j$(sysctl -n hw.logicalcpu)
431+
make tool -j$(sysctl -n hw.logicalcpu)
432+
if: ${{ always() }}
433+
- name: diverse configurations
434+
env:
435+
CC: ${{ steps.install_cc.outputs.cc }}
436+
run: |
437+
make distclean && make ENABLE_EXT_M=0 check -j$(sysctl -n hw.logicalcpu)
438+
make distclean && make ENABLE_EXT_A=0 check -j$(sysctl -n hw.logicalcpu)
439+
make distclean && make ENABLE_EXT_F=0 check -j$(sysctl -n hw.logicalcpu)
440+
make distclean && make ENABLE_EXT_C=0 check -j$(sysctl -n hw.logicalcpu)
441+
make distclean && make ENABLE_SDL=0 check -j$(sysctl -n hw.logicalcpu)
442+
make distclean && make ENABLE_Zicsr=0 check -j$(sysctl -n hw.logicalcpu)
443+
make distclean && make ENABLE_MOP_FUSION=0 check -j$(sysctl -n hw.logicalcpu)
444+
make distclean && make ENABLE_BLOCK_CHAINING=0 check -j$(sysctl -n hw.logicalcpu)
445+
make distclean && make ENABLE_Zba=0 check -j$(sysctl -n hw.logicalcpu)
446+
make distclean && make ENABLE_Zbb=0 check -j$(sysctl -n hw.logicalcpu)
447+
make distclean && make ENABLE_Zbc=0 check -j$(sysctl -n hw.logicalcpu)
448+
make distclean && make ENABLE_Zbs=0 check -j$(sysctl -n hw.logicalcpu)
449+
make distclean && make ENABLE_Zifencei=0 check -j$(sysctl -n hw.logicalcpu)
450+
if: ${{ always() }}
451+
- name: gdbstub test, need RV32 toolchain
452+
env:
453+
CC: ${{ steps.install_cc.outputs.cc }}
454+
run: |
455+
make distclean && make ENABLE_GDBSTUB=1 gdbstub-test -j$(sysctl -n hw.logicalcpu)
456+
if: ${{ always() }}
457+
- name: JIT test
458+
env:
459+
CC: ${{ steps.install_cc.outputs.cc }}
460+
run: |
461+
make ENABLE_JIT=1 clean && make ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
462+
make ENABLE_JIT=1 clean && make ENABLE_EXT_A=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
463+
make ENABLE_JIT=1 clean && make ENABLE_EXT_F=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
464+
make ENABLE_JIT=1 clean && make ENABLE_EXT_C=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
465+
make ENABLE_JIT=1 clean && make ENABLE_EXT_M=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
466+
make ENABLE_JIT=1 clean && make ENABLE_Zba=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
467+
make ENABLE_JIT=1 clean && make ENABLE_Zbb=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
468+
make ENABLE_JIT=1 clean && make ENABLE_Zbc=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
469+
make ENABLE_JIT=1 clean && make ENABLE_Zbs=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
470+
make ENABLE_JIT=1 clean && make ENABLE_Zicsr=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
471+
make ENABLE_JIT=1 clean && make ENABLE_Zifencei=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
472+
make ENABLE_JIT=1 clean && make ENABLE_MOP_FUSION=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
473+
make ENABLE_JIT=1 clean && make ENABLE_BLOCK_CHAINING=0 ENABLE_JIT=1 check -j$(sysctl -n hw.logicalcpu)
474+
if: ${{ always() }}
475+
- name: undefined behavior test
476+
env:
477+
CC: ${{ steps.install_cc.outputs.cc }}
478+
if: ${{ env.CC == 'clang' && always() }} # gcc on macOS/arm64 does not support satinizers
479+
run: |
480+
make distclean && make ENABLE_UBSAN=1 check -j$(sysctl -n hw.logicalcpu)
481+
make ENABLE_JIT=1 clean && make ENABLE_JIT=1 ENABLE_UBSAN=1 check -j$(sysctl -n hw.logicalcpu)
482+
- name: boot Linux kernel test
483+
env:
484+
CC: ${{ steps.install_cc.outputs.cc }}
485+
run: |
486+
make distclean && make INITRD_SIZE=32 ENABLE_SYSTEM=1 -j$(sysctl -n hw.logicalcpu) && \
487+
make ENABLE_SYSTEM=1 artifact -j$(sysctl -n hw.logicalcpu)
488+
.ci/boot-linux.sh
489+
make ENABLE_SYSTEM=1 clean
490+
if: ${{ always() }}
491+
- name: Architecture test
492+
env:
493+
CC: ${{ steps.install_cc.outputs.cc }}
494+
run: |
495+
python3 -m venv venv
496+
. venv/bin/activate
497+
.ci/riscv-tests.sh
498+
if: ${{ always() }}
289499

290500
coding-style:
291501
needs: [detect-code-related-file-changes]

mk/softfloat.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CFLAGS_softfloat := \
66
-Wno-unused-variable \
77
-Wno-sign-compare \
88
-Wno-implicit-fallthrough \
9+
-Wno-uninitialized \
910
-I$(SOFTFLOAT_DIR)/RISCV \
1011
-I$(SOFTFLOAT_DIR)/include
1112

0 commit comments

Comments
 (0)