Skip to content

Commit ee45625

Browse files
committed
Apply patch to build for ARM64
1 parent 674867e commit ee45625

File tree

11 files changed

+125
-37
lines changed

11 files changed

+125
-37
lines changed

compat/zlib/win64-arm/zdll.lib

16.3 KB
Binary file not shown.

generic/tclTest.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static Tcl_NRPostProc NREUnwind_callback;
326326
static Tcl_ObjCmdProc TestNREUnwind;
327327
static Tcl_ObjCmdProc TestNRELevels;
328328
static Tcl_ObjCmdProc TestInterpResolverCmd;
329-
#if defined(HAVE_CPUID) || defined(_WIN32)
329+
#if defined(HAVE_CPUID)
330330
static Tcl_ObjCmdProc TestcpuidCmd;
331331
#endif
332332

@@ -600,7 +600,7 @@ Tcltest_Init(
600600
NULL, NULL);
601601
Tcl_CreateCommand(interp, "testexitmainloop", TestexitmainloopCmd,
602602
NULL, NULL);
603-
#if defined(HAVE_CPUID) || defined(_WIN32)
603+
#if defined(HAVE_CPUID)
604604
Tcl_CreateObjCommand(interp, "testcpuid", TestcpuidCmd,
605605
NULL, NULL);
606606
#endif
@@ -6951,7 +6951,7 @@ TestFindLastCmd(
69516951
return TCL_OK;
69526952
}
69536953

