Skip to content

Commit 16260fb

Browse files
radekdoulikkasperk81jkotas
authored
[wasm][coreclr] Make libs subset build (#114548)
* [wasm][coreclr] initial changes for wasm/corecl BCL build * Make subset libs build without pulling in mono partsg * Build libs on CI * Feedback * Update comment * Update src/libraries/System.Private.CoreLib/src/System/Environment.Browser.cs Co-authored-by: kasperk81 <83082615+kasperk81@users.noreply.github.com> * Feedback * More feedback * Fix build * Fix condition * Simplify condition in _CoreCLRSupportedOS Co-authored-by: Jan Kotas <jkotas@microsoft.com> * Update corelib solution file to include wasm --------- Co-authored-by: kasperk81 <83082615+kasperk81@users.noreply.github.com> Co-authored-by: Jan Kotas <jkotas@microsoft.com>
1 parent 0583b0c commit 16260fb

File tree

13 files changed

+112
-18
lines changed

13 files changed

+112
-18
lines changed

eng/Subsets.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
<!-- Android 32-bit builds blocked by https://github.com/dotnet/runtime/issues/111665 -->
3333
<_CoreCLRSupportedOS Condition="'$(TargetsAndroid)' == 'true' and '$(TargetArchitecture)' != 'arm' and '$(TargetArchitecture)' != 'x86'">true</_CoreCLRSupportedOS>
34+
<_CoreCLRSupportedOS Condition="'$(TargetsBrowser)' == 'true'">true</_CoreCLRSupportedOS>
3435

3536
<_CoreCLRSupportedArch Condition="'$(TargetArchitecture)' != 'armv6' and '$(TargetArchitecture)' != 'ppc64le' and '$(TargetArchitecture)' != 's390x'">true</_CoreCLRSupportedArch>
3637
<CoreCLRSupported Condition="'$(_CoreCLRSupportedOS)' == 'true' and '$(_CoreCLRSupportedArch)' == 'true'">true</CoreCLRSupported>

eng/pipelines/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extends:
125125
- browser_wasm
126126
jobParameters:
127127
nameSuffix: AllSubsets_CoreCLR
128-
buildArgs: -s clr.runtime -rc Release -c Release -lc $(_BuildConfig)
128+
buildArgs: -s clr.runtime+libs -rc Release -c Release -lc $(_BuildConfig)
129129
timeoutInMinutes: 120
130130
condition: >-
131131
or(

src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
<!-- Force System.Private.CoreLib.dll into a special IL output directory -->
1212
<OutputPath>$(RuntimeBinDir)IL\</OutputPath>
1313
<Configurations>Debug;Release;Checked</Configurations>
14-
<Platforms>x64;x86;arm;arm64</Platforms>
14+
<Platforms>x64;x86;arm;arm64;wasm</Platforms>
1515

1616
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
1717

1818
<ILLinkTrimAssembly>true</ILLinkTrimAssembly>
1919
<ILLinkDescriptorsXml>$(IntermediateOutputPath)ILLink.Descriptors.xml</ILLinkDescriptorsXml>
2020
<ILLinkDirectory>$(MSBuildThisFileDirectory)src\ILLink\</ILLinkDirectory>
2121

22-
<FeaturePortableThreadPool>true</FeaturePortableThreadPool>
23-
<FeaturePortableTimer>true</FeaturePortableTimer>
22+
<FeaturePortableThreadPool Condition="'$(TargetsBrowser)' != 'true'">true</FeaturePortableThreadPool>
23+
<FeaturePortableTimer Condition="'$(TargetsBrowser)' != 'true'">true</FeaturePortableTimer>
24+
<FeatureSingleThread Condition="'$(TargetsBrowser)' == 'true'">true</FeatureSingleThread>
2425
</PropertyGroup>
2526

2627
<ItemGroup>
@@ -73,6 +74,9 @@
7374
<PropertyGroup Condition="'$(Platform)' == 'riscv64'">
7475
<DefineConstants>$(DefineConstants);TARGET_RISCV64</DefineConstants>
7576
</PropertyGroup>
77+
<PropertyGroup Condition="'$(Platform)' == 'wasm'">
78+
<DefineConstants>$(DefineConstants);TARGET_WASM</DefineConstants>
79+
</PropertyGroup>
7680

7781
<!-- Configuration specific properties -->
7882
<PropertyGroup Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Checked'">
@@ -281,7 +285,7 @@
281285
<ItemGroup Condition="'$(FeatureCominterop)' != 'true'">
282286
<Compile Include="$(BclSourcesRoot)\Internal\Runtime\InteropServices\ComActivator.PlatformNotSupported.cs" />
283287
</ItemGroup>
284-
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
288+
<ItemGroup Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true'" >
285289
<Compile Include="$(BclSourcesRoot)\Internal\Runtime\InteropServices\InMemoryAssemblyLoader.PlatformNotSupported.cs" />
286290
<Compile Include="$(BclSourcesRoot)\Interop\Unix\Interop.Libraries.cs" />
287291
<Compile Include="$(BclSourcesRoot)\System\Threading\LowLevelLifoSemaphore.Unix.cs" />

src/coreclr/System.Private.CoreLib/System.Private.CoreLib.sln

Lines changed: 69 additions & 0 deletions
Large diffs are not rendered by default.

src/coreclr/System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ class AsmOffsets
5050
public const int SIZEOF__REGDISPLAY = 0xc60;
5151
public const int OFFSETOF__REGDISPLAY__SP = 0xba8;
5252
public const int OFFSETOF__REGDISPLAY__ControlPC = 0xbb0;
53+
#elif TARGET_WASM
54+
public const int SIZEOF__REGDISPLAY = 0x3c;
55+
public const int OFFSETOF__REGDISPLAY__SP = 0x34;
56+
public const int OFFSETOF__REGDISPLAY__ControlPC = 0x38;
5357
#endif
5458

5559
#if TARGET_64BIT
@@ -107,6 +111,10 @@ class AsmOffsets
107111
public const int SIZEOF__REGDISPLAY = 0xc50;
108112
public const int OFFSETOF__REGDISPLAY__SP = 0xba0;
109113
public const int OFFSETOF__REGDISPLAY__ControlPC = 0xba8;
114+
#elif TARGET_WASM
115+
public const int SIZEOF__REGDISPLAY = 0x3c;
116+
public const int OFFSETOF__REGDISPLAY__SP = 0x34;
117+
public const int OFFSETOF__REGDISPLAY__ControlPC = 0x38;
110118
#endif
111119

112120
#if TARGET_64BIT
@@ -148,6 +156,8 @@ class AsmOffsets
148156
public const int SIZEOF__PAL_LIMITED_CONTEXT = 0x220;
149157
#elif TARGET_LOONGARCH64
150158
public const int SIZEOF__PAL_LIMITED_CONTEXT = 0x520;
159+
#elif TARGET_WASM
160+
public const int SIZEOF__PAL_LIMITED_CONTEXT = 0x08;
151161
#endif
152162

153163
#if TARGET_AMD64
@@ -168,6 +178,10 @@ class AsmOffsets
168178
#elif TARGET_LOONGARCH64
169179
public const int OFFSETOF__PAL_LIMITED_CONTEXT__IP = 0x108;
170180
public const int OFFSETOF__PAL_LIMITED_CONTEXT__FP = 0xb8;
181+
#elif TARGET_WASM
182+
// offset to dummy field
183+
public const int OFFSETOF__PAL_LIMITED_CONTEXT__IP = 0x04;
184+
public const int OFFSETOF__PAL_LIMITED_CONTEXT__FP = 0x04;
171185
#endif
172186

173187
// Offsets / sizes that are different in 64 / 32 bit mode

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2750,7 +2750,7 @@
27502750
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.cs" />
27512751
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
27522752
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
2753-
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Unix.cs" Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true'" />
2753+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Unix.cs" Condition="'$(TargetsUnix)' == 'true'" />
27542754
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Portable.cs" Condition="('$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true') or '$(FeatureWasmManagedThreads)' == 'true'" />
27552755
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\RegisteredWaitHandle.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
27562756
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\RegisteredWaitHandle.Unix.cs" Condition="'$(TargetsWindows)' != 'true'" />
@@ -2761,6 +2761,14 @@
27612761
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandleOverlapped.cs" />
27622762
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolCallbackWrapper.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
27632763
</ItemGroup>
2764+
<ItemGroup Condition="('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true') and '$(FeatureWasmManagedThreads)' != 'true'">
2765+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Browser.cs"/>
2766+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.Browser.cs" />
2767+
</ItemGroup>
2768+
<ItemGroup Condition="'$(TargetsBrowser)' == 'true' and '$(FeatureWasmManagedThreads)' != 'true'">
2769+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Browser.cs" />
2770+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\TimerQueue.Browser.cs" />
2771+
</ItemGroup>
27642772
<ItemGroup Condition="'$(FeatureObjCMarshal)' == 'true'">
27652773
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ObjectiveC\ObjectiveCMarshal.cs" />
27662774
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ObjectiveC\ObjectiveCTrackedTypeAttribute.cs" />

src/libraries/System.Private.CoreLib/src/System/Environment.Browser.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,11 @@ private static OperatingSystem GetOSVersion()
3434
/// </summary>
3535
/// <returns>Path of the executable that started the currently executing process</returns>
3636
private static string? GetProcessPath() => null;
37+
38+
#if !MONO
39+
// This is only used for delegate created from native host
40+
private static string[] GetCommandLineArgsNative() => [];
41+
#endif
42+
3743
}
3844
}

0 commit comments

Comments
 (0)