summaryrefslogtreecommitdiff
path: root/src/pal/src/CMakeLists.txt
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2017-02-22 23:18:01 +0100
committerGitHub <noreply@github.com>2017-02-22 23:18:01 +0100
commitf193024a5ef8f277f08bed3721e2e8e730aabdb9 (patch)
treed024acb0e60824a57771e2380116ecfa20fefeb7 /src/pal/src/CMakeLists.txt
parent09fd5fbd08d376aa0d7b2602e5115aaabcd7b352 (diff)
downloadcoreclr-f193024a5ef8f277f08bed3721e2e8e730aabdb9.tar.gz
coreclr-f193024a5ef8f277f08bed3721e2e8e730aabdb9.tar.bz2
coreclr-f193024a5ef8f277f08bed3721e2e8e730aabdb9.zip
Improve stack overflow reporting (#9650)
* Improve stack overflow reporting This change modifies the SIGSEGV handling to use an alternate stack so that we can safely detect and report stack overflow even in case when we are really out of stack. Before, we were able to detect stack overflow and report it only when JIT inserted stack probes (for functions with frames larger than 4kB) and so there was still space on the stack to run the sigsegv handler. It brings in some additional complexity, since we need to switch to the original stack of the thread once we figure out the sigsegv is not a stack overflow and if we return from the hardware exception handler, we need to switch back to the alternate stack before returning from the sigsegv handler. Also, the alternate stack is created per thread and so we need to correctly destroy it when a thread terminates and also install it on foreign threads that enter PAL. This also requires creating fake stack frames to enable the libunwind to walk the stack from the exception handler to the sigsegv location. * Fix stack unwinding in CallDescrWorkerInternal While testing the change to enable stack overflow handling, I've noticed that the PROLOG_SAVE_REG_PAIR and PROLOG_SAVE_REG_PAIR_INDEXED macros are missing .cfi_def_cfa_register fp. That resulted in inability to unwind through the CallDescrWorkerInternal, since this function dynamically allocates stack slots and so the default sp based frame doesn't work.
Diffstat (limited to 'src/pal/src/CMakeLists.txt')
-rw-r--r--src/pal/src/CMakeLists.txt40
1 files changed, 12 insertions, 28 deletions
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index 16c9d8bd6f..dae0f3fe3f 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -101,35 +101,19 @@ set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no
add_compile_options(-fPIC)
-if(PAL_CMAKE_PLATFORM_ARCH_AMD64)
- set(ARCH_SOURCES
- arch/amd64/context2.S
- arch/amd64/debugbreak.S
- arch/amd64/exceptionhelper.S
- arch/amd64/processor.cpp
- )
-elseif(PAL_CMAKE_PLATFORM_ARCH_ARM)
- set(ARCH_SOURCES
- arch/arm/context2.S
- arch/arm/debugbreak.S
- arch/arm/exceptionhelper.S
- arch/arm/processor.cpp
- )
-elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
- set(ARCH_SOURCES
- arch/arm64/context2.S
- arch/arm64/debugbreak.S
- arch/arm64/exceptionhelper.S
- arch/arm64/processor.cpp
- )
-elseif(PAL_CMAKE_PLATFORM_ARCH_I386)
- set(ARCH_SOURCES
- arch/i386/context2.S
- arch/i386/debugbreak.S
- arch/i386/exceptionhelper.S
- arch/i386/processor.cpp
+set(ARCH_SOURCES
+ arch/${ARCH_SOURCES_DIR}/context2.S
+ arch/${ARCH_SOURCES_DIR}/debugbreak.S
+ arch/${ARCH_SOURCES_DIR}/exceptionhelper.S
+ arch/${ARCH_SOURCES_DIR}/processor.cpp
+)
+
+if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ list(APPEND PLATFORM_SOURCES
+ arch/${ARCH_SOURCES_DIR}/callsignalhandlerwrapper.S
+ arch/${ARCH_SOURCES_DIR}/signalhandlerhelper.cpp
)
-endif()
+endif(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(PAL_CMAKE_PLATFORM_ARCH_ARM)
set_source_files_properties(exception/seh.cpp PROPERTIES COMPILE_FLAGS -Wno-error=inline-asm)