summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Danes <onemihaid@hotmail.com>2015-12-05 12:24:32 +0200
committerMike Danes <onemihaid@hotmail.com>2015-12-06 18:06:15 +0200
commit03fe85991f055fcad160407e8f03f6aa54112740 (patch)
treec4f19e57e98962446e35647a358c254abb7ccceb
parentc28fdd314ee4bdcaab02689cf47b0fb497b0bca2 (diff)
downloadcoreclr-03fe85991f055fcad160407e8f03f6aa54112740.tar.gz
coreclr-03fe85991f055fcad160407e8f03f6aa54112740.tar.bz2
coreclr-03fe85991f055fcad160407e8f03f6aa54112740.zip
Enable SAFESEH in the Windows x86 build
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/debug/ee/wks/CMakeLists.txt7
-rw-r--r--src/dlls/mscoree/i386/.gitmirror1
-rw-r--r--src/dlls/mscoree/i386/handlers.asm38
-rw-r--r--src/dlls/mscoree/mscoree.settings.targets5
-rw-r--r--src/vm/i386/asmhelpers.asm21
-rw-r--r--src/vm/wks/CMakeLists.txt2
7 files changed, 28 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90d5780ab7..ce2a595f81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -381,9 +381,6 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO") #Do n
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.00") #windows subsystem
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE") # can handle addresses larger than 2 gigabytes
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /RELEASE") #sets the checksum in the header
-if (IS_64BIT_BUILD EQUAL 0)
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") #Image does not have Safe Exception Handlers..valid only for x86
-endif (IS_64BIT_BUILD EQUAL 0)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NXCOMPAT") #Compatible with Data Execution Prevention
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE") #Use address space layout randomization
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUGTYPE:cv,fixup") #debugging format
diff --git a/src/debug/ee/wks/CMakeLists.txt b/src/debug/ee/wks/CMakeLists.txt
index 835895ce47..2eea459a4e 100644
--- a/src/debug/ee/wks/CMakeLists.txt
+++ b/src/debug/ee/wks/CMakeLists.txt
@@ -5,10 +5,15 @@ add_precompiled_header(stdafx.h ../stdafx.cpp CORDBEE_SOURCES_WKS)
get_include_directories(ASM_INCLUDE_DIRECTORIES)
get_compile_definitions(ASM_DEFINITIONS)
+set(ASM_OPTIONS /c /Zi /W3 /errorReport:prompt)
+
+if (CLR_CMAKE_PLATFORM_ARCH_I386)
+ list (APPEND ASM_OPTIONS /safeseh)
+endif (CLR_CMAKE_PLATFORM_ARCH_I386)
# Need to compile asm file using custom command as include directories are not provided to asm compiler
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dbghelpers.obj
- COMMAND ${CMAKE_ASM_MASM_COMPILER} ${ASM_INCLUDE_DIRECTORIES} ${ASM_DEFINITIONS} /c /Zi /Fo${CMAKE_CURRENT_BINARY_DIR}/dbghelpers.obj /W3 /errorReport:prompt /Ta${CORDBEE_DIR}/${ARCH_SOURCES_DIR}/dbghelpers.asm
+ COMMAND ${CMAKE_ASM_MASM_COMPILER} ${ASM_INCLUDE_DIRECTORIES} ${ASM_DEFINITIONS} ${ASM_OPTIONS} /Fo${CMAKE_CURRENT_BINARY_DIR}/dbghelpers.obj /Ta${CORDBEE_DIR}/${ARCH_SOURCES_DIR}/dbghelpers.asm
DEPENDS ${CORDBEE_DIR}/${ARCH_SOURCES_DIR}/dbghelpers.asm
COMMENT "Compiling dbghelpers.asm")
diff --git a/src/dlls/mscoree/i386/.gitmirror b/src/dlls/mscoree/i386/.gitmirror
deleted file mode 100644
index f507630f94..0000000000
--- a/src/dlls/mscoree/i386/.gitmirror
+++ /dev/null
@@ -1 +0,0 @@
-Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file
diff --git a/src/dlls/mscoree/i386/handlers.asm b/src/dlls/mscoree/i386/handlers.asm
deleted file mode 100644
index a1f97f9b31..0000000000
--- a/src/dlls/mscoree/i386/handlers.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-;
-; Copyright (c) Microsoft. All rights reserved.
-; Licensed under the MIT license. See LICENSE file in the project root for full license information.
-;
-
-; ==++==
-;
-
-;
-; ==--==
-;
-; This file contains definitions for each CLR exception handler.
-; The assembler marks all functions in this file as safe-exception
-; handler.
-;
-
-.686
-.model flat
-
-COMPlusFrameHandler proto c
-.safeseh COMPlusFrameHandler
-
-COMPlusNestedExceptionHandler proto c
-.safeseh COMPlusNestedExceptionHandler
-
-FastNExportExceptHandler proto c
-.safeseh FastNExportExceptHandler
-
-UMThunkPrestubHandler proto c
-.safeseh UMThunkPrestubHandler
-
-ifdef FEATURE_COMINTEROP
-COMPlusFrameHandlerRevCom proto c
-.safeseh COMPlusFrameHandlerRevCom
-endif
-
-end
-
diff --git a/src/dlls/mscoree/mscoree.settings.targets b/src/dlls/mscoree/mscoree.settings.targets
index 538f39c1ab..2931de5da7 100644
--- a/src/dlls/mscoree/mscoree.settings.targets
+++ b/src/dlls/mscoree/mscoree.settings.targets
@@ -268,9 +268,4 @@
<ItemGroup Condition="'$(FeatureCoreclr)'=='true'">
<CppCompile Include="..\unixinterface.cpp" />
</ItemGroup>
-
- <ItemGroup>
- <Assemble386 Condition="'$(BuildArchitecture)' == 'i386'" Include="..\i386\handlers.asm" />
- </ItemGroup>
-
</Project>
diff --git a/src/vm/i386/asmhelpers.asm b/src/vm/i386/asmhelpers.asm
index 93d10cd92c..5e1c05919f 100644
--- a/src/vm/i386/asmhelpers.asm
+++ b/src/vm/i386/asmhelpers.asm
@@ -332,6 +332,27 @@ ___CxxFrameHandler3 ENDP
endif ; _DEBUG
endif ; FEATURE_CORECLR
+; Register CLR exception handlers defined on the C++ side with SAFESEH.
+; Note that these directives must be in a file that defines symbols that will be used during linking,
+; otherwise it's possible that the resulting .obj will completly be ignored by the linker and these
+; directives will have no effect.
+COMPlusFrameHandler proto c
+.safeseh COMPlusFrameHandler
+
+COMPlusNestedExceptionHandler proto c
+.safeseh COMPlusNestedExceptionHandler
+
+FastNExportExceptHandler proto c
+.safeseh FastNExportExceptHandler
+
+UMThunkPrestubHandler proto c
+.safeseh UMThunkPrestubHandler
+
+ifdef FEATURE_COMINTEROP
+COMPlusFrameHandlerRevCom proto c
+.safeseh COMPlusFrameHandlerRevCom
+endif
+
; Note that RtlUnwind trashes EBX, ESI and EDI, so this wrapper preserves them
CallRtlUnwind PROC stdcall public USES ebx esi edi, pEstablisherFrame :DWORD, callback :DWORD, pExceptionRecord :DWORD, retVal :DWORD
diff --git a/src/vm/wks/CMakeLists.txt b/src/vm/wks/CMakeLists.txt
index 06cf425dc6..1b232b7b19 100644
--- a/src/vm/wks/CMakeLists.txt
+++ b/src/vm/wks/CMakeLists.txt
@@ -36,7 +36,7 @@ foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES)
endforeach()
if (CLR_CMAKE_PLATFORM_ARCH_I386)
- set_source_files_properties(${VM_SOURCES_WKS_ARCH_ASM} PROPERTIES COMPILE_FLAGS "/Zm")
+ set_source_files_properties(${VM_SOURCES_WKS_ARCH_ASM} PROPERTIES COMPILE_FLAGS "/Zm /safeseh")
endif (CLR_CMAKE_PLATFORM_ARCH_I386)
# Convert AsmConstants.h into AsmConstants.inc