Skip to content

Commit

Permalink
[wasm] Use response files for emcc invocations
Browse files Browse the repository at this point in the history
This adds response file for the linker command line, which will be the
longest one. And it uses a known name for the response file.

In future, once we have dependency checking, we can use such response
files for that too.

Fixes #51437 .
  • Loading branch information
radical committed Apr 20, 2021
1 parent 4ab71ae commit f63a9d1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,20 @@

<Message Text="Compiling native assets with emcc. This may take a while ..." Importance="High" />
<Exec Command='emcc $(EmccCFlags) "%(_WasmObjectsToBuild.SourcePath)" -c -o "%(_WasmObjectsToBuild.Identity)"' EnvironmentVariables="@(EmscriptenEnvVars)" />
<Exec Command="emcc $(EmccLDFlags) @(_DotnetJSSrcFile->'--js-library &quot;%(Identity)&quot;', ' ') @(_BitcodeFile->'&quot;%(Identity)&quot;', ' ') @(_WasmObjects->'&quot;%(Identity)&quot;', ' ') -o &quot;$(_WasmIntermediateOutputPath)dotnet.js&quot;" EnvironmentVariables="@(EmscriptenEnvVars)" />

<PropertyGroup>
<_EmccLinkerArguments>$(EmccLDFlags)</_EmccLinkerArguments>
<_EmccLinkerArguments>$(_EmccLinkerArguments) @(_DotnetJSSrcFile->'--js-library &quot;%(Identity)&quot;', ' ')</_EmccLinkerArguments>
<_EmccLinkerArguments>$(_EmccLinkerArguments) @(_BitcodeFile->'&quot;%(Identity)&quot;', ' ')</_EmccLinkerArguments>
<_EmccLinkerArguments>$(_EmccLinkerArguments) @(_WasmObjects->'&quot;%(Identity)&quot;', ' ')</_EmccLinkerArguments>
<_EmccLinkerArguments>$(_EmccLinkerArguments) -o &quot;$(_WasmIntermediateOutputPath)dotnet.js&quot;</_EmccLinkerArguments>

<_EmccLinkerResponseFile>$(_WasmIntermediateOutputPath)emcc-link.rsp</_EmccLinkerResponseFile>
</PropertyGroup>
<WriteLinesToFile Lines="$(_EmccLinkerArguments)" File="$(_EmccLinkerResponseFile)" />
<Message Text="Running emcc with $(_EmccLinkerArguments)" Importance="Low" />
<Exec Command="emcc @$(_EmccLinkerResponseFile)" EnvironmentVariables="@(EmscriptenEnvVars)" />

<Exec Command='"$(_WasmOptCommand)" --strip-dwarf "$(_WasmIntermediateOutputPath)dotnet.wasm" -o "$(_WasmIntermediateOutputPath)dotnet.wasm"' Condition="'$(WasmNativeStrip)' == 'true'" IgnoreStandardErrorWarningFormat="true" EnvironmentVariables="@(EmscriptenEnvVars)" />

<ItemGroup>
Expand Down

0 comments on commit f63a9d1

Please sign in to comment.