[SDK] Allow ARM64 MSVC to complete configuration (#4045)

- Add some of the missing CMake adjustments to continue the configure and compile process with ARM64 MSVC
- Created quick stubs for the functions in SDK needed to finish the configuration process
- Put in an ARM64 option for spec2def

CORE-17518 CORE-17615
This commit is contained in:
Justin Miller 2021-10-22 08:52:32 -07:00 committed by GitHub
parent 4b0249e98a
commit be223b9de7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 64 additions and 6 deletions

View file

@ -267,6 +267,9 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
if(SARCH STREQUAL "omap3-zoom2")
add_definitions(-D_ZOOM2_)
endif()
elseif(ARCH STREQUAL "arm64")
# GNU tools refer to arm64 as aarch64
add_definitions(-D_ARM64_ -D__arm64__ -D__aarch64__ -D_WIN64)
endif()
# Other

View file

@ -256,6 +256,8 @@ function(set_subsystem MODULE SUBSYSTEM)
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},5.02")
elseif(ARCH STREQUAL "arm")
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.02")
elseif(ARCH STREQUAL "arm64")
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},6.04")
else()
target_link_options(${MODULE} PRIVATE "/SUBSYSTEM:${_subsystem},5.01")
endif()
@ -363,6 +365,9 @@ if(ARCH STREQUAL "amd64")
elseif(ARCH STREQUAL "arm")
add_definitions(/D__arm__)
set(SPEC2DEF_ARCH arm)
elseif(ARCH STREQUAL "arm64")
add_definitions(/D__arm64__)
set(SPEC2DEF_ARCH arm64)
else()
set(SPEC2DEF_ARCH i386)
endif()
@ -440,7 +445,7 @@ function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_addres
COMMAND ${CMAKE_C_COMPILER} /nologo ${_no_std_includes_flag} /I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm ${_includes} ${_defines} /D__ASM__ /D_USE_ML /EP /c ${_asm_file} > ${_temp_file}
DEPENDS ${_asm_file})
if(ARCH STREQUAL "arm")
if(ARCH STREQUAL "arm" OR ARCH STREQUAL "arm64")
set(_asm16_command ${CMAKE_ASM16_COMPILER} -nologo -o ${_object_file} ${_temp_file})
else()
set(_asm16_command ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_temp_file})

View file

@ -18,7 +18,7 @@
#endif
#if !defined(_X86_) && !defined(_AMD64_) && !defined(_IA64_) && !defined(_ALPHA_) && \
!defined(_ARM_) && !defined(_PPC_) && !defined(_MIPS_) && !defined(_68K_) && !defined(_SH_)
!defined(_ARM_) && !defined(_ARM64_) && !defined(_PPC_) && !defined(_MIPS_) && !defined(_68K_) && !defined(_SH_)
#if defined(_M_AMD64) || defined(__x86_64__)
#define _AMD64_
@ -30,6 +30,8 @@
#define _ALPHA_
#elif defined(_M_ARM) || defined(__arm__)
#define _ARM_
#elif defined(_M_ARM64) || defined(__arm64__) || defined(__aarch64__)
#define _ARM64_
#elif defined(_M_PPC) || defined(__powerpc__)
#define _PPC_
#elif defined(_M_MRX000) || defined(__mips__)

View file

@ -26,6 +26,13 @@
#if !defined(_M_ARM)
#define _M_ARM 1
#endif
#elif defined(__arm64__)
#if !defined(_ARM64_)
#define _ARM64_ 1
#endif
#if !defined(_M_ARM64)
#define _M_ARM64 1
#endif
#elif defined(__ia64__)
#if !defined(_IA64_)
#define _IA64_ 1

View file

@ -119,7 +119,7 @@
#if defined(_AMD64_) || defined(_X86_)
#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT($ULONG)
#elif defined(_IA64_) || defined(_ARM_)
#elif defined(_IA64_) || defined(_ARM_) || defined(_ARM64_)
#define PROBE_ALIGNMENT(_s) max((TYPE_ALIGNMENT(_s), TYPE_ALIGNMENT($ULONG))
#elif !defined(RC_INVOKED)
#error "Unknown architecture"

