Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions src/Microsoft.NET.HostModel.TestData/MachO/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

int add(int a, int b)
{
return a + b;
}

int main()
{
return add(2, 3) - add(1, 4);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.Build.NoTargets">
<ItemGroup>
<None Remove="MachO\src\*" />
</ItemGroup>

<ItemGroup>
<MachOArch Include="arm64" />
<MachOArch Include="x86_64" />
<MachOCodesignOption Include="signed" />
<MachOCodesignOption Include="unsigned" />
<MachOCodesignOption Include="buildonly" />
</ItemGroup>

<Target Name="GenerateMachOBinaries">
<ItemGroup>
<_MachObjectFile Include="@(MachOArch)">
<Codesign>%(MachOCodesignOption.Identity)</Codesign>
</_MachObjectFile>
<MachObjectFile Include="@(_MachObjectFile->'$(MSBuildThisFileDirectory)MachO/%(Identity)/a.%(Codesign).out')" >
<Arch>%(_MachObjectFile.Identity)</Arch>
</MachObjectFile>
</ItemGroup>

<MakeDir Directories="%(MachObjectFile.RelativeDir)" />
<Exec Command="clang $(MSBuildThisFileDirectory)MachO/src/main.c -o %(MachObjectFile.Identity) -arch %(Arch)" />
<Exec Command="codesign --sign - %(MachObjectFile.Identity)"
Condition="'%(Codesign)' == 'signed'" />
<Exec Command="codesign --remove-signature %(MachObjectFile.Identity)"
Condition="'%(Codesign)' == 'unsigned'" />
</Target>

</Project>
5 changes: 5 additions & 0 deletions src/Microsoft.NET.HostModel.TestData/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Microsoft.NET.HostModel.TestData

This project contains binary Mach-O files that are used to test the `Microsoft.NET.HostModel` implementation of ad-hoc signing.

To produce the binary files, run `dotnet build -t:GenerateMachOBinaries` on a macOS machine with `clang` installed. The version of `clang` used for the files in the current commit is `Apple clang version 16.0.0 (clang-1600.0.26.3)`.