Skip to content

Commit

Permalink
[wasm] Do not use link flags for bitcode compilation (dotnet#101397)
Browse files Browse the repository at this point in the history
* [wasm] Do not use link flags for bitcode compilation

This avoids errors like:

    /root/helix/work/correlation/build/wasm-shared/WasmApp.Common.targets(832,5): error : emcc: warning: linker setting ignored during compilation: 'EXPORT_ES6' [-Wunused-command-line-argument] [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]
    /root/helix/work/correlation/build/wasm-shared/WasmApp.Common.targets(832,5): error : emcc: warning: linker setting ignored during compilation: 'EXPORT_EXCEPTION_HANDLING_HELPERS' [-Wunused-command-line-argument] [/root/helix/work/workitem/e/publish/ProxyProjectForAOTOnHelix.proj]

* Rename _BitcodeLDFlags to _BitcodeCompileFlags

Update the comment as well.

_BitcodeLDFlags were used only for the BC compilation. This way
we keep the possibility to add extra flags via EmccExtraBitcodeCompilationFlags and
WasiClangExtraBitcodeCompileFlags.
  • Loading branch information
radekdoulik authored and michaelgsharp committed May 8, 2024
1 parent 27a328a commit 6c90aae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/mono/browser/build/BrowserWasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@

<Target Name="_BrowserWasmBeforeWriteCompileBitcodeRsp" BeforeTargets="_WasmWriteRspForCompilingBitcode">
<ItemGroup>
<_BitcodeLDFlags Include="@(_EmccLDFlags)" />
<_BitcodeLDFlags Include="$(EmccExtraBitcodeLDFlags)" />
<_BitcodeCompileFlags Include="@(_EmccCommonFlags)" />
<_BitcodeCompileFlags Include="$(EmccExtraBitcodeCompilationFlags)" />
</ItemGroup>
</Target>

Expand Down
4 changes: 2 additions & 2 deletions src/mono/wasi/build/WasiApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@
<!-- FIXME: merge with some other target -->
<Target Name="_WasiBeforeWriteRspForCompilingBitcodeRsp" BeforeTargets="_WasmWriteRspForCompilingBitcode">
<ItemGroup>
<_BitcodeLDFlags Include="@(_WasiClangLDFlags)" />
<_BitcodeLDFlags Include="$(WasiClangExtraBitcodeLDFlags)" />
<_BitcodeCompileFlags Include="@(_WasiClangCommonFlags)" />
<_BitcodeCompileFlags Include="$(WasiClangExtraBitcodeCompileFlags)" />
</ItemGroup>
</Target>

Expand Down
4 changes: 2 additions & 2 deletions src/mono/wasm/build/WasmApp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,11 @@
<Target Name="_WasmSelectRuntimeComponentsForLinking" Condition="'$(WasmIsWorkloadAvailable)' == 'true'" DependsOnTargets="_MonoSelectRuntimeComponents" />

<!--
Inputs: @(_BitcodeLDFlags), $(_WasmCompileBitcodeRsp)
Inputs: @(_BitcodeCompileFlags), $(_WasmCompileBitcodeRsp)
Outputs: file @(_WasmCompileBitcodeRsp
-->
<Target Name="_WasmWriteRspForCompilingBitcode">
<WriteLinesToFile Lines="@(_BitcodeLDFlags)" File="$(_WasmCompileBitcodeRsp)" Overwrite="true" WriteOnlyWhenDifferent="true" />
<WriteLinesToFile Lines="@(_BitcodeCompileFlags)" File="$(_WasmCompileBitcodeRsp)" Overwrite="true" WriteOnlyWhenDifferent="true" />
<ItemGroup>
<FileWrites Include="$(_WasmCompileBitcodeRsp)" />
</ItemGroup>
Expand Down

0 comments on commit 6c90aae

Please sign in to comment.