Skip to content

Commit

Permalink
Suppress export name minification (#95613)
Browse files Browse the repository at this point in the history
By default in specific circumstances emscripten will minify export names, which breaks things like getRawCwrap. We can suppress this with `-lexports.js`.
Fixes #94939. See emscripten-core/emscripten#20762
  • Loading branch information
kg authored Dec 6, 2023
1 parent 71f3bf1 commit 69d5d3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
<!-- Adding optimization flag at the top, so it gets precedence -->
<_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" />
<_EmccLDFlags Include="@(_EmccCommonFlags)" />
<_EmccLDFlags Include="-s EXPORT_ES6=1" />
<_EmccLDFlags Include="-s EXPORT_ES6=1 -lexports.js" />
<_EmccLDFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'" Include="-s EXPORT_EXCEPTION_HANDLING_HELPERS=1" />

<_DriverCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" />
Expand Down
3 changes: 2 additions & 1 deletion src/mono/wasm/wasm.proj
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@
<CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Debug'" >$(CMakeConfigurationEmccFlags) -s ASSERTIONS=1 </CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Release'">-O2</CMakeConfigurationLinkFlags>

<CMakeConfigurationLinkFlags>$(CMakeConfigurationLinkFlags) -s EXPORT_ES6=1</CMakeConfigurationLinkFlags>
<!-- -lexports.js has the magical property of disabling minification of export names -->
<CMakeConfigurationLinkFlags>$(CMakeConfigurationLinkFlags) -s EXPORT_ES6=1 -lexports.js</CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(CMakeConfigurationLinkFlags) -msimd128</CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags Condition="'$(MonoWasmThreads)' == 'true'">$(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth</CMakeConfigurationLinkFlags>
<CMakeConfigurationLinkFlags >$(CMakeConfigurationLinkFlags) --emit-symbol-map</CMakeConfigurationLinkFlags>
Expand Down

0 comments on commit 69d5d3f

Please sign in to comment.