Skip to content

Commit 4832002

Browse files
CopilotMichalStrehovskyCopilot
authored
Add NativeAOT aggregate executable shims with preview-feature gating (#128553)
- Enable NativeAOT shared-library projects to aggregate multiple executable entry points into one native library and emit per-app shim executables across Windows, Linux, and macOS. - Keep aggregate shim generation/linking behavior and incremental build tracking fixes (including Windows import-library tracking, Unix runtime lookup behavior, and x86 Windows symbol handling). - Gate `IncludeInAggregateExecutable` behind preview opt-in: building with aggregate executable `ProjectReference` items now requires `EnablePreviewFeatures=true` (with an explicit build error otherwise), and the NativeAOT aggregate test project opts in. ## Testing - `dotnet msbuild src/tests/nativeaot/AggregateExecutableLibrary/AggregateLibrary.csproj /t:ComputeAggregateExecutableInputs /p:EnablePreviewFeatures=false -nologo` - Verifies the new preview-feature error is emitted. - `dotnet msbuild src/tests/nativeaot/AggregateExecutableLibrary/AggregateLibrary.csproj /t:ComputeAggregateExecutableInputs /p:EnablePreviewFeatures=true -nologo` - Verifies aggregate executable input computation succeeds with preview enabled. - `dotnet build src/tests/nativeaot/AggregateExecutableLibrary/AggregateLibrary.csproj -c Debug -v minimal` - Still blocked in this environment by missing prebuilt `libs` artifacts (`eng/liveBuilds.targets` prerequisite), unrelated to this change. ## Breaking change? - [ ] Yes - [x] No --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: MichalStrehovsky <[email protected]> Co-authored-by: Michal Strehovský <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
1 parent 7dc7499 commit 4832002

14 files changed

Lines changed: 332 additions & 37 deletions

File tree

‎src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
============================================================
3030
-->
3131
<Target Name="NativeCompile"
32-
DependsOnTargets="_ComputeAssembliesToCompileToNative;LinkNative">
32+
DependsOnTargets="_ComputeAssembliesToCompileToNative;LinkNative;CreateShimExes">
3333

3434
<ItemGroup>
3535
<ResolvedFileToPublish Remove="@(_IlcManagedInputAssemblies)" />
@@ -41,6 +41,24 @@
4141
<RelativePath>$(NativeBinaryPrefix)$(TargetName)$(NativeBinaryExt)</RelativePath>
4242
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
4343
</ResolvedFileToPublish>
44+
<ResolvedFileToPublish Include="@(_AggregateExecutableShim)" Condition="'$(_AggregateExecutable)' == 'true'">
45+
<RelativePath>%(_AggregateExecutableShim.RelativePath)</RelativePath>
46+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
47+
</ResolvedFileToPublish>
48+
<ResolvedFileToPublish Include="@(_AggregateExecutableShimSymbol)"
49+
Condition="'$(_AggregateExecutable)' == 'true' and '$(CopyOutputSymbolsToPublishDirectory)' == 'true' and '$(NativeSymbolExt)' != '.dSYM' and Exists('%(_AggregateExecutableShimSymbol.Identity)')">
50+
<RelativePath>%(_AggregateExecutableShimSymbol.RelativePath)</RelativePath>
51+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
52+
</ResolvedFileToPublish>
53+
<_AggregateExecutableShimSymbolRecursivePath Include="%(_AggregateExecutableReferencePath.ShimSymbol)/**/*"
54+
Condition="'$(_AggregateExecutable)' == 'true' and '$(CopyOutputSymbolsToPublishDirectory)' == 'true' and '$(NativeSymbolExt)' == '.dSYM' and Exists('%(_AggregateExecutableReferencePath.ShimSymbol)')">
55+
<RelativePath>%(_AggregateExecutableReferencePath.AssemblyName)$(NativeSymbolExt)/%(RecursiveDir)%(Filename)%(Extension)</RelativePath>
56+
</_AggregateExecutableShimSymbolRecursivePath>
57+
<ResolvedFileToPublish Include="@(_AggregateExecutableShimSymbolRecursivePath)"
58+
Condition="'$(_AggregateExecutable)' == 'true' and '$(CopyOutputSymbolsToPublishDirectory)' == 'true'">
59+
<RelativePath>%(_AggregateExecutableShimSymbolRecursivePath.RelativePath)</RelativePath>
60+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
61+
</ResolvedFileToPublish>
4462
</ItemGroup>
4563

4664
<PropertyGroup Condition="'$(CopyOutputSymbolsToPublishDirectory)' == 'true'">

‎src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets‎

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@ The .NET Foundation licenses this file to you under the MIT license.
239239

240240
<ItemGroup>
241241
<LinkerArg Include="-gz=zlib" Condition="'$(CompressSymbols)' != 'false'" />
242-
<LinkerArg Include="-fuse-ld=$(LinkerFlavor)" Condition="'$(LinkerFlavor)' != ''" />
242+
<LinkerArg Include="-fuse-ld=$(LinkerFlavor)" Condition="'$(LinkerFlavor)' != ''" Shim="true" />
243243
<LinkerArg Include="@(NativeLibrary)" />
244-
<LinkerArg Include="--sysroot=&quot;$(SysRoot)&quot;" Condition="'$(SysRoot)' != '' and '$(_IsApplePlatform)' != 'true'" />
245-
<LinkerArg Include="-isysroot &quot;$(SysRoot)&quot;" Condition="'$(SysRoot)' != '' and '$(_IsApplePlatform)' == 'true'" />
246-
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetTriple)' != ''" />
247-
<LinkerArg Include="-g" Condition="$(NativeDebugSymbols) == 'true'" />
244+
<LinkerArg Include="--sysroot=&quot;$(SysRoot)&quot;" Condition="'$(SysRoot)' != '' and '$(_IsApplePlatform)' != 'true'" Shim="true" />
245+
<LinkerArg Include="-isysroot &quot;$(SysRoot)&quot;" Condition="'$(SysRoot)' != '' and '$(_IsApplePlatform)' == 'true'" Shim="true" />
246+
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetTriple)' != ''" Shim="true" />
247+
<LinkerArg Include="-g" Condition="$(NativeDebugSymbols) == 'true'" Shim="true" />
248248
<LinkerArg Include="-Wl,--strip-debug" Condition="$(NativeDebugSymbols) != 'true' and '$(_IsApplePlatform)' != 'true'" />
249249
<LinkerArg Include="-Wl,-install_name,&quot;$(SharedLibraryInstallName)&quot;" Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'" />
250-
<LinkerArg Include="-Wl,--build-id=sha1" Condition="'$(_IsApplePlatform)' != 'true'" />
250+
<LinkerArg Include="-Wl,--build-id=sha1" Condition="'$(_IsApplePlatform)' != 'true'" Shim="true" />
251251
<LinkerArg Include="-Wl,--as-needed" Condition="'$(_IsApplePlatform)' != 'true'" />
252252
<LinkerArg Include="-Wl,-e,0x0" Condition="'$(NativeLib)' == 'Shared' and '$(_IsApplePlatform)' != 'true'" />
253253
<LinkerArg Include="-pthread" Condition="'$(_IsApplePlatform)' != 'true'" />
@@ -263,10 +263,10 @@ The .NET Foundation licenses this file to you under the MIT license.
263263
<LinkerArg Include="-pie -Wl,-pie" Condition="'$(_IsApplePlatform)' != 'true' and '$(NativeLib)' == '' and '$(StaticExecutable)' != 'true' and '$(PositionIndependentExecutable)' != 'false'" />
264264
<LinkerArg Include="-Wl,-no-pie" Condition="'$(_IsApplePlatform)' != 'true' and '$(NativeLib)' == '' and '$(StaticExecutable)' != 'true' and '$(PositionIndependentExecutable)' == 'false'" />
265265
<!-- binskim warning BA3010 The GNU_RELRO segment is missing -->
266-
<LinkerArg Include="-Wl,-z,relro" Condition="'$(_IsApplePlatform)' != 'true'" />
266+
<LinkerArg Include="-Wl,-z,relro" Condition="'$(_IsApplePlatform)' != 'true'" Shim="true" />
267267
<!-- binskim warning BA3011 The BIND_NOW flag is missing -->
268-
<LinkerArg Include="-Wl,-z,now" Condition="'$(_IsApplePlatform)' != 'true'" />
269-
<LinkerArg Include="-Wl,-z,stack-size=$(IlcDefaultStackSize)" Condition="'$(IlcDefaultStackSize)' != ''" />
268+
<LinkerArg Include="-Wl,-z,now" Condition="'$(_IsApplePlatform)' != 'true'" Shim="true" />
269+
<LinkerArg Include="-Wl,-z,stack-size=$(IlcDefaultStackSize)" Condition="'$(IlcDefaultStackSize)' != ''" Shim="true" />
270270
<!-- this workaround can be deleted once the minimum supported glibc version
271271
(runtime's official build machine's glibc version) is at least 2.33
272272
see https://github.com/bminor/glibc/commit/99468ed45f5a58f584bab60364af937eb6f8afda -->
@@ -376,4 +376,60 @@ The .NET Foundation licenses this file to you under the MIT license.
376376
<DsymUtilOptions>$(DsymUtilOptions) --minimize</DsymUtilOptions>
377377
</PropertyGroup>
378378
</Target>
379+
380+
<Target Name="CreateShimExes"
381+
Condition="'$(_AggregateExecutable)' == 'true'"
382+
DependsOnTargets="LinkNative;WriteAggregateExecutableShimRspFiles"
383+
Inputs="$(NativeBinary);@(_AggregateExecutableReferencePath->'%(ShimSource)');@(_AggregateExecutableReferencePath->'%(ShimCompileLinkRspFile)')"
384+
Outputs="@(_AggregateExecutableShim);@(_AggregateExecutableShimSymbol)">
385+
386+
<Exec Command="&quot;$(CppLinker)&quot; @&quot;%(_AggregateExecutableReferencePath.ShimCompileLinkRspFile)&quot;" />
387+
<Exec Condition="'$(StripSymbols)' == 'true' and '$(NativeDebugSymbols)' == 'true' and '$(_IsApplePlatform)' != 'true'"
388+
Command="&quot;$(ObjCopyName)&quot; --only-keep-debug &quot;%(_AggregateExecutableReferencePath.ShimBinary)&quot; &quot;%(_AggregateExecutableReferencePath.ShimBinary)$(NativeSymbolExt)&quot;" />
389+
<Exec Condition="'$(StripSymbols)' == 'true' and '$(_IsApplePlatform)' != 'true'"
390+
Command="&quot;$(ObjCopyName)&quot; --strip-debug --strip-unneeded &quot;%(_AggregateExecutableReferencePath.ShimBinary)&quot;" />
391+
<Exec Condition="'$(StripSymbols)' == 'true' and '$(NativeDebugSymbols)' == 'true' and '$(_IsApplePlatform)' != 'true'"
392+
Command="&quot;$(ObjCopyName)&quot; --add-gnu-debuglink=&quot;%(_AggregateExecutableReferencePath.ShimBinary)$(NativeSymbolExt)&quot; &quot;%(_AggregateExecutableReferencePath.ShimBinary)&quot;" />
393+
<Exec Condition="'$(StripSymbols)' == 'true' and '$(_IsApplePlatform)' == 'true'"
394+
IgnoreStandardErrorWarningFormat="true"
395+
Command="
396+
dsymutil $(DsymUtilOptions) &quot;%(_AggregateExecutableReferencePath.ShimBinary)&quot; &amp;&amp;
397+
strip -no_code_signature_warning -x &quot;%(_AggregateExecutableReferencePath.ShimBinary)&quot;" />
398+
</Target>
399+
400+
<Target Name="WriteAggregateExecutableShimRspFiles"
401+
Condition="'$(_AggregateExecutable)' == 'true'"
402+
DependsOnTargets="LinkNative">
403+
404+
<ItemGroup>
405+
<_AggregateExecutableReferencePath>
406+
<ShimSourceCode><![CDATA[extern int %(_AggregateExecutableReferencePath.EntryPointSymbol)(int, char**);
407+
408+
int main(int argc, char** argv)
409+
{
410+
return %(_AggregateExecutableReferencePath.EntryPointSymbol)(argc, argv);
411+
}
412+
]]></ShimSourceCode>
413+
</_AggregateExecutableReferencePath>
414+
</ItemGroup>
415+
416+
<ItemGroup>
417+
<_AggregateExecutableShimCompilerAndLinkerArg Include="@(LinkerArg)" Condition="'%(LinkerArg.Shim)' == 'true'" />
418+
<_AggregateExecutableShimCompilerAndLinkerArg Include="-Wl,-rpath,'$ORIGIN'" Condition="'$(_IsApplePlatform)' != 'true'" />
419+
<_AggregateExecutableShimCompilerAndLinkerArg Include="-Wl,-rpath,@executable_path" Condition="'$(_IsApplePlatform)' == 'true'" />
420+
421+
<!-- binskim warning BA3001 PIE disabled on executable -->
422+
<_AggregateExecutableShimCompilerAndLinkerArg Include="-pie -Wl,-pie" Condition="'$(_IsApplePlatform)' != 'true' and '$(StaticExecutable)' != 'true' and '$(PositionIndependentExecutable)' != 'false'" />
423+
<!-- binskim error BA3003: The stack protector was not found -->
424+
<_AggregateExecutableShimCompilerAndLinkerArg Include="-fstack-protector-strong" />
425+
426+
<_AggregateExecutableShimNativeLibraryArg Include="-L&quot;$(NativeOutputPath)&quot;" Condition="'$(_IsApplePlatform)' != 'true'" />
427+
<_AggregateExecutableShimNativeLibraryArg Include="-l:$(NativeBinaryPrefix)$(TargetName)$(NativeBinaryExt)" Condition="'$(_IsApplePlatform)' != 'true'" />
428+
<_AggregateExecutableShimNativeLibraryArg Include="&quot;$(NativeBinary)&quot;" Condition="'$(_IsApplePlatform)' == 'true'" />
429+
</ItemGroup>
430+
431+
<MakeDir Directories="$(NativeIntermediateOutputPath);$(NativeOutputPath)" />
432+
<WriteLinesToFile File="%(_AggregateExecutableReferencePath.ShimSource)" Lines="$([MSBuild]::Escape('%(_AggregateExecutableReferencePath.ShimSourceCode)'))" Overwrite="true" Encoding="utf-8" WriteOnlyWhenDifferent="true" />
433+
<WriteLinesToFile File="%(_AggregateExecutableReferencePath.ShimCompileLinkRspFile)" Lines="@(_AggregateExecutableShimCompilerAndLinkerArg);&quot;%(_AggregateExecutableReferencePath.ShimSource)&quot;;@(_AggregateExecutableShimNativeLibraryArg);-o;&quot;%(_AggregateExecutableReferencePath.ShimBinary)&quot;" Overwrite="true" Encoding="utf-8" WriteOnlyWhenDifferent="true" />
434+
</Target>
379435
</Project>

