Skip to content

Commit

Permalink
Build only ELF during cross-compilation
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan-Jowett committed Dec 13, 2024
1 parent 743bb28 commit 8020162
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/sample/sample.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,27 @@
<BuildInParallel>true</BuildInParallel>
</CustomBuild>
</ItemGroup>
<ItemGroup Condition="'$(Analysis)'=='' And '$(Configuration)'!='FuzzerDebug' And '$(Platform)'!='$(HostPlatform)'">
<!-- Build BPF programs that pass verification and build native images for them. -->
<CustomBuild Include="*.c">
<FileType>CppCode</FileType>
<Command>
$(ClangExec) $(ClangFlags) -I../xdp -I../socket -I./ext/inc -I../../netebpfext -c %(Filename).c -o $(OutputPath)%(Filename).o
</Command>
<Outputs>$(OutputPath)%(Filename).o</Outputs>
<!-- Don't run bpf2c in parallel when built with fuzzing flags as this triggers failures. -->
<BuildInParallel Condition="'$(Fuzzer)'!='True' And '$(AddressSanitizer)'!='True'">true</BuildInParallel>
</CustomBuild>
<!-- Copy explicit unsafe object files (i.e., not to be verified) among the other generated .o files -->
<CustomBuild Include="unsafe\*.o">
<FileType>Document</FileType>
<Command>
xcopy unsafe\%(Filename).o $(OutputPath) /Y
</Command>
<Outputs>$(OutputPath)%(Filename).o</Outputs>
<BuildInParallel>true</BuildInParallel>
</CustomBuild>
</ItemGroup>
<!-- Build undocked BPF programs that pass verification and build native images for them only when configuration is NOT FuzzerDebug.
Background:
Some projects today are skipped for FuzzerDebug configuration, hence the NuGet package is also not generated for FuzzerDebug.
Expand All @@ -291,6 +312,17 @@
<BuildInParallel Condition="'$(Fuzzer)'!='True' And '$(AddressSanitizer)'!='True'">true</BuildInParallel>
</CustomBuild>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'!='FuzzerDebug' And '$(Platform)'!='$(HostPlatform)'">
<CustomBuild Include="undocked\*.c">
<FileType>CppCode</FileType>
<Command>
$(ClangExec) $(ClangFlags) -I../xdp -I../socket -I./ext/inc -I../../netebpfext -I. -I../../undocked/tests/sample/ext/inc -c undocked\%(Filename).c -o $(OutputPath)%(Filename).o
</Command>
<Outputs>$(OutputPath)%(Filename).o;$(OutputPath)%(Filename)_um.dll;$(OutputPath)%(Filename).sys</Outputs>
<!-- Don't run bpf2c in parallel when built with fuzzing flags as this triggers failures. -->
<BuildInParallel Condition="'$(Fuzzer)'!='True' And '$(AddressSanitizer)'!='True'">true</BuildInParallel>
</CustomBuild>
</ItemGroup>
<!-- For BPF programs that fail verification, build native images without verification only for Debug build. -->
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<CustomBuild Include="unsafe\*.c">
Expand Down Expand Up @@ -359,6 +391,17 @@
<BuildInParallel Condition="'$(Fuzzer)'!='True' And '$(AddressSanitizer)'!='True'">true</BuildInParallel>
</CustomBuild>
</ItemGroup>
<ItemGroup Condition="'$(Analysis)'=='' And '$(Configuration)'!='FuzzerDebug' And '$(Platform)'!='$(HostPlatform)'">
<CustomBuild Include="custom_program_type\*.c">
<FileType>CppCode</FileType>
<Command>
$(ClangExec) $(ClangFlags) -I../xdp -I../socket -I./ext/inc -I../../netebpfext -c custom_program_type\%(Filename).c -o $(OutputPath)%(Filename).o
</Command>
<Outputs>$(OutputPath)%(Filename).o;$(OutputPath)%(Filename)_um.dll;$(OutputPath)%(Filename).sys</Outputs>
<!-- Don't run bpf2c in parallel when built with fuzzing flags as this triggers failures. -->
<BuildInParallel Condition="'$(Fuzzer)'!='True' And '$(AddressSanitizer)'!='True'">true</BuildInParallel>
</CustomBuild>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='FuzzerDebug'">
<CustomBuild Include="custom_program_type\*.c">
<FileType>CppCode</FileType>
Expand Down

0 comments on commit 8020162

Please sign in to comment.