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

Allow the icu native code to be linked out when invariant globalization is enabled. #48120

Merged
merged 10 commits into from
Feb 16, 2021
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<linker>
<assembly fullname="System.Private.CoreLib">
<type fullname="Interop/Globalization">
<!-- Internal API used by tests only. -->
<method name="GetICUVersion" />
</type>
<type fullname="System.Threading.ThreadPoolBoundHandle">
<!-- Workaround to keep .interfaceimpl even though this type
is not instantiated on unix:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<linker>
<assembly fullname="System.Private.CoreLib">
<type fullname="Interop/Globalization">
<!-- Internal API used by tests only. -->
<method name="GetICUVersion" />
</type>
</assembly>
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<ILLinkSubstitutionsXmls Include="$(ILLinkSharedDirectory)ILLink.Substitutions.NoX86Intrinsics.xml" Condition="'$(SupportsX86Intrinsics)' != 'true'" />
<ILLinkLinkAttributesXmls Include="$(ILLinkSharedDirectory)ILLink.LinkAttributes.Shared.xml" />
</ItemGroup>
<PropertyGroup>
<ILLinkTrimXmlLibraryBuild>$(ILLinkSharedDirectory)ILLinkTrim_LibraryBuild.xml</ILLinkTrimXmlLibraryBuild>
Copy link
Member

Choose a reason for hiding this comment

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

Is there some reason we aren't changing the eng/illink tasks to use ILLink/ILLink.Descriptors.LibraryBuild.xml for this sort of thing by default? Does it make sense to generalize the ILLink patterns for runtime?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's already generalized but SPC is special because it has shared part

</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Internal\AssemblyAttributes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Internal\Console.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
# FIXME: Rest of the flags from configure.ac
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(HOST_BROWSER 1)
add_definitions(-DNO_GLOBALIZATION_SHIM)
add_definitions(-D_THREAD_SAFE)
set(DISABLE_EXECUTABLES 1)
# FIXME: Is there a cmake option for this ?
Expand Down
12 changes: 6 additions & 6 deletions src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- $(WasmProfilers) - Profilers to use
- $(AOTMode) - Defaults to `LLVMOnly`
- $(AOTProfilePath) - profile data file to be used for profile-guided optimization
- $(WasmInvariantGlobalization)
- $(InvariantGlobalization) - Whenever to disable ICU. Defaults to false.

- $(WasmResolveAssembliesBeforeBuild) - Resolve the assembly dependencies. Defaults to false
- $(WasmAssemblySearchPaths) - used for resolving assembly dependencies
Expand Down Expand Up @@ -156,7 +156,7 @@
<Error Condition="'$(WasmMainJSPath)' == ''" Text="%24(WasmMainJSPath) property needs to be set" />

<PropertyGroup>
<WasmIcuDataFileName Condition="'$(WasmInvariantGlobalization)' != 'true'">icudt.dat</WasmIcuDataFileName>
<WasmIcuDataFileName Condition="'$(InvariantGlobalization)' != 'true'">icudt.dat</WasmIcuDataFileName>

<_HasDotnetWasm Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.wasm'">true</_HasDotnetWasm>
<_HasDotnetJs Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js'">true</_HasDotnetJs>
Expand All @@ -167,15 +167,15 @@
<WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native\dotnet.wasm" Condition="'$(_HasDotnetWasm)' != 'true'" />
<WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native\dotnet.js" Condition="'$(_HasDotnetJs)' != 'true'" />

<WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native\$(WasmIcuDataFileName)" Condition="'$(WasmInvariantGlobalization)' != 'true'" />
<WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native\$(WasmIcuDataFileName)" Condition="'$(InvariantGlobalization)' != 'true'" />
<WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native\dotnet.timezones.blat" />
</ItemGroup>

<WasmAppBuilder
AppDir="$(WasmAppDir)"
MainJS="$(WasmMainJSPath)"
Assemblies="@(_WasmAssemblies)"
InvariantGlobalization="$(WasmInvariantGlobalization)"
InvariantGlobalization="$(InvariantGlobalization)"
SatelliteAssemblies="@(WasmSatelliteAssemblies)"
FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)"
IcuDataFileName="$(WasmIcuDataFileName)"
Expand Down Expand Up @@ -250,8 +250,8 @@
<_WasmRuntimePackNativeLibs Include="libSystem.Native.a"/>
<_WasmRuntimePackNativeLibs Include="libSystem.IO.Compression.Native.a"/>
<_WasmRuntimePackNativeLibs Include="libmono-profiler-aot.a"/>
<_WasmRuntimePackNativeLibs Include="libicuuc.a"/>
<_WasmRuntimePackNativeLibs Include="libicui18n.a"/>
<_WasmRuntimePackNativeLibs Include="libicuuc.a" Condition="'$(InvariantGlobalization)' != 'true'" />
<_WasmRuntimePackNativeLibs Include="libicui18n.a" Condition="'$(InvariantGlobalization)' != 'true'" />
<_WasmObjects Include="@(_WasmRuntimePackNativeLibs->'$(MicrosoftNetCoreAppRuntimePackRidDir)\native\%(FileName)%(Extension)')" />

<_WasmObjects Include="$(_WasmIntermediateOutputPath)driver.o"/>
Expand Down