Skip to content

Commit

Permalink
[dotnet][msbuild] Strip symbols from native executable (#11378)
Browse files Browse the repository at this point in the history
We have to consider (setup and process) `libSystem.Globalization.Native`
in order not to remove the required symbols when stripping the native
executable.

Ignore `libSystem.Globalization.Native` for dotnet / catalyst
ref: #11392
  • Loading branch information
spouliot authored May 2, 2021
1 parent 88554a7 commit 5ef7fb2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<UsingTask TaskName="Xamarin.MacDev.Tasks.CompileNativeCode" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.LinkNativeCode" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.SymbolStrip" AssemblyFile="$(_XamarinTaskAssembly)" />

<!-- Project types and how do we distinguish between them
Expand Down Expand Up @@ -126,6 +127,8 @@
<EnableUnsafeUTF7Encoding Condition="'$(EnableUnsafeUTF7Encoding)' == ''">false</EnableUnsafeUTF7Encoding>
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">false</EventSourceSupport>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == ''">false</HttpActivityPropagationSupport>
<!-- native bits for ICU are not ready for Catalyst - https://github.com/xamarin/xamarin-macios/issues/11392 -->
<InvariantGlobalization Condition="'$(_PlatformName)' == 'MacCatalyst' And '$(InvariantGlobalization)' == ''">true</InvariantGlobalization>
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">true</UseSystemResourceKeys>
<UseNativeHttpHandler Condition="'$(_PlatformName)' != 'macOS' And '$(UseNativeHttpHandler)' == ''">true</UseNativeHttpHandler>
Expand Down Expand Up @@ -643,6 +646,17 @@
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
/>

<!-- remove the `-u` prefix from `_ReferencesLinkerFlags` so we can give the output file to `strip` -->
<WriteLinesToFile SessionId="$(BuildSessionId)" File="$(_MtouchSymbolsList)" Lines="@(_ReferencesLinkerFlags->'%(Identity)'->Substring (2))" Overwrite="true" />

<SymbolStrip
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And '$(_NoSymbolStrip)' == 'false' And '$(IsAppExtension)' == 'false'"
Executable="$(_IntermediateNativeLibraryDir)$(_NativeExecutableName)"
IsFramework="false"
SymbolFile="$(_MtouchSymbolsList)"
/>

<ItemGroup>
<!-- Copy the executable from the intermediate directory to the .app -->
<ResolvedFileToPublish
Expand Down
12 changes: 12 additions & 0 deletions tools/linker/MonoTouch.Tuner/ListExportedSymbols.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@ void ProcessMethod (MethodDefinition method)
addPInvokeSymbol = true;
break;

case "libSystem.Globalization.Native":
case "System.Globalization.Native":
#if NET
// https://github.com/xamarin/xamarin-macios/issues/11392
if (DerivedLinkContext.App.Platform == ApplePlatform.MacCatalyst) {
Driver.Log (4, "Did not add native reference to {0} in {1} referenced by {2} in {3}.", pinfo.EntryPoint, pinfo.Module.Name, method.FullName, method.Module.Name);
break;
}
#endif
addPInvokeSymbol = true;
break;

default:
Driver.Log (4, "Did not add native reference to {0} in {1} referenced by {2} in {3}.", pinfo.EntryPoint, pinfo.Module.Name, method.FullName, method.Module.Name);
break;
Expand Down

6 comments on commit 5ef7fb2

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (no change)

Packages generated

View packages

Test results

1 tests failed, 192 tests passed.

Failed tests

  • introspection/watchOS 32-bits - simulator/Debug (watchOS 5.0): Failed

Pipeline on Agent XAMBOT-1035'
[dotnet][msbuild] Strip symbols from native executable (#11378)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[dotnet][msbuild] Strip symbols from native executable (#11378)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[dotnet][msbuild] Strip symbols from native executable (#11378)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ Tests failed on macOS Mac Mojave (10.14) ❌

Tests failed on Mac Mojave (10.14).

Failed tests are:

  • apitest
  • introspection
  • xammac_tests

Pipeline on Agent
[dotnet][msbuild] Strip symbols from native executable (#11378)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ Tests failed on macOS Mac High Sierra (10.13) ❌

Tests failed on Mac High Sierra (10.13).

Failed tests are:

  • apitest
  • introspection
  • xammac_tests

Pipeline on Agent
[dotnet][msbuild] Strip symbols from native executable (#11378)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS32b). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[dotnet][msbuild] Strip symbols from native executable (#11378)

Please sign in to comment.