Skip to content

Commit 67927bd

Browse files
Add /guard:cf flavor of bootstrapper (#1523)
1 parent 00a1c1f commit 67927bd

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/coreclr/nativeaot/Bootstrap/base/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ set(SOURCES
77
add_library(bootstrapper STATIC ${SOURCES})
88

99
install_static_library(bootstrapper aotsdk nativeaot)
10+
11+
if (CLR_CMAKE_TARGET_WIN32)
12+
add_library(bootstrapper.GuardCF STATIC ${SOURCES})
13+
install_static_library(bootstrapper.GuardCF aotsdk nativeaot)
14+
target_compile_options(bootstrapper.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
15+
endif()

src/coreclr/nativeaot/Bootstrap/dll/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ set(SOURCES
99
add_library(bootstrapperdll STATIC ${SOURCES})
1010

1111
install_static_library(bootstrapperdll aotsdk nativeaot)
12+
13+
if (CLR_CMAKE_TARGET_WIN32)
14+
add_library(bootstrapperdll.GuardCF STATIC ${SOURCES})
15+
install_static_library(bootstrapperdll.GuardCF aotsdk nativeaot)
16+
target_compile_options(bootstrapperdll.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
17+
endif()

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The .NET Foundation licenses this file to you under the MIT license.
2424

2525
<PropertyGroup>
2626
<FullRuntimeName>libRuntime.WorkstationGC</FullRuntimeName>
27-
<FullRuntimeName Condition="'$(ServerGarbageCollection)' != ''">libRuntime.ServerGC</FullRuntimeName>
27+
<FullRuntimeName Condition="'$(ServerGarbageCollection)' == 'true'">libRuntime.ServerGC</FullRuntimeName>
2828

2929
<CrossCompileRid />
3030
<CrossCompileRid Condition="'$(TargetOS)' != 'OSX' and !$(RuntimeIdentifier.EndsWith('-$(OSHostArch)'))">$(RuntimeIdentifier)</CrossCompileRid>

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.props

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ The .NET Foundation licenses this file to you under the MIT license.
1717
<CppCompiler>cl</CppCompiler>
1818
<CppLinker>link</CppLinker>
1919
<CppLibCreator>lib</CppLibCreator>
20+
<LibrarySuffix>.lib</LibrarySuffix>
21+
<LibrarySuffix Condition="'$(ControlFlowGuard)' == 'Guard'">.GuardCF.lib</LibrarySuffix>
2022
<FullRuntimeName>Runtime.WorkstationGC</FullRuntimeName>
21-
<FullRuntimeName Condition="'$(ServerGarbageCollection)' != ''">Runtime.ServerGC</FullRuntimeName>
22-
<FullRuntimeName Condition="'$(ControlFlowGuard)' == 'Guard'">Runtime.ServerGC.GuardCF</FullRuntimeName>
23+
<FullRuntimeName Condition="'$(ServerGarbageCollection)' == 'true' or '$(ControlFlowGuard)' == 'Guard'">Runtime.ServerGC</FullRuntimeName>
24+
<BootstrapperName>bootstrapper</BootstrapperName>
25+
<BootstrapperName Condition="$(NativeLib) != ''">bootstrapperdll</BootstrapperName>
2326
<EntryPointSymbol Condition="'$(EntryPointSymbol)' == ''">wmainCRTStartup</EntryPointSymbol>
2427
<LinkerSubsystem Condition="'$(OutputType)' == 'WinExe' and '$(LinkerSubsystem)' == ''">WINDOWS</LinkerSubsystem>
2528
<LinkerSubsystem Condition="'$(OutputType)' == 'Exe' and '$(LinkerSubsystem)' == ''">CONSOLE</LinkerSubsystem>
@@ -29,9 +32,8 @@ The .NET Foundation licenses this file to you under the MIT license.
2932
<Target Name="SetupOSSpecificProps" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
3033

3134
<ItemGroup>
32-
<NativeLibrary Condition="$(NativeLib) == ''" Include="$(IlcPath)\sdk\bootstrapper.lib" />
33-
<NativeLibrary Condition="$(NativeLib) != ''" Include="$(IlcPath)\sdk\bootstrapperdll.lib" />
34-
<NativeLibrary Include="$(IlcPath)\sdk\$(FullRuntimeName).lib" />
35+
<NativeLibrary Include="$(IlcPath)\sdk\$(BootstrapperName)$(LibrarySuffix)" />
36+
<NativeLibrary Include="$(IlcPath)\sdk\$(FullRuntimeName)$(LibrarySuffix)" />
3537
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true'" Include="$(SharedLibrary)" />
3638
</ItemGroup>
3739

0 commit comments

Comments
 (0)