diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -60,6 +60,7 @@ # Getting correct source files to build library set(LIBOMP_CXXFILES) set(LIBOMP_ASMFILES) +set(LIBOMP_GNUASMFILES) if(STUBS_LIBRARY) set(LIBOMP_CXXFILES kmp_stub.cpp) else() @@ -94,12 +95,15 @@ libomp_append(LIBOMP_CXXFILES z_Windows_NT-586_util.cpp) if(${LIBOMP_ARCH} STREQUAL "i386" OR ${LIBOMP_ARCH} STREQUAL "x86_64") libomp_append(LIBOMP_ASMFILES z_Windows_NT-586_asm.asm) # Windows assembly file + elseif(${LIBOMP_ARCH} STREQUAL "aarch64" AND NOT MSVC) + # z_Linux_asm.S works for AArch64 Windows too. + libomp_append(LIBOMP_GNUASMFILES z_Linux_asm.S) endif() else() # Unix specific files libomp_append(LIBOMP_CXXFILES z_Linux_util.cpp) libomp_append(LIBOMP_CXXFILES kmp_gsupport.cpp) - libomp_append(LIBOMP_ASMFILES z_Linux_asm.S) # Unix assembly file + libomp_append(LIBOMP_GNUASMFILES z_Linux_asm.S) # Unix assembly file endif() libomp_append(LIBOMP_CXXFILES thirdparty/ittnotify/ittnotify_static.cpp LIBOMP_USE_ITT_NOTIFY) libomp_append(LIBOMP_CXXFILES kmp_debugger.cpp LIBOMP_USE_DEBUGGER) @@ -115,7 +119,7 @@ libomp_append(LIBOMP_CXXFILES ompt-general.cpp IF_TRUE LIBOMP_OMPT_SUPPORT) libomp_append(LIBOMP_CXXFILES ompd-specific.cpp IF_TRUE LIBOMP_OMPD_SUPPORT) -set(LIBOMP_SOURCE_FILES ${LIBOMP_CXXFILES} ${LIBOMP_ASMFILES}) +set(LIBOMP_SOURCE_FILES ${LIBOMP_CXXFILES} ${LIBOMP_ASMFILES} ${LIBOMP_GNUASMFILES}) # For Windows, there is a resource file (.rc -> .res) that is also compiled libomp_append(LIBOMP_SOURCE_FILES libomp.rc WIN32) @@ -124,11 +128,9 @@ libomp_get_asmflags(LIBOMP_CONFIGURED_ASMFLAGS) # Set the compiler flags for each type of source set_source_files_properties(${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}") -set_source_files_properties(${LIBOMP_ASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}") -# Let the compiler handle the assembly files on Unix-like systems -if(NOT WIN32) - set_source_files_properties(${LIBOMP_ASMFILES} PROPERTIES LANGUAGE C) -endif() +set_source_files_properties(${LIBOMP_ASMFILES} ${LIBOMP_GNUASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}") +# Let the compiler handle the GNU assembly files +set_source_files_properties(${LIBOMP_GNUASMFILES} PROPERTIES LANGUAGE C) # Remove any cmake-automatic linking of the standard C++ library. # We neither need (nor want) the standard C++ library dependency even though we compile c++ files. diff --git a/openmp/runtime/src/z_Linux_asm.S b/openmp/runtime/src/z_Linux_asm.S --- a/openmp/runtime/src/z_Linux_asm.S +++ b/openmp/runtime/src/z_Linux_asm.S @@ -108,7 +108,7 @@ # endif // KMP_OS_DARWIN #endif // KMP_ARCH_X86 || KMP_ARCH_x86_64 -#if (KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64 +#if (KMP_OS_LINUX || KMP_OS_DARWIN || KMP_OS_WINDOWS) && KMP_ARCH_AARCH64 # if KMP_OS_DARWIN # define KMP_PREFIX_UNDERSCORE(x) _##x // extra underscore for OS X* symbols @@ -129,7 +129,25 @@ .globl KMP_PREFIX_UNDERSCORE($0) KMP_PREFIX_UNDERSCORE($0): .endmacro -# else // KMP_OS_DARWIN +# elif KMP_OS_WINDOWS +# define KMP_PREFIX_UNDERSCORE(x) x // no extra underscore for Windows/ARM64 symbols +// Format labels so that they don't override function names in gdb's backtraces +# define KMP_LABEL(x) .L_##x // local label hidden from backtraces + +.macro ALIGN size + .align 1<<(\size) +.endm + +.macro DEBUG_INFO proc + ALIGN 2 +.endm + +.macro PROC proc + ALIGN 2 + .globl KMP_PREFIX_UNDERSCORE(\proc) +KMP_PREFIX_UNDERSCORE(\proc): +.endm +# else // KMP_OS_DARWIN || KMP_OS_WINDOWS # define KMP_PREFIX_UNDERSCORE(x) x // no extra underscore for Linux* OS symbols // Format labels so that they don't override function names in gdb's backtraces # define KMP_LABEL(x) .L_##x // local label hidden from backtraces @@ -154,7 +172,7 @@ .endm # endif // KMP_OS_DARWIN -#endif // (KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64 +#endif // (KMP_OS_LINUX || KMP_OS_DARWIN || KMP_OS_WINDOWS) && KMP_ARCH_AARCH64 // ----------------------------------------------------------------------- // data @@ -1204,7 +1222,7 @@ #endif /* KMP_ARCH_X86_64 */ // ' -#if (KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64 +#if (KMP_OS_LINUX || KMP_OS_DARWIN || KMP_OS_WINDOWS) && KMP_ARCH_AARCH64 //------------------------------------------------------------------------ // int @@ -1328,7 +1346,7 @@ DEBUG_INFO __kmp_invoke_microtask // -- End __kmp_invoke_microtask -#endif /* (KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64 */ +#endif /* (KMP_OS_LINUX || KMP_OS_DARWIN || KMP_OS_WINDOWS) && KMP_ARCH_AARCH64 */ #if KMP_ARCH_PPC64 diff --git a/openmp/runtime/src/z_Windows_NT-586_util.cpp b/openmp/runtime/src/z_Windows_NT-586_util.cpp --- a/openmp/runtime/src/z_Windows_NT-586_util.cpp +++ b/openmp/runtime/src/z_Windows_NT-586_util.cpp @@ -134,7 +134,9 @@ return old_value; } -#if KMP_ARCH_AARCH64 +#if KMP_ARCH_AARCH64 && defined(_MSC_VER) +// For !defined(_MSC_VER), this function is provided in assembly form +// by z_Linux_asm.S. int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int tid, int argc, void *p_argv[] #if OMPT_SUPPORT