6954-
#if defined(HAVE_CPUID) || defined(_WIN32)
6954+
#if defined(HAVE_CPUID)
69556955
/*
69566956
*----------------------------------------------------------------------
69576957
*

tests/env.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ variable keep {
102102
SHLIB_PATH SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH
103103
DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING MSYSTEM
104104
__CF_USER_TEXT_ENCODING SECURITYSESSIONID LANG WINDIR TERM
105-
CommonProgramFiles ProgramFiles CommonProgramW6432 ProgramW6432
105+
CommonProgramFiles CommonProgramFiles(x86) ProgramFiles
106+
ProgramFiles(x86) CommonProgramW6432 ProgramW6432
107+
WINECONFIGDIR WINEDATADIR WINEDLLDIR0 WINEHOMEDIR PROCESSOR_ARCHITECTURE
106108
}
107109

108110
variable printenvScript [makeFile [string map [list @keep@ [list $keep]] {

win/Makefile.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,11 @@ ${TEST_EXE_FILE}: ${TCL_STUB_LIB_FILE} ${TCLTEST_OBJS} tclTestMain.${OBJEXT}
519519

520520
# use pre-built zlib1.dll
521521
${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE}
522-
@if test "@ZLIB_LIBS@set" != "${ZLIB_DIR_NATIVE}/win32/zdll.libset" ; then \
522+
@if test "@ZLIB_LIBS@set" = "${ZLIB_DIR_NATIVE}/win64-arm/zdll.libset" ; then \
523+
$(COPY) $(ZLIB_DIR)/win64-arm/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \
524+
elif test "@ZLIB_LIBS@set" = "${ZLIB_DIR_NATIVE}/win64-arm/libz.dll.aset" ; then \
525+
$(COPY) $(ZLIB_DIR)/win64-arm/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \
526+
elif test "@ZLIB_LIBS@set" = "${ZLIB_DIR_NATIVE}/win32/zdll.libset" ; then \
523527
$(COPY) $(ZLIB_DIR)/win64/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \
524528
else \
525529
$(COPY) $(ZLIB_DIR)/win32/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \

win/configure

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3279,7 +3279,7 @@ fi
32793279
SHLIB_SUFFIX=".dll"
32803280
32813281
# MACHINE is IX86 for LINK, but this is used by the manifest,
3282-
# which requires x86|amd64|ia64.
3282+
# which requires x86|amd64|arm64|ia64.
32833283
MACHINE="X86"
32843284
32853285
if test "$GCC" = "yes"; then
@@ -3352,6 +3352,13 @@ echo "${ECHO_T}$ac_cv_cross" >&6
33523352
RANLIB="x86_64-w64-mingw32-ranlib"
33533353
RC="x86_64-w64-mingw32-windres"
33543354
;;
3355+
arm64|aarch64)
3356+
CC="aarch64-w64-mingw32-${CC}"
3357+
LD="aarch64-w64-mingw32-ld"
3358+
AR="aarch64-w64-mingw32-ar"
3359+
RANLIB="aarch64-w64-mingw32-ranlib"
3360+
RC="aarch64-w64-mingw32-windres"
3361+
;;
33553362
*)
33563363
CC="i686-w64-mingw32-${CC}"
33573364
LD="i686-w64-mingw32-ld"
@@ -3470,6 +3477,9 @@ echo "${ECHO_T}$ac_cv_win32" >&6
34703477
echo "$as_me: error: ${CC} cannot produce win32 executables." >&2;}
34713478
{ (exit 1); exit 1; }; }
34723479
fi
3480+
if test "$MACHINE" != "ARM64"; then
3481+
extra_cflags="$extra_cflags -DHAVE_CPUID=1"
3482+
fi
34733483
34743484
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain"
34753485
echo "$as_me:$LINENO: checking for working -municode linker flag" >&5
@@ -3702,10 +3712,15 @@ echo "$as_me: error: ${CC} does not support the -shared option.
37023712
echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
37033713
echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
37043714
;;
3715+
arm64|aarch64)
3716+
MACHINE="ARM64"
3717+
echo "$as_me:$LINENO: result: Using ARM64 $MACHINE mode" >&5
3718+
echo "${ECHO_T} Using ARM64 $MACHINE mode" >&6
3719+
;;
37053720
ia64)
37063721
MACHINE="IA64"
3707-
echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
3708-
echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
3722+
echo "$as_me:$LINENO: result: Using IA64 $MACHINE mode" >&5
3723+
echo "${ECHO_T} Using IA64 $MACHINE mode" >&6
37093724
;;
37103725
*)
37113726
cat >conftest.$ac_ext <<_ACEOF
@@ -3759,9 +3774,9 @@ tcl_win_64bit=no
37593774
fi
37603775
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
37613776
if test "$tcl_win_64bit" = "yes" ; then
3762-
do64bit=amd64
3763-
MACHINE="AMD64"
3764-
echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
3777+
do64bit=amd64
3778+
MACHINE="AMD64"
3779+
echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
37653780
echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
37663781
fi
37673782
;;
@@ -3802,6 +3817,9 @@ echo "${ECHO_T}using shared flags" >&6
38023817
amd64|x64|yes)
38033818
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
38043819
;;
3820+
arm64|aarch64)
3821+
MACHINE="ARM64"
3822+
;;
38053823
ia64)
38063824
MACHINE="IA64"
38073825
;;
@@ -3823,8 +3841,7 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
38233841
if test "$do64bit" != "no" ; then
38243842
RC="rc"
38253843
CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
3826-
# Do not use -O2 for Win64 - this has proved buggy in code gen.
3827-
CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
3844+
CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
38283845
lflags="${lflags} -nologo -MACHINE:${MACHINE}"
38293846
LINKBIN="link"
38303847
# Avoid 'unresolved external symbol __security_cookie' errors.
@@ -4317,14 +4334,34 @@ if test "$tcl_ok" = "yes"; then
43174334
43184335
if test "$do64bit" != "no"; then
43194336
4320-
if test "$GCC" == "yes"; then
4337+
if test "$do64bit" = "arm64"; then
4338+
4339+
if test "$GCC" == "yes"; then
43214340
4322-
ZLIB_LIBS=\${ZLIB_DIR_NATIVE}/win64/libz.dll.a
4341+
ZLIB_LIBS=\${ZLIB_DIR_NATIVE}/win64-arm/libz.dll.a
43234342
43244343
43254344
else
43264345
4327-
ZLIB_LIBS=\${ZLIB_DIR_NATIVE}/win64/zdll.lib
4346+
ZLIB_LIBS=\${ZLIB_DIR_NATIVE}/win64-arm/zdll.lib
4347+
4348+
4349+
fi
4350+
4351+
4352+
else
4353+
4354+
if test "$GCC" == "yes"; then
4355+
4356+
ZLIB_LIBS=\${ZLIB_DIR_NATIVE}/win64/libz.dll.a
4357+
4358+
4359+
else
4360+
4361+
ZLIB_LIBS=\${ZLIB_DIR_NATIVE}/win64/zdll.lib
4362+
4363+
4364+
fi
43284365
43294366
43304367
fi
@@ -5208,7 +5245,7 @@ case "$TCL_PATCH_LEVEL" in
52085245
esac
52095246
TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d ab.`"
52105247
5211-
# X86|AMD64|IA64 for manifest
5248+
# X86|AMD64|ARM64|IA64 for manifest
52125249
52135250
52145251

win/configure.in

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,18 @@ AS_IF([test "${enable_shared+set}" = "set"], [
144144
AS_IF([test "$tcl_ok" = "yes"], [
145145
AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}])
146146
AS_IF([test "$do64bit" != "no"], [
147-
AS_IF([test "$GCC" == "yes"],[
148-
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/libz.dll.a])
147+
AS_IF([test "$do64bit" = "arm64"], [
148+
AS_IF([test "$GCC" == "yes"],[
149+
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64-arm/libz.dll.a])
150+
], [
151+
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64-arm/zdll.lib])
152+
])
149153
], [
150-
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/zdll.lib])
154+
AS_IF([test "$GCC" == "yes"],[
155+
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/libz.dll.a])
156+
], [
157+
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/zdll.lib])
158+
])
151159
])
152160
], [
153161
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win32/zdll.lib])
@@ -375,7 +383,7 @@ case "$TCL_PATCH_LEVEL" in
375383
esac
376384
TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d ab.`"
377385
AC_SUBST(TCL_WIN_VERSION)
378-
# X86|AMD64|IA64 for manifest
386+
# X86|AMD64|ARM64|IA64 for manifest
379387
AC_SUBST(MACHINE)
380388

381389
AC_SUBST(TCL_VERSION)

win/makefile.vc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
# nodep = Turns off compatibility macros to ensure the core
9898
# isn't being built with deprecated functions.
9999
#
100-
# MACHINE=(ALPHA|AMD64|IA64|IX86)
100+
# MACHINE=(ALPHA|AMD64|ARM64|IA64|IX86)
101101
# Set the machine type used for the compiler, linker, and
102102
# resource compiler. This hook is needed to tell the tools
103103
# when alternate platforms are requested. IX86 is the default
@@ -911,6 +911,7 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata
911911
@$(CPY) "$(WIN_DIR)\tclooConfig.sh" "$(LIB_INSTALL_DIR)\"
912912
@$(CPY) "$(WIN_DIR)\rules.vc" "$(LIB_INSTALL_DIR)\nmake\"
913913
@$(CPY) "$(WIN_DIR)\targets.vc" "$(LIB_INSTALL_DIR)\nmake\"
914+
@$(CPY) "$(WIN_DIR)\x86_64-w64-mingw32-nmakehlp.exe" "$(LIB_INSTALL_DIR)\nmake\"
914915
@$(CPY) "$(WIN_DIR)\nmakehlp.c" "$(LIB_INSTALL_DIR)\nmake\"
915916
@$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\"
916917
@echo Installing package http 1.0 (obsolete)

win/rules.vc

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _RULES_VC = 1
2424
# For modifications that are not backward-compatible, you *must* change
2525
# the major version.
2626
RULES_VERSION_MAJOR = 1
27-
RULES_VERSION_MINOR = 9
27+
RULES_VERSION_MINOR = 10
2828

2929
# The PROJECT macro must be defined by parent makefile.
3030
!if "$(PROJECT)" == ""
@@ -411,8 +411,8 @@ _INSTALLDIR=$(_INSTALLDIR)\lib
411411
# compiler version 1200. This is kept only for legacy reasons as it
412412
# does not make sense for recent Microsoft compilers. Only used for
413413
# output directory names.
414-
# ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target
415-
# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
414+
# ARCH - set to IX86, ARM64 or AMD64 depending on 32- or 64-bit target
415+
# NATIVE_ARCH - set to IX86, ARM64 or AMD64 for the host machine
416416
# MACHINE - same as $(ARCH) - legacy
417417
# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
418418

@@ -435,6 +435,8 @@ VCVER=0
435435
&& ![echo ARCH=IX86 >> vercl.x] \
436436
&& ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
437437
&& ![echo ARCH=AMD64 >> vercl.x] \
438+
&& ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \
439+
&& ![echo ARCH=ARM64 >> vercl.x] \
438440
&& ![echo $(_HASH)endif >> vercl.x] \
439441
&& ![$(cc32) -nologo -TC -P vercl.x 2>NUL]
440442
!include vercl.i
@@ -459,6 +461,9 @@ VCVER = $(VCVERSION)
459461
!if "$(MACHINE)" == "x86"
460462
!undef MACHINE
461463
MACHINE = IX86
464+
!elseif "$(MACHINE)" == "arm64"
465+
!undef MACHINE
466+
MACHINE = ARM64
462467
!elseif "$(MACHINE)" == "x64"
463468
!undef MACHINE
464469
MACHINE = AMD64
@@ -475,6 +480,8 @@ MACHINE=$(ARCH)
475480
# the Tcl platform::identify command
476481
!if "$(MACHINE)" == "AMD64"
477482
PLATFORM_IDENTIFY = win32-x86_64
483+
!elseif "$(MACHINE)" == "ARM64"
484+
PLATFORM_IDENTIFY = win32-arm
478485
!else
479486
PLATFORM_IDENTIFY = win32-ix86
480487
!endif
@@ -490,6 +497,8 @@ MULTIPLATFORM_INSTALL = 0
490497

491498
!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
492499
NATIVE_ARCH=IX86
500+
!elseif ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i ARM | findstr /i 64-bit]
501+
NATIVE_ARCH=ARM64
493502
!else
494503
NATIVE_ARCH=AMD64
495504
!endif
@@ -539,10 +548,16 @@ NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
539548

540549
!endif # NMAKEHLPC
541550

551+
542552
# We always build nmakehlp even if it exists since we do not know
543553
# what source it was built from.
554+
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
544555
!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
545556
!endif
557+
!else
558+
!if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL]
559+
!endif
560+
!endif
546561

547562
################################################################
548563
# 5. Test for compiler features
@@ -1476,6 +1491,11 @@ carch = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
14761491
carch =
14771492
!endif
14781493

1494+
# cpuid is only available on intel machines
1495+
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "AMD64"
1496+
carch = $(carch) /DHAVE_CPUID=1
1497+
!endif
1498+
14791499
!if $(DEBUG)
14801500
# Turn warnings into errors
14811501
cwarn = $(cwarn) -WX

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy