vcpkg/ports/libtorrent/0001-fix-build-error-on-Windows-ARM64-by-add-new-define.patch
David Liu 70cc9c536f
[libtorrent] fix build error on windows arm64 target (#29626)
* [libtorrent] fix build error on windows arm64 target

* Update version database
2023-02-16 10:04:52 -08:00

46 lines
1.6 KiB
Diff

From 24b9c178ed316b39236e62dd655c85f3405e147a Mon Sep 17 00:00:00 2001
From: David Liu <wbsdty331@outlook.com>
Date: Mon, 13 Feb 2023 18:03:58 +0800
Subject: [PATCH] fix build error on Windows ARM64 by add new define
fix build error on Windows ARM64 by add new define
---
src/assert.cpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/assert.cpp b/src/assert.cpp
index d623605b5..482345451 100644
--- a/src/assert.cpp
+++ b/src/assert.cpp
@@ -190,16 +190,21 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth
std::array<void*, 50> stack;
STACKFRAME64 stack_frame = {};
-#if defined(_WIN64)
- int const machine_type = IMAGE_FILE_MACHINE_AMD64;
- stack_frame.AddrPC.Offset = context_record.Rip;
- stack_frame.AddrFrame.Offset = context_record.Rbp;
- stack_frame.AddrStack.Offset = context_record.Rsp;
-#else
+#if defined(_M_IX86)
int const machine_type = IMAGE_FILE_MACHINE_I386;
stack_frame.AddrPC.Offset = context_record.Eip;
stack_frame.AddrFrame.Offset = context_record.Ebp;
stack_frame.AddrStack.Offset = context_record.Esp;
+#elif defined(_M_X64)
+ int const machine_type = IMAGE_FILE_MACHINE_AMD64;
+ stack_frame.AddrPC.Offset = context_record.Rip;
+ stack_frame.AddrFrame.Offset = context_record.Rbp;
+ stack_frame.AddrStack.Offset = context_record.Rsp;
+#elif defined(_M_ARM64)
+ int const machine_type = IMAGE_FILE_MACHINE_ARM64;
+ stack_frame.AddrPC.Offset = context_record.Pc;
+ stack_frame.AddrFrame.Offset = context_record.Fp;
+ stack_frame.AddrStack.Offset = context_record.Sp;
#endif
stack_frame.AddrPC.Mode = AddrModeFlat;
stack_frame.AddrFrame.Mode = AddrModeFlat;
--
2.39.1.windows.1