‎src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets‎

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The .NET Foundation licenses this file to you under the MIT license.
1515
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1616
<PropertyGroup>
1717
<CppLinker>link</CppLinker>
18+
<CppCompiler>cl</CppCompiler>
1819
<CppLibCreator>lib</CppLibCreator>
1920
<ObjectSuffix>.obj</ObjectSuffix>
2021
<LibrarySuffix>.lib</LibrarySuffix>
@@ -93,35 +94,35 @@ The .NET Foundation licenses this file to you under the MIT license.
9394
<LinkerArg Condition="'$(NativeLib)' == 'Shared'" Include="/DLL" />
9495
<LinkerArg Include="@(NativeLibrary->'&quot;%(Identity)&quot;')" />
9596
<LinkerArg Include="@(SdkNativeLibrary->'&quot;%(Identity)&quot;')" />
96-
<LinkerArg Include="/NOLOGO /MANIFEST:NO" />
97+
<LinkerArg Include="/NOLOGO /MANIFEST:NO" Shim="true" />
9798
<LinkerArg Condition="$(IlcMergeSections) != 'false'" Include="/MERGE:.managedcode=.text /MERGE:hydrated=.bss" />
98-
<LinkerArg Condition="$(NativeDebugSymbols) == 'true'" Include="/DEBUG" />
99+
<LinkerArg Condition="$(NativeDebugSymbols) == 'true'" Include="/DEBUG" Shim="true" />
99100
<!-- The runtime is not compatible with jump stubs inserted by incremental linking. -->
100101
<LinkerArg Include="/INCREMENTAL:NO" />
101102
<LinkerArg Condition="'$(NativeLib)' == '' and '$(LinkerSubsystem)' != ''" Include="/SUBSYSTEM:$(LinkerSubsystem)" />
102103
<LinkerArg Condition="'$(NativeLib)' == ''" Include="/ENTRY:$(EntryPointSymbol) /NOEXP /NOIMPLIB /STACK:$(IlcDefaultStackSize)" />
103104
<LinkerArg Include="/NATVIS:&quot;$(MSBuildThisFileDirectory)NativeAOT.natvis&quot;" />
104-
<LinkerArg Condition="'$(ControlFlowGuard)' == 'Guard'" Include="/guard:cf" />
105-
<LinkerArg Condition="'$(_targetArchitecture)' == 'x86'" Include="/safeseh" />
105+
<LinkerArg Condition="'$(ControlFlowGuard)' == 'Guard'" Include="/guard:cf" Shim="true" />
106+
<LinkerArg Condition="'$(_targetArchitecture)' == 'x86'" Include="/safeseh" Shim="true" />
106107
<!-- Do not warn if someone declares UnmanagedCallersOnly with an entrypoint of 'DllGetClassObject' and similar -->
107108
<LinkerArg Include="/IGNORE:4104" />
108109
<!-- Opt into CETCOMPAT by default. -->
109-
<LinkerArg Condition="'$(CETCompat)' != 'false' and '$(_targetArchitecture)' == 'x64'" Include="/CETCOMPAT" />
110+
<LinkerArg Condition="'$(CETCompat)' != 'false' and '$(_targetArchitecture)' == 'x64'" Include="/CETCOMPAT" Shim="true" />
110111
<!-- Allow user to opt out. -->
111-
<LinkerArg Condition="'$(CETCompat)' == 'false' and '$(_targetArchitecture)' == 'x64'" Include="/CETCOMPAT:NO" />
112+
<LinkerArg Condition="'$(CETCompat)' == 'false' and '$(_targetArchitecture)' == 'x64'" Include="/CETCOMPAT:NO" Shim="true" />
112113
<!-- Enable EHCONT if CET is not disabled and CFG is enabled. -->
113-
<LinkerArg Condition="'$(CETCompat)' != 'false' and '$(_targetArchitecture)' == 'x64' and '$(ControlFlowGuard)' == 'Guard'" Include="/guard:ehcont"/>
114+
<LinkerArg Condition="'$(CETCompat)' != 'false' and '$(_targetArchitecture)' == 'x64' and '$(ControlFlowGuard)' == 'Guard'" Include="/guard:ehcont" Shim="true" />
114115
</ItemGroup>
115116

