Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] improve wasm aot symbolification when stripping isn't enabled #49526

Merged
merged 3 commits into from
Apr 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@
UseLLVM="true"
DisableParallelAot="true"
DedupAssembly="$(_WasmDedupAssembly)"
LLVMPath="$(EMSDK_PATH)\upstream\bin">
LLVMPath="$(EMSDK_PATH)\upstream\bin"
LLVMDebug="dwarfdebug">

<Output TaskParameter="CompiledAssemblies" ItemName="_WasmAssembliesInternal" />
<Output TaskParameter="FileWrites" ItemName="FileWrites" />
</MonoAOTCompiler>
Expand Down Expand Up @@ -279,6 +281,7 @@
<PropertyGroup>
<EmccFlags>$(_DefaultEmccFlags) $(EmccFlags)</EmccFlags>
<EmccFlags>$(EmccFlags) -s DISABLE_EXCEPTION_CATCHING=0</EmccFlags>
<EmccFlags Condition="'$(WasmNativeStrip)' == 'false'">$(EmccFlags) -g</EmccFlags>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a $(WasmNativeDebugSymbols) property that adds the -g. Maybe we should set that to true with the condition here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets do that when me move the options around, I'd like the symbols in asap

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been converting the -g to -g4 for WASM. I've been doing this since it seems that Emscripten requires -g4 in order to generated source maps. See https://emscripten.org/docs/tools_reference/emcc.html.

<EmccFlags Condition="'$(RunAOTCompilation)' == 'true'">$(EmccFlags) -DENABLE_AOT=1 -DDRIVER_GEN=1</EmccFlags>
<EmccFlags Condition="'$(InvariantGlobalization)' == 'true'">$(EmccFlags) -DINVARIANT_GLOBALIZATION=1</EmccFlags>
</PropertyGroup>
Expand Down
9 changes: 8 additions & 1 deletion src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task
/// </summary>
public string? DedupAssembly { get; set; }

/// Debug option in llvm aot mode
/// defaults to "nodebug" since some targes can't generate debug info
/// </summary>
public string? LLVMDebug { get; set; } = "nodebug";

[Output]
public string[]? FileWrites { get; private set; }

Expand Down Expand Up @@ -270,7 +275,9 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths)
{
processArgs.Add("--llvm");

aotArgs.Add($"nodebug"); // can't use debug symbols with LLVM
if (!string.IsNullOrEmpty(LLVMDebug))
aotArgs.Add("nodebug");

aotArgs.Add($"llvm-path={LLVMPath}");
}
else
Expand Down