Skip to content

Commit a1a1ae7

Browse files
[NativeAOT-LLVM] Enhance unresolved symbol handling (#3118)
* Enhance unresolved symbol handling * Also check of we need explicit --sysroot * Fix libraries tests build
1 parent c106cfe commit a1a1ae7

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

eng/pipelines/runtimelab/install-emscripten.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ git checkout ca7b40ae222a2d8763b6ac845388744b0e57cfb7
1818
./emsdk install 3.1.56
1919
./emsdk activate 3.1.56
2020

21-
2221
if ($CI)
2322
{
2423
Write-Host "Setting EMSDK to '$InstallDir/emsdk'"
2524
Write-Output "##vso[task.setvariable variable=EMSDK]$InstallDir/emsdk"
25+
26+
if ($env:EMSDK_PYTHON)
27+
{
28+
# Workaround for https://github.com/dotnet/runtime/issues/116746
29+
Write-Host "Setting EMSDK_PYTHON to '$env:EMSDK_PYTHON'"
30+
Write-Output "##vso[task.setvariable variable=EMSDK_PYTHON]$env:EMSDK_PYTHON"
31+
}
2632
}
2733

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,9 @@ The .NET Foundation licenses this file to you under the MIT license.
598598
<CustomLinkerArg Condition="'$(WasmHtmlTemplate)' != ''" Include="--shell-file &quot;$(WasmHtmlTemplate)&quot;" />
599599
<CustomLinkerArg Condition="'$(ExportsFile)' != '' and '$([System.IO.File]::ReadAllText($(ExportsFile)))' != ''" Include="-s EXPORTED_FUNCTIONS=@&quot;$(ExportsFile)&quot;" />
600600
<CustomLinkerArg Include="-s ALLOW_MEMORY_GROWTH=1" />
601-
<CustomLinkerArg Include="-s ERROR_ON_UNDEFINED_SYMBOLS=0" />
602601
<CustomLinkerArg Include="-s GLOBAL_BASE=$(IlcWasmGlobalBase)" />
603602
<CustomLinkerArg Include="-s TOTAL_STACK=$(IlcWasmStackSize)" />
603+
<CustomLinkerArg Include="-s ERROR_ON_UNDEFINED_SYMBOLS=0" Condition="'$(IlcTreatWarningsAsErrors)' != 'true'" />
604604
<CustomLinkerArg Condition="'$(WasmEnableJSBigIntIntegration)' == 'true'" Include="-s WASM_BIGINT=1" />
605605
<CustomLinkerArg Condition="'$(IlcLlvmExceptionHandlingModel)' == 'cpp'" Include="-s DISABLE_EXCEPTION_CATCHING=0" />
606606

@@ -612,18 +612,17 @@ The .NET Foundation licenses this file to you under the MIT license.
612612

613613
<!-- wasm-ld only supports listing exports on the command line -->
614614
<ReadLinesFromFile File="$(ExportsFile)" Condition="'$(_targetOS)' == 'wasi' and '$(ExportsFile)' != ''">
615-
<Output TaskParameter="Lines" ItemName="CustomLinkerArgExport" />
615+
<Output TaskParameter="Lines" ItemName="_CustomLinkerArgExport" />
616616
</ReadLinesFromFile>
617617

618618
<ItemGroup Condition="'$(_targetOS)' == 'wasi'" >
619-
<CustomLinkerArg Include="--sysroot=&quot;$(WASI_SDK_PATH.Replace(&quot;\&quot;, &quot;/&quot;))/share/wasi-sysroot&quot;" />
620-
<CustomLinkerArg Include="@(CustomLinkerArgExport->'-Wl,--export=%(Identity)')" />
621-
<!-- TODO-LLVM: change to 'warn-unresolved-symbols' once we have a WASI SDK with https://github.com/llvm/llvm-project/pull/78643. -->
622-
<CustomLinkerArg Include="-Wl,--unresolved-symbols=ignore-all" />
623-
<CustomLinkerArg Include="-lstdc++ -lwasi-emulated-process-clocks -lwasi-emulated-signal -lwasi-emulated-getpid" />
619+
<CustomLinkerArg Include="@(_CustomLinkerArgExport->'-Wl,--export=%(Identity)')" />
620+
<CustomLinkerArg Include="-lstdc++;-lwasi-emulated-process-clocks;-lwasi-emulated-signal;-lwasi-emulated-mman;-lwasi-emulated-getpid" />
624621
<CustomLinkerArg Include="-Wl,--max-memory=2147483648" />
625622
<CustomLinkerArg Include="-Wl,--global-base=$(IlcWasmGlobalBase)" />
626623
<CustomLinkerArg Include="-Wl,-z,stack-size=$(IlcWasmStackSize)" />
624+
<CustomLinkerArg Include="-Wl,--warn-unresolved-symbols" />
625+
<CustomLinkerArg Include="-Wl,--fatal-warnings" Condition="'$(IlcTreatWarningsAsErrors)' == 'true'" />
627626
<CustomLinkerArg Include="-mexec-model=reactor" Condition="'$(NativeLib)' == 'Shared'" />
628627
</ItemGroup>
629628

0 commit comments

Comments
 (0)