Fixed crash when use ASM code for MSYS2, thanks @SChernykh.

This commit is contained in:
XMRig 2018-09-24 20:43:31 +03:00
parent f4a867b70f
commit ebcdac7d13
2 changed files with 27 additions and 9 deletions

View file

@ -1,20 +1,23 @@
if (WITH_ASM AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8) if (WITH_ASM AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(XMRIG_ASM_LIBRARY "xmrig-asm") set(XMRIG_ASM_LIBRARY "xmrig-asm")
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) if (CMAKE_C_COMPILER_ID MATCHES MSVC)
enable_language(ASM_MASM) enable_language(ASM_MASM)
set_property(SOURCE "src/crypto/asm/cnv2_main_loop.asm" PROPERTY ASM_MASM) set(XMRIG_ASM_FILE "src/crypto/asm/cnv2_main_loop.asm")
add_library(${XMRIG_ASM_LIBRARY} STATIC set_property(SOURCE ${XMRIG_ASM_FILE} PROPERTY ASM_MASM)
"src/crypto/asm/cnv2_main_loop.asm"
)
else() else()
enable_language(ASM) enable_language(ASM)
set_property(SOURCE "src/crypto/asm/cnv2_main_loop.S" PROPERTY C)
add_library(${XMRIG_ASM_LIBRARY} STATIC if (WIN32 AND CMAKE_C_COMPILER_ID MATCHES GNU)
"src/crypto/asm/cnv2_main_loop.S" set(XMRIG_ASM_FILE "src/crypto/asm/cnv2_main_loop_win.S")
) else()
set(XMRIG_ASM_FILE "src/crypto/asm/cnv2_main_loop.S")
endif() endif()
set_property(SOURCE ${XMRIG_ASM_FILE} PROPERTY C)
endif()
add_library(${XMRIG_ASM_LIBRARY} STATIC ${XMRIG_ASM_FILE})
set(XMRIG_ASM_SOURCES src/crypto/Asm.h src/crypto/Asm.cpp) set(XMRIG_ASM_SOURCES src/crypto/Asm.h src/crypto/Asm.cpp)
set_property(TARGET ${XMRIG_ASM_LIBRARY} PROPERTY LINKER_LANGUAGE C) set_property(TARGET ${XMRIG_ASM_LIBRARY} PROPERTY LINKER_LANGUAGE C)
else() else()

View file

@ -0,0 +1,15 @@
#define ALIGN .align
.intel_syntax noprefix
.section .text
.global cnv2_mainloop_ivybridge_asm
.global cnv2_mainloop_ryzen_asm
ALIGN 16
cnv2_mainloop_ivybridge_asm:
#include "cnv2_main_loop_ivybridge.inc"
ret 0
ALIGN 16
cnv2_mainloop_ryzen_asm:
#include "cnv2_main_loop_ryzen.inc"
ret 0