116117
<ItemGroup Condition="!Exists('$(IlcSdkPath)debugucrt.txt')">
117118
<!-- Force ucrt to be dynamically linked for release runtime -->
118-
<LinkerArg Include="/NODEFAULTLIB:libucrt.lib" />
119-
<LinkerArg Include="/DEFAULTLIB:ucrt.lib" />
119+
<LinkerArg Include="/NODEFAULTLIB:libucrt.lib" Shim="true" />
120+
<LinkerArg Include="/DEFAULTLIB:ucrt.lib" Shim="true" />
120121
</ItemGroup>
121122

122123
<ItemGroup Condition="'$(Configuration)' != 'Debug'">
123-
<LinkerArg Include="/OPT:REF" />
124-
<LinkerArg Include="/OPT:ICF" />
124+
<LinkerArg Include="/OPT:REF" Shim="true" />
125+
<LinkerArg Include="/OPT:ICF" Shim="true" />
125126
</ItemGroup>
126127

127128
<Exec Condition="'$(IlcUseEnvironmentalTools)' != 'true'" Command="&quot;$(MSBuildThisFileDirectory)findvcvarsall.bat&quot; $(_targetArchitecture)"
@@ -136,10 +137,63 @@ The .NET Foundation licenses this file to you under the MIT license.
136137

