Skip to content

Commit

Permalink
Some clangarm64 fixes (git-for-windows#5439)
Browse files Browse the repository at this point in the history
Most notably, this fixes
git-for-windows#5431, i.e. that the ARM64
flavor of Git for Windows does not use `/etc/gitconfig` by mistake, but
`/clangarm64/etc/gitconfig` instead.

My original intention was to fix only that issue, but when I fired up a
Git for Windows/ARM64 SDK and tried to build, I immediately ran into
trouble, then noticed places where ARM64 was not yet handled, and one
thing led to another and now it's a 6-patch PR instead of a single-patch
one.
  • Loading branch information
dscho authored Feb 26, 2025
2 parents 3003038 + d16eadf commit ba6e4aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
15 changes: 15 additions & 0 deletions compat/win32/fscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ struct fsentry {
};
#pragma GCC diagnostic pop

#pragma GCC diagnostic push
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wflexible-array-extensions"
#endif
struct heap_fsentry {
union {
struct fsentry ent;
char dummy[sizeof(struct fsentry) + MAX_LONG_PATH];
} u;
};
#pragma GCC diagnostic pop

/*
* Compares the paths of two fsentry structures for equality.
Expand Down Expand Up @@ -596,7 +601,12 @@ void fscache_flush(void)
int fscache_lstat(const char *filename, struct stat *st)
{
int dirlen, base, len;
#pragma GCC diagnostic push
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wflexible-array-extensions"
#endif
struct heap_fsentry key[2];
#pragma GCC diagnostic pop
struct fsentry *fse;
struct fscache *cache = fscache_getcache();

Expand Down Expand Up @@ -659,7 +669,12 @@ int fscache_lstat(const char *filename, struct stat *st)
int fscache_is_mount_point(struct strbuf *path)
{
int dirlen, base, len;
#pragma GCC diagnostic push
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wflexible-array-extensions"
#endif
struct heap_fsentry key[2];
#pragma GCC diagnostic pop
struct fsentry *fse;
struct fscache *cache = fscache_getcache();

Expand Down
20 changes: 9 additions & 11 deletions config.mak.uname
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,11 @@ ifeq ($(uname_S),Windows)
ifeq (MINGW32,$(MSYSTEM))
prefix = /mingw32
else
prefix = /mingw64
ifeq (CLANGARM64,$(MSYSTEM))
prefix = /clangarm64
else
prefix = /mingw64
endif
endif
# Prepend MSVC 64-bit tool-chain to PATH.
#
Expand Down Expand Up @@ -486,7 +490,7 @@ ifeq ($(uname_S),Windows)
NATIVE_CRLF = YesPlease
DEFAULT_HELP_FORMAT = html
SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
ifeq (/mingw64,$(subst 32,64,$(prefix)))
ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
# Move system config into top-level /etc/
ETC_GITCONFIG = ../etc/gitconfig
ETC_GITATTRIBUTES = ../etc/gitattributes
Expand Down Expand Up @@ -724,8 +728,7 @@ ifeq ($(uname_S),MINGW)
prefix = /mingw32
HOST_CPU = i686
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
endif
ifeq (MINGW64,$(MSYSTEM))
else ifeq (MINGW64,$(MSYSTEM))
prefix = /mingw64
HOST_CPU = x86_64
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
Expand All @@ -749,17 +752,12 @@ ifeq ($(uname_S),MINGW)
USE_LIBPCRE = YesPlease
USE_MIMALLOC = YesPlease
NO_PYTHON =
ifeq (/mingw64,$(subst 32,64,$(prefix)))
ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
# Move system config into top-level /etc/
ETC_GITCONFIG = ../etc/gitconfig
ETC_GITATTRIBUTES = ../etc/gitattributes
endif
ifeq (i686,$(uname_M))
MINGW_PREFIX := mingw32
endif
ifeq (x86_64,$(uname_M))
MINGW_PREFIX := mingw64
endif
MINGW_PREFIX := $(subst /,,$(prefix))

DESTDIR_WINDOWS = $(shell cygpath -aw '$(DESTDIR_SQ)')
DESTDIR_MIXED = $(shell cygpath -am '$(DESTDIR_SQ)')
Expand Down

0 comments on commit ba6e4aa

Please sign in to comment.