View file

@ -0,0 +1,19 @@
/* INCLUDES ******************************************************************/
/* We need one of these first! */
/* #include <kxarm64.h> */
/* CODE **********************************************************************/
TEXTAREA
LEAF_ENTRY __chkstk
/* TODO: add an assert fail call, as this is unimplemented */
LEAF_END __chkstk
LEAF_ENTRY __alloca_probe
/* TODO: add an assert fail call, as this is unimplemented */
LEAF_END __alloca_probe
END
/* EOF */

View file

@ -64,6 +64,8 @@ elseif(ARCH STREQUAL "amd64")
list(APPEND CHKSTK_ASM_SOURCE except/amd64/chkstk_ms.s)
elseif(ARCH STREQUAL "arm")
list(APPEND CHKSTK_ASM_SOURCE except/arm/chkstk_asm.s)
elseif(ARCH STREQUAL "arm64")
list(APPEND CHKSTK_ASM_SOURCE except/arm64/chkstk_asm.s)
endif()
add_asm_files(chkstk_lib_asm ${CHKSTK_ASM_SOURCE})

View file

@ -0,0 +1,16 @@
/* INCLUDES ******************************************************************/
/* We need one of these first! */
/* #include <kxarm64.h> */
/* CODE **********************************************************************/
TEXTAREA
LEAF_ENTRY atan2
/* TODO: add an assert fail call, as this is unimplemented */
LEAF_END atan2
END
/* EOF */

View file

@ -185,6 +185,8 @@ elseif(ARCH STREQUAL "amd64")
list(APPEND ATAN2_ASM_SOURCE math/amd64/atan2.S)
elseif(ARCH STREQUAL "arm")
list(APPEND ATAN2_ASM_SOURCE math/arm/atan2.s)
elseif(ARCH STREQUAL "arm64")
list(APPEND ATAN2_ASM_SOURCE math/arm64/atan2.s)
endif()
add_asm_files(atan2_asm ${ATAN2_ASM_SOURCE})

View file

@ -57,6 +57,7 @@ enum _ARCH
ARCH_AMD64,
ARCH_IA64,
ARCH_ARM,
ARCH_ARM64,
ARCH_PPC
};
@ -449,7 +450,7 @@ OutputHeader_asmstub(FILE *file, char *libname)
{
fprintf(file, ".code\n");
}
else if (giArch == ARCH_ARM)
else if (giArch == ARCH_ARM || giArch == ARCH_ARM64)
{
fprintf(file, " AREA |.text|,ALIGN=2,CODE,READONLY\n\n");
}
@ -458,7 +459,7 @@ OutputHeader_asmstub(FILE *file, char *libname)
void
Output_stublabel(FILE *fileDest, char* pszSymbolName)
{
if (giArch == ARCH_ARM)
if (giArch == ARCH_ARM || giArch == ARCH_ARM64)
{
fprintf(fileDest,
"\tEXPORT |%s| [FUNC]\n|%s|\n",
@ -1405,7 +1406,7 @@ void usage(void)
" -n=<name> name of the dll\n"
" --implib generate a def file for an import library\n"
" --no-private-warnings suppress warnings about symbols that should be -private\n"
" -a=<arch> set architecture to <arch> (i386, x86_64, arm)\n"
" -a=<arch> set architecture to <arch> (i386, x86_64, arm, arm64)\n"
" --with-tracing generate wine-like \"+relay\" trace trampolines (needs -s)\n");
}
@ -1494,6 +1495,7 @@ int main(int argc, char *argv[])
else if (strcasecmp(pszArchString, "x86_64") == 0) giArch = ARCH_AMD64;
else if (strcasecmp(pszArchString, "ia64") == 0) giArch = ARCH_IA64;
else if (strcasecmp(pszArchString, "arm") == 0) giArch = ARCH_ARM;
else if (strcasecmp(pszArchString, "arm64") == 0) giArch = ARCH_ARM64;
else if (strcasecmp(pszArchString, "ppc") == 0) giArch = ARCH_PPC;
if ((giArch == ARCH_AMD64) || (giArch == ARCH_IA64))