Skip to content

修复Windows arm64无法编译的问题 #366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
修复Windows arm64无法编译的问题
  • Loading branch information
Baiyuetribe committed Aug 12, 2024
commit 27ecdcac0f5b7bc8fdb0ca317d009db903c1b808
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -7,7 +7,11 @@ endif()
project(coost VERSION 3.0.0)

if(MSVC)
enable_language(C CXX ASM_MASM)
if(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
enable_language(C CXX ASM)
else()
enable_language(C CXX ASM_MASM)
endif()
else()
enable_language(C CXX ASM)
endif()
4 changes: 3 additions & 1 deletion src/co/hook_win.cc
Original file line number Diff line number Diff line change
@@ -1359,7 +1359,9 @@ WSASendMsg_fp_t get_WSASendMsg_fp() {
} // extern "C"

namespace co {

#if !defined(PCHAR)
#define PCHAR const char *
#endif
inline void detour_attach(PVOID* ppbReal, PVOID pbMine, PCHAR psz) {
LONG l = DetourAttach(ppbReal, pbMine);
CHECK_EQ(l, 0) << "detour attach failed: " << psz;
8 changes: 8 additions & 0 deletions src/log/StackWalker.cpp
Original file line number Diff line number Diff line change
@@ -999,6 +999,14 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread,
s.AddrBStore.Mode = AddrModeFlat;
s.AddrStack.Offset = c.IntSp;
s.AddrStack.Mode = AddrModeFlat;
#elif _M_ARM64
imageType = IMAGE_FILE_MACHINE_ARM64;
s.AddrPC.Offset = c.Pc;
s.AddrPC.Mode = AddrModeFlat;
s.AddrFrame.Offset = c.Fp;
s.AddrFrame.Mode = AddrModeFlat;
s.AddrStack.Offset = c.Sp;
s.AddrStack.Mode = AddrModeFlat;
#else
#error "Platform not supported!"
#endif