diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9eb94b33..a6b83310 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v1 with: repository: sbcl/sbcl - ref: sbcl-2.4.5 + ref: sbcl-2.4.6 path: sbcl - name: install host sbcl run: | diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 21682fab..1715340b 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v1 with: repository: sbcl/sbcl - ref: ${{ matrix.arch == 'arm64' && 'sbcl-2.4.5' || 'x86-null-tn' }} + ref: ${{ matrix.arch == 'arm64' && 'sbcl-2.4.6' || 'x86-null-tn' }} path: sbcl - name: install host sbcl run: brew install sbcl diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9739dbc7..fcb31970 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -7,6 +7,12 @@ jobs: runs-on: windows-latest + timeout-minutes: 60 + strategy: + matrix: + cc: [gcc, clang] + fail-fast: false + defaults: run: shell: msys2 {0} @@ -16,11 +22,11 @@ jobs: - uses: actions/checkout@v1 with: repository: sbcl/sbcl - ref: sbcl-2.4.5 + ref: sbcl-2.4.6 path: sbcl - uses: msys2/setup-msys2@v2 with: - install: mingw-w64-x86_64-gcc make diffutils git python3 + install: mingw-w64-x86_64-gcc mingw-w64-x86_64-clang mingw-w64-x86_64-lld make diffutils git python3 dos2unix - name: install host sbcl shell: pwsh @@ -34,7 +40,9 @@ jobs: run: | PATH=$PATH:"/c/Program Files/Steel Bank Common Lisp/1.4.14" export PATH - ./make.sh --xc-host='sbcl --lose-on-corruption --disable-ldb --disable-debugger' --with-sb-linkable-runtime + dos2unix '${{ github.workspace }}\patches\win32-clang-build.patch' + if [ "clang" = "${{ matrix.cc }}" ]; then git apply --verbose '${{ github.workspace }}\patches\win32-clang-build.patch'; fi + CC=${{ matrix.cc }} ./make.sh --xc-host='sbcl --lose-on-corruption --disable-ldb --disable-debugger' --with-sb-linkable-runtime - name: install quicklisp working-directory: ../sbcl run: | @@ -48,8 +56,8 @@ jobs: MSYS2_PATH_TYPE: inherit run: | $SBCL_SRC/run-sbcl.sh --script script.lisp - gcc -Wall -fPIC -shared -Wl,--export-all-symbols -o libcalc.dll libcalc.c -Wl,--whole-archive $SBCL_SRC/src/runtime/libsbcl.a -Wl,--no-whole-archive -ladvapi32 -lsynchronization -lws2_32 -lzstd - gcc -Wall -o example example.c -lcalc -L. + ${{ matrix.cc }} -Wall -fPIC -shared -Wl,--export-all-symbols -o libcalc.dll libcalc.c -Wl,--whole-archive $SBCL_SRC/src/runtime/libsbcl.a -Wl,--no-whole-archive -ladvapi32 -lsynchronization -lws2_32 -lzstd + ${{ matrix.cc }} -Wall -o example example.c -lcalc -L. mv libcalc.dll $MSYSTEM_PREFIX/bin cp libcalc.core $MSYSTEM_PREFIX/bin echo "(+ 1 2)" | ./example.exe | tr -d '\r\n' | grep "> 3> " diff --git a/patches/win32-clang-build.patch b/patches/win32-clang-build.patch new file mode 100644 index 00000000..83971aba --- /dev/null +++ b/patches/win32-clang-build.patch @@ -0,0 +1,58 @@ +From 4a4dc050d49789e60ab3a71ea85502caf42755e4 Mon Sep 17 00:00:00 2001 +From: Kartik Singh +Date: Fri, 5 Jul 2024 14:22:35 -0700 +Subject: [PATCH] Support Clang + PDB on Windows + +--- + src/runtime/Config.x86-64-win32 | 18 ++++++++++++++++-- + src/runtime/hopscotch.c | 3 +-- + 2 files changed, 17 insertions(+), 4 deletions(-) + +diff --git a/src/runtime/Config.x86-64-win32 b/src/runtime/Config.x86-64-win32 +index 3c922ffd3..b2c75ddd0 100644 +--- a/src/runtime/Config.x86-64-win32 ++++ b/src/runtime/Config.x86-64-win32 +@@ -56,10 +56,24 @@ CFLAGS += -g -W -Wall \ + -Wno-unused-function -Wno-unused-parameter -Wno-cast-function-type \ + -Wno-type-limits \ + -fno-omit-frame-pointer \ +- -O5 -m64 -DWINVER=0x0501 \ ++ -O3 -m64 -DWINVER=0x0501 \ + -D__W32API_USE_DLLIMPORT__ + +-CC = gcc ++CC ?= gcc ++ ++ifeq ($(CC),clang) ++ifneq ($(shell ld.lld --version | head -n 1 | grep LLD),) ++LD=ld.lld ++CFLAGS += -fuse-ld=lld ++endif ++endif ++ ++ifeq ($(shell $(CC) -gcodeview 2>&1 | grep codeview),) ++ifeq ($(shell $(LD) -pdb= 2>&1 | grep -- -pdb=),) ++CFLAGS += -gcodeview ++LINKFLAGS += -Wl,-pdb= ++endif ++endif + + ifeq ($(shell $(LD) --disable-dynamicbase 2>&1 | grep disable-dynamicbase),) + LINKFLAGS += -Wl,--disable-dynamicbase +diff --git a/src/runtime/hopscotch.c b/src/runtime/hopscotch.c +index 0c8330d65..ccbb53ddc 100644 +--- a/src/runtime/hopscotch.c ++++ b/src/runtime/hopscotch.c +@@ -22,8 +22,7 @@ + #include + #include + #ifdef LISP_FEATURE_WIN32 +-/* I don't know where ffs() is prototyped */ +-extern int ffs(int); ++#define ffs(x) __builtin_ffs(x) + #else + /* https://www.freebsd.org/cgi/man.cgi?query=fls&sektion=3&manpath=FreeBSD+7.1-RELEASE + says strings.h */ +-- +2.32.1 (Apple Git-133) +