Skip to content

Commit db4cf0a

Browse files
committed
Add support for CLANGARM64 target
Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
1 parent 45a475a commit db4cf0a

File tree

3 files changed

+51
-2
lines changed

3 files changed

+51
-2
lines changed

.github/workflows/clang-build.yml

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

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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,9 @@ ifeq ($(uname_S),MINGW)
656656
USE_WIN32_IPC = YesPlease
657657
USE_WIN32_MMAP = YesPlease
658658
MMAP_PREVENTS_DELETE = UnfortunatelyYes
659-
USE_NED_ALLOCATOR = YesPlease
659+
ifneq (CLANGARM64,$(MSYSTEM))
660+
USE_NED_ALLOCATOR = YesPlease
661+
endif
660662
UNRELIABLE_FSTAT = UnfortunatelyYes
661663
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
662664
NO_REGEX = YesPlease
@@ -711,6 +713,10 @@ else
711713
prefix = /mingw64
712714
HOST_CPU = x86_64
713715
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
716+
else ifeq (CLANGARM64,$(MSYSTEM))
717+
prefix = /clangarm64
718+
HOST_CPU = aarch64
719+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
714720
else
715721
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
716722
BASIC_LDFLAGS += -Wl,--large-address-aware
@@ -726,7 +732,9 @@ else
726732
USE_GETTEXT_SCHEME = fallthrough
727733
USE_LIBPCRE = YesPlease
728734
NO_CURL =
729-
USE_NED_ALLOCATOR = YesPlease
735+
ifneq (CLANGARM64,$(MSYSTEM))
736+
USE_NED_ALLOCATOR = YesPlease
737+
endif
730738
NO_PYTHON =
731739
ifeq (/mingw64,$(subst 32,64,$(prefix)))
732740
# Move system config into top-level /etc/

0 commit comments

Comments
 (0)