137138
<PropertyGroup Condition="'$(_VCVarsAllFound)' == '0'">
138139
<_CppToolsDirectory>$(_FindVCVarsallOutput.Split(`#`)[0])</_CppToolsDirectory>
140+
<CppCompiler>$(_CppToolsDirectory)cl.exe</CppCompiler>
139141
<CppLinker>$(_CppToolsDirectory)link.exe</CppLinker>
140142
<CppLibCreator>$(_CppToolsDirectory)lib.exe</CppLibCreator>
141143
</PropertyGroup>
142144

143145
<Error Condition="'$(_VCVarsAllFound)' == '1'" Text="Platform linker not found. Ensure you have all the required prerequisites documented at https://aka.ms/nativeaot-prerequisites, in particular the Desktop Development for C++ workload in Visual Studio. For ARM64 development also install C++ ARM64 build tools." />
144146
</Target>
147+
148+
<Target Name="CreateShimExes"
149+
Condition="'$(_AggregateExecutable)' == 'true'"
150+
DependsOnTargets="LinkNative;WriteAggregateExecutableShimRspFiles"
151+
Inputs="$(NativeImportLibrary);@(_AggregateExecutableReferencePath->'%(ShimSource)');@(_AggregateExecutableReferencePath->'%(ShimCompileRspFile)');@(_AggregateExecutableReferencePath->'%(ShimLinkRspFile)')"
152+
Outputs="@(_AggregateExecutableShim);@(_AggregateExecutableShimSymbol)">
153+
154+
<MakeDir Directories="$(NativeIntermediateOutputPath);$(NativeOutputPath)" />
155+
<Exec Command="&quot;$(CppCompiler)&quot; @&quot;%(_AggregateExecutableReferencePath.ShimCompileRspFile)&quot;" />
156+
<Exec Command="&quot;$(CppLinker)&quot; @&quot;%(_AggregateExecutableReferencePath.ShimLinkRspFile)&quot;" />
157+
</Target>
158+
159+
<Target Name="WriteAggregateExecutableShimRspFiles"
160+
Condition="'$(_AggregateExecutable)' == 'true'"
161+
DependsOnTargets="LinkNative">
162+
163+
<ItemGroup>
164+
<_AggregateExecutableReferencePath>
165+
<ShimSourceCode><![CDATA[extern int __stdcall %(_AggregateExecutableReferencePath.EntryPointSymbol)(int, unsigned short**);
166+
167+
int wmain(int argc, unsigned short** argv)
168+
{
169+
return %(_AggregateExecutableReferencePath.EntryPointSymbol)(argc, argv);
170+
}
171+
]]></ShimSourceCode>
172+
<ShimPdbLinkerArg Condition="'$(NativeDebugSymbols)' == 'true'">/PDB:"%(_AggregateExecutableReferencePath.ShimSymbol)"</ShimPdbLinkerArg>
173+
</_AggregateExecutableReferencePath>
174+
</ItemGroup>
175+
176+
<ItemGroup>
177+
<_AggregateExecutableShimCompilerArg Include="/nologo" />
178+
<_AggregateExecutableShimCompilerArg Include="/c" />
179+
<_AggregateExecutableShimCompilerArg Include="/MT" />
180+
<_AggregateExecutableShimCompilerArg Condition="'$(NativeDebugSymbols)' == 'true'" Include="/Z7" />
181+
<_AggregateExecutableShimCompilerArg Condition="'$(ControlFlowGuard)' == 'Guard'" Include="/guard:cf" />
182+
183+
<!-- binskim BA2007 X was compiled at too low a warning level -->
184+
<_AggregateExecutableShimCompilerArg Include="/W4" />
185+
<!-- binskim BA2026 X is a Windows PE that wasn't compiled with recommended Security Development Lifecycle (SDL) checks -->
186+
<_AggregateExecutableShimCompilerArg Include="/sdl" />
187+
188+
<_AggregateExecutableShimLinkerArg Include="@(LinkerArg)" Condition="'%(LinkerArg.Shim)' == 'true'" />
189+
<_AggregateExecutableShimLinkerArg Include="/ENTRY:wmainCRTStartup" />
190+
<_AggregateExecutableShimLinkerArg Include="/STACK:$(IlcDefaultStackSize)" />
191+
<_AggregateExecutableShimLinkerArg Include="@(AdditionalNativeLibraryDirectories->'/LIBPATH:&quot;%(Identity)&quot;')" />
192+
</ItemGroup>
193+
194+
<MakeDir Directories="$(NativeIntermediateOutputPath);$(NativeOutputPath)" />
195+
<WriteLinesToFile File="%(_AggregateExecutableReferencePath.ShimSource)" Lines="$([MSBuild]::Escape('%(_AggregateExecutableReferencePath.ShimSourceCode)'))" Overwrite="true" Encoding="utf-8" WriteOnlyWhenDifferent="true" />
196+
<WriteLinesToFile File="%(_AggregateExecutableReferencePath.ShimCompileRspFile)" Lines="@(_AggregateExecutableShimCompilerArg);&quot;%(_AggregateExecutableReferencePath.ShimSource)&quot;;/Fo&quot;%(_AggregateExecutableReferencePath.ShimObject)&quot;" Overwrite="true" Encoding="utf-8" WriteOnlyWhenDifferent="true" />
197+
<WriteLinesToFile File="%(_AggregateExecutableReferencePath.ShimLinkRspFile)" Lines="&quot;%(_AggregateExecutableReferencePath.ShimObject)&quot;;&quot;$(NativeImportLibrary)&quot;;/OUT:&quot;%(_AggregateExecutableReferencePath.ShimBinary)&quot;;/SUBSYSTEM:%(_AggregateExecutableReferencePath.ShimLinkerSubsystem);%(_AggregateExecutableReferencePath.ShimPdbLinkerArg);@(_AggregateExecutableShimLinkerArg)" Overwrite="true" Encoding="utf-8" WriteOnlyWhenDifferent="true" />
198+
</Target>
145199
</Project>

0 commit comments

Comments
 (0)