Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/native.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<EmccExportedFunction Include="stackAlloc" />
<EmccExportedFunction Include="stackRestore" />
<EmccExportedFunction Include="stackSave" />
<EmccExportedFunction Include="___stack_pointer" />
</ItemGroup>
<PropertyGroup>
<_EmccExportedRuntimeMethods>@(EmccExportedRuntimeMethod -> '%(Identity)',',')</_EmccExportedRuntimeMethods>
Expand Down
3 changes: 3 additions & 0 deletions eng/native/configureoptimization.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ elseif(CLR_CMAKE_HOST_UNIX)
if(CLR_CMAKE_TARGET_ANDROID)
# -O2 optimization generates faster/smaller code on Android
add_compile_options($<$<CONFIG:Release>:-O2>)
elseif (CLR_CMAKE_TARGET_BROWSER)
# -O2 prevents emscripten metadce from stripping user-requested global exports
add_link_options($<$<CONFIG:Release>:-O2>)
Comment thread
pavelsavara marked this conversation as resolved.
else()
Comment thread
pavelsavara marked this conversation as resolved.
Comment thread
pavelsavara marked this conversation as resolved.
add_compile_options($<$<CONFIG:Release>:-O3>)
endif()
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/hosts/corerun/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ else()
-sEXPORT_ES6=1
-sEXIT_RUNTIME=1
-sEXPORTED_RUNTIME_METHODS=CORERUN,ENV,${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}
-sEXPORTED_FUNCTIONS=_main,___stack_pointer,${CMAKE_EMCC_EXPORTED_FUNCTIONS}
-sEXPORTED_FUNCTIONS=_main,${CMAKE_EMCC_EXPORTED_FUNCTIONS}
-sEXPORT_NAME=createDotnetRuntime
-sENVIRONMENT=node,shell,web
-lexports.js
-Wl,--export=__stack_pointer
-Wl,--error-limit=0)

if (CORERUN_IN_BROWSER)
Expand Down
6 changes: 5 additions & 1 deletion src/mono/browser/build/BrowserWasmApp.CoreCLR.targets
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@

<!-- ES6 module output -->
<_EmccLinkStepArgs Include="-s EXPORT_ES6=1" />
<_EmccLinkStepArgs Include="-lexports.js" />

<!-- Memory configuration -->
<_EmccLinkStepArgs Include="-s INITIAL_MEMORY=$(WasmInitialHeapSize)" />
Expand Down Expand Up @@ -598,6 +597,11 @@
<!-- Extra user flags -->
<_EmccLinkStepArgs Include="$(EmccExtraLDFlags)" />

<!-- -lexports.js to set MINIFY_WASM_EXPORT_NAMES=0 -->
<_EmccLinkStepArgs Include="-lexports.js" />
<!-- Ensure the __stack_pointer global is exported -->
<_EmccLinkStepArgs Include="-Wl,--export=__stack_pointer" />

<!-- Linker error limit -->
<_EmccLinkStepArgs Include="-Wl,--error-limit=0" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/native/corehost/browserhost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ target_link_options(browserhost PRIVATE
-sEXPORT_NAME=createDotnetRuntime
-sENVIRONMENT=web,webview,worker,node,shell
--emit-symbol-map
-lexports.js
-Wl,--export=__stack_pointer
-Wl,--error-limit=0)

target_link_libraries(browserhost PRIVATE
Expand Down
Loading