Skip to content

Commit f59ef7f

Browse files
authored
[wasm/wasi] Fix size regression (#95992)
* [wasm/wasi] Fix size regression Blazor size regression was fixed by: ``` commit ec31705 Author: Ankit Jain <[email protected]> Date: Wed Dec 6 05:36:59 2023 -0500 [wasm] Fix regressed file sizes for blazor (#92664) ``` .. but a subsequent PR created close to that undid some of the changes: ``` commit a128c15 Author: Ankit Jain <[email protected]> Date: Mon Dec 11 15:45:58 2023 -0500 [wasm/wasi] Consolidate build targets (#95775) ``` Essentially, `-g` was being passed to the link, and compile-bc steps. Found in dotnet/perf-autofiling-issues#25891 . * [wasm] Add flag missed in the consolidate PR
1 parent fbf109b commit f59ef7f

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/mono/wasi/build/WasiApp.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@
190190
<_WasiClangCFlags Include="&quot;-I%(_WasmCommonIncludePaths.Identity)&quot;" />
191191
<_WasiClangCFlags Include="-I&quot;$(MicrosoftNetCoreAppRuntimePackRidNativeDir.Replace('\', '/'))include&quot;" />
192192

193+
<_WasiClangCFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
194+
193195
<_WasiClangCFlags Condition="'@(WasiAfterRuntimeLoadedDeclarations)' != ''"
194196
Include="-D WASI_AFTER_RUNTIME_LOADED_DECLARATIONS=&quot;@(WasiAfterRuntimeLoadedDeclarations, ' ')&quot;" />
195197
<_WasiClangCFlags Condition="'@(WasiAfterRuntimeLoadedCalls)' != ''"

src/mono/wasm/build/BrowserWasmApp.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<WasmEnableLegacyJsInterop Condition="'$(WasmEnableLegacyJsInterop)' == ''">true</WasmEnableLegacyJsInterop>
3232
<WasmEnableJsInteropByValue Condition="'$(WasmEnableJsInteropByValue)' == '' and ( '$(WasmEnableThreads)' == 'true' or '$(MonoWasmBuildVariant)' == 'multithread' )">true</WasmEnableJsInteropByValue>
3333
<WasmEnableJsInteropByValue Condition="'$(WasmEnableJsInteropByValue)' == ''">false</WasmEnableJsInteropByValue>
34-
<WasmNativeDebugSymbols Condition="'$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
3534

3635
<!-- Temporarily `false`, till sdk gets a fix for supporting the new file -->
3736
<WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == '' and '$(RunAOTCompilation)' != 'true'">false</WasmEmitSymbolMap>
@@ -288,7 +287,7 @@
288287

289288
<_EmccCommonFlags Include="$(_DefaultEmccFlags)" />
290289
<_EmccCommonFlags Include="$(EmccFlags)" />
291-
<_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
290+
<_EmccCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" />
292291
<_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" />
293292
<_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
294293
<_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
@@ -317,11 +316,12 @@
317316
<_EmccCFlags Include="-emit-llvm" />
318317

319318
<_EmccCFlags Include="&quot;-I%(_EmccIncludePaths.Identity)&quot;" />
319+
<_EmccCFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
320320

321321
<!-- Adding optimization flag at the top, so it gets precedence -->
322322
<_EmccLDFlags Include="$(WasmLinkOptimizationFlag)" />
323323
<_EmccLDFlags Include="@(_EmccCommonFlags)" />
324-
<_EmccLDFlags Include="-s EXPORT_ES6=1" />
324+
<_EmccLDFlags Include="-s EXPORT_ES6=1 -lexports.js" />
325325
<_EmccLDFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'" Include="-s EXPORT_EXCEPTION_HANDLING_HELPERS=1" />
326326

327327
<_RuntimeCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" />

src/mono/wasm/build/WasmApp.Common.targets

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
$(PrepareInputsForWasmBuildDependsOn);
118118
_SetupToolchain;
119119
_SetWasmBuildNativeDefaults;
120-
_SetWasmNativeStripDefault;
121120
_GetDefaultWasmAssembliesToBundle;
122121
_WasmGetRuntimeConfigPath;
123122
_ReadWasmProps;
@@ -516,7 +515,6 @@
516515

517516
<WasmBuildNative Condition="'$(WasmBuildNative)' == '' and @(NativeFileReference->Count()) > 0" >true</WasmBuildNative>
518517
<WasmBuildNative Condition="'$(WasmBuildNative)' == '' and '$(WasmSingleFileBundle)' == 'true'">true</WasmBuildNative>
519-
<WasmBuildNative Condition="'$(WasmBuildNative)' == ''">false</WasmBuildNative>
520518
</PropertyGroup>
521519

522520
<!-- When Publishing -->
@@ -531,15 +529,20 @@
531529

532530
<!-- default to relinking in Release config -->
533531
<WasmBuildNative Condition="'$(WasmBuildNative)' == '' and '$(Configuration)' == 'Release'">true</WasmBuildNative>
532+
</PropertyGroup>
534533

534+
<PropertyGroup>
535535
<WasmBuildNative Condition="'$(WasmBuildNative)' == ''">false</WasmBuildNative>
536536
</PropertyGroup>
537-
</Target>
538537

539-
<Target Name="_SetWasmNativeStripDefault" Condition="'$(WasmNativeStrip)' == ''">
538+
<!-- Default with nothing set: Build+relink+config=debug -->
539+
<PropertyGroup Condition="'$(WasmNativeDebugSymbols)' == '' and '$(WasmNativeStrip)' == '' and '$(WasmBuildingForNestedPublish)' != 'true' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug'">
540+
<WasmNativeDebugSymbols>true</WasmNativeDebugSymbols>
541+
<WasmNativeStrip>false</WasmNativeStrip>
542+
</PropertyGroup>
543+
540544
<PropertyGroup>
541-
<!-- Build+relink+config=debug -->
542-
<WasmNativeStrip Condition="'$(WasmBuildingForNestedPublish)' != 'true' and '$(WasmBuildNative)' == 'true' and '$(Configuration)' == 'Debug'">false</WasmNativeStrip>
545+
<WasmNativeDebugSymbols Condition="'$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols>
543546
<WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">true</WasmNativeStrip>
544547
</PropertyGroup>
545548
</Target>

0 commit comments

Comments
 (0)