Skip to content

Commit 9eae59e

Browse files
committed
Add support for CLANGARM64 target
Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
1 parent 6b74337 commit 9eae59e

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

.github/workflows/clang-build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CLANG build
2+
3+
on:
4+
workflow_dispatch:
5+
6+
defaults:
7+
run:
8+
shell: bash
9+
10+
jobs:
11+
clang-build:
12+
runs-on: [Windows, ARM64]
13+
env:
14+
NO_PERL: 1
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: dennisameling/setup-git-for-windows-sdk@01872063f7b133eae0732176f08e309a69c22b4d
18+
with:
19+
flavor: full
20+
architecture: aarch64
21+
- name: Add clangarm64 server
22+
run: |
23+
cat <<EOF >> /etc/pacman.conf
24+
[clangarm64]
25+
Server = https://mirror.msys2.org/mingw/clangarm64/
26+
EOF
27+
pacman -Sy
28+
- name: Install packages
29+
# The clangarm64 folder is missing in the Git for Windows SDK, so let's create it
30+
run: |
31+
mkdir -p /clangarm64
32+
pacman -S --noconfirm base-devel mingw-w64-clang-aarch64-openssl mingw-w64-clang-aarch64-zlib \
33+
mingw-w64-clang-aarch64-curl mingw-w64-clang-aarch64-expat \
34+
mingw-w64-clang-aarch64-libiconv mingw-w64-clang-aarch64-toolchain \
35+
mingw-w64-clang-aarch64-pcre2 mingw-w64-clang-aarch64-libssp
36+
- name: Build Git CLANGARM64
37+
run: make -j`nproc`

compat/bswap.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ static inline uint64_t git_bswap64(uint64_t x)
7474
}
7575
#endif
7676

77+
/* available since Clang 12 and GCC 10, i.a. needed for ARM64/aarch64 on Windows */
78+
#elif defined(__has_builtin) && __has_builtin(__builtin_bswap64)
79+
80+
#define bswap32(x) __builtin_bswap32((x))
81+
#define bswap64(x) __builtin_bswap64((x))
82+
7783
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))
7884

7985
#include <stdlib.h>

config.mak.uname

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,10 @@ else
711711
prefix = /mingw64
712712
HOST_CPU = x86_64
713713
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
714+
else ifeq (CLANGARM64,$(MSYSTEM))
715+
prefix = /clangarm64
716+
HOST_CPU = aarch64
717+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
714718
else
715719
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
716720
BASIC_LDFLAGS += -Wl,--large-address-aware

0 commit comments

Comments
 (0)