From 31ce32709e8f5ceea4fd2efe313db053501139ec Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 8 Sep 2024 00:45:39 +0000 Subject: [PATCH] build: Disble fixed base for windows-on-arm --- Utilities/Thread.cpp | 4 ++-- buildfiles/cmake/ConfigureCompiler.cmake | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index bcc18f8387..7d9e91e758 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1841,9 +1841,9 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept } #if defined(ARCH_X64) - const exec_addr = pExp->ContextRecord->Rip; + const auto exec_addr = pExp->ContextRecord->Rip; #elif defined(ARCH_ARM64) - const exec_addr = pExp->ContextRecord->Pc; + const auto exec_addr = pExp->ContextRecord->Pc; #else #error "Unimplemented exception handling for this architecture" #endif diff --git a/buildfiles/cmake/ConfigureCompiler.cmake b/buildfiles/cmake/ConfigureCompiler.cmake index e7efd5ba13..8a32b5ce5b 100644 --- a/buildfiles/cmake/ConfigureCompiler.cmake +++ b/buildfiles/cmake/ConfigureCompiler.cmake @@ -113,7 +113,10 @@ else() # Increase stack limit to 8 MB add_link_options(-Wl,--stack -Wl,8388608) - add_link_options(-Wl,--image-base,0x10000) + # For arm64 windows, the image base cannot be below 4GB or the OS rejects the binary without much explanation. + if(COMPILER_X86) + add_link_options(-Wl,--image-base,0x10000) + endif() endif() # Specify C++ library to use as standard C++ when using clang