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

[NativeAOT-LLVM] Add WasmExternalDwarf property to create an external_debug_info section #2786

Open
wants to merge 5 commits into
base: feature/NativeAOT-LLVM
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@

<Delete Files="$(PublishDir)\$(TargetName).wasm" Condition="'$(_targetOS)' == 'browser' and '$(DotNetJsApi)' != 'true'"/>
<Copy SourceFiles="$(NativeOutputPath)$(TargetName).wasm" DestinationFolder="$(PublishDir)" Condition="'$(_targetOS)' == 'browser' and '$(DotNetJsApi)' != 'true'"/>


<Delete Files="$(PublishDir)\$(TargetName).debug.wasm" Condition="'$(_targetOS)' == 'browser' and '$(DotNetJsApi)' != 'true'"/>
<Copy SourceFiles="$(NativeOutputPath)$(TargetName).debug.wasm" DestinationFolder="$(PublishDir)" Condition="'$(_targetOS)' == 'browser' and '$(DotNetJsApi)' != 'true'"/>
Comment on lines +110 to +111

Choose a reason for hiding this comment

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

This should happen for DotNetJsApi as well and check whether the .debug.wasm file is present to copy, ideally using $(WasmSymbolFile).


<ItemGroup>
<_FilesToCopyToNative Include="$(NativeOutputPath)\dotnet.native.js" />
<_FilesToCopyToNative Include="$(NativeOutputPath)\dotnet.native.wasm" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ The .NET Foundation licenses this file to you under the MIT license.

<NativeObject>$(NativeIntermediateOutputPath)$(TargetName)$(NativeObjectExt)</NativeObject>
<NativeBinary Condition="'$(NativeBinary)' == ''">$(NativeOutputPath)$(TargetName)$(NativeBinaryExt)</NativeBinary>
<WasmBinary Condition="'$(_targetArchitecture)' == 'wasm'">$(NativeOutputPath)$(TargetName).wasm</WasmBinary>
yowl marked this conversation as resolved.
Show resolved Hide resolved
<IlcExportUnmanagedEntrypoints Condition="'$(IlcExportUnmanagedEntrypoints)' == '' and '$(NativeLib)' == 'Shared'">true</IlcExportUnmanagedEntrypoints>
<ExportsFile Condition="$(ExportsFile) == '' and '$(BuildingFrameworkLibrary)' != 'true'">$(NativeIntermediateOutputPath)$(TargetName)$(ExportsFileExt)</ExportsFile>

Expand Down Expand Up @@ -390,9 +391,11 @@ The .NET Foundation licenses this file to you under the MIT license.
<ItemGroup>
<LlvmObjects Include="@(_IlcProducedFiles)" Condition="'%(Extension)' == '$(LlvmObjectExt)'">
<NativeObject>%(RelativeDir)%(Filename)$(NativeObjectExt)</NativeObject>
<DwarfObject>&quot;%(RelativeDir)%(Filename).dwo&quot;</DwarfObject>
</LlvmObjects>
<NativeObjects Include="@(_IlcProducedFiles)" Condition="'%(Extension)' == '$(NativeObjectExt)'" />
<NativeObjects Include="@(LlvmObjects->'%(NativeObject)')" />
<DwarfObjects Include="@(LlvmObjects->'%(DwarfObject)')" />
yowl marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
</Target>

Expand Down Expand Up @@ -444,7 +447,7 @@ The .NET Foundation licenses this file to you under the MIT license.
<PropertyGroup Condition="'$(_targetOS)' == 'wasi'">
<WasmCompilerPath>&quot;$(WASI_SDK_PATH)/bin/clang++&quot;</WasmCompilerPath>
<WasmLinkerPath>&quot;$(WASI_SDK_PATH)/bin/clang&quot;</WasmLinkerPath>
</PropertyGroup>
</PropertyGroup>

<!-- Invoke the compilers in parallel. -->
<ItemGroup>
Expand Down Expand Up @@ -537,6 +540,7 @@ The .NET Foundation licenses this file to you under the MIT license.

<PropertyGroup>
<IlcIsLibLikeApp Condition="'$(IlcIsLibLikeApp)' == '' and ('$(NativeLib)' != '' or '$(CustomNativeMain)' != '')">true</IlcIsLibLikeApp>
<WasmSymbolFile>$([System.IO.Path]::ChangeExtension('$(NativeBinary)', '.debug.wasm'))</WasmSymbolFile>
</PropertyGroup>

<ItemGroup Condition="'$(InvariantGlobalization)' != 'true'">
Expand Down Expand Up @@ -587,6 +591,7 @@ The .NET Foundation licenses this file to you under the MIT license.
<CustomLinkerArg Include="-s TOTAL_STACK=$(IlcWasmStackSize)" />
<CustomLinkerArg Condition="'$(WasmEnableJSBigIntIntegration)' == 'true'" Include="-s WASM_BIGINT=1" />
<CustomLinkerArg Condition="'$(IlcLlvmExceptionHandlingModel)' == 'cpp'" Include="-s DISABLE_EXCEPTION_CATCHING=0" />
<CustomLinkerArg Condition="'$(StripSymbols)' == 'true'" Include="-gseparate-dwarf=&quot;$(WasmSymbolFile)&quot;" />
Copy link

@SingleAccretion SingleAccretion Nov 21, 2024

Choose a reason for hiding this comment

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

Hmm, does this embeds an absolute path, doesn't it. I think it would better to embed a relative path, i. e. just the file name. Otherwise I don't see it working even in our case where we copy from /native to /publish.

Choose a reason for hiding this comment

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

Actually, testing what this property does, this in fact the correct way to use it. Using an absolute path results in the relative path, and using a relative path result in something that is relative to the current working directory. Tricky but workable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow the outcome of the comment here. It is ok as is? I think it was working when I tested it.

Choose a reason for hiding this comment

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

It is ok as is?

Yes.


<CustomLinkerArg Include="$(EmccFlags)" />
<CustomLinkerArg Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" />
Expand Down