Граф коммитов

28 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 791b98cac2
[dotnet-linker] Enable nullability in numerous files. (#18184)
This required some minor refactorings to simplify the changes, but no
behavior should change.
2023-05-04 07:50:32 +02:00
Sven Boemer 045ccaf3a6
Fixes for .NET 6 linker (#11739)
* Pass custom steps separately from msbuild

* Remove reflection over linker pipeline

* Fix ListExportedSymbols ctor

* Add CoreTypeMapStep

* PR feedback

- Avoid unnecessary tracking of loaded assemblies
   (Use GetLoadedAssembly instead)
- Create extension method on LinkContext
   to avoid conditional code
- Rename dispatchers to reflect when they run

* Fix PreMarkDispatcher

* Fix DoneStep ordering

* Fix other order-dependent steps, test asserts

* Handle cyclic assembly references

* Simplify reference search

By using the already-loaded Assembly closure

* Fix warning number

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* PR feedback

- Undo whitespace changes
- Move comment to a more appropriate place

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-14 20:10:29 -04:00
Sven Boemer dc320a3606
Update to new linker custom steps API (#11374)
* Update to new linker custom steps API

* PR feedback

- Fix indentation
- Add Initialize(LinkContext) to ExceptionalMarkHandler
- Remove unnecessary ifdef
- Use IsSetter/IsGetter
- Use [0] instead of Single()
- Avoid allocating empty collections

* Note override issue

* Clean up comments

* Move `DynamicRegistrationSupported` change earlier, along with the
detection code.

This solve the issue that `ILLink` does a similar job _before_ we have
the chance to disable the dynamic registrar.

* ILLink does not support considering other attributes as `[Preserve]`

when it is itself preserved at the assembly-level.

This ignored test is checking that feature so it cannot be enabled
for `NET`

Added to known breaking changes https://github.com/xamarin/xamarin-macios/issues/8900

* Fix removal of the dynamic registrar on legacy

* Fix IntPtr size inlining

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2021-05-12 12:26:54 -04:00
Sebastien Pouliot ccd769bd9d
[linker] Split CoreTypeMapStep into two parts (#11474)
The newly extracted `RegistrarRemovalTrackingStep` can be used inside
`dotnet-linker` to remove the dynamic registrar (if not required by some
other code).
2021-05-07 08:20:23 -04:00
Rolf Bjarne Kvinge 85fe6340f6
Bump .NET to 6.0.100-preview.2.21114.3. (#10666)
* Bump .NET to 6.0.100-preview.2.21114.3.

* [dotnet-linker] Several steps are now gone, so load our custom step before the new first step (MarkStep).

* [dotnet-linker] Dump the current steps if we fail to call InsertBefore/InsertAfter.

* [dotnet-linker] Load the CollectAssembliesStep as the first step, and make it load every assembly.

* [dotnet] Set InvariantGlobalization=true because that's the only thing .NET supports for now.

* [dotnet-linker] Use recommended workaround for linker's inability to do load assemblies in custom step.

* [tests] Bump version of MSBuild.StructuredLogger to get support for new log version.

Otherwise this happens in tests that read binary logs:

    System.NotSupportedException : Unsupported log file format. Latest supported version is 9, the log file has version 10.

* [introspection] Ignore P/Invokes to QCall for LogThreadPool* P/Invokes.

* [dotnet-linker] Inject a dummy implementation of mono_config_parse_memory as a temporary solution for mono's removal of the same method.
2021-02-23 07:49:09 +01:00
Rolf Bjarne Kvinge 7f0e2449f7 [dotnet-linker] Add a new task that computes the arguments to the AOT compiler. 2021-02-01 14:37:31 +01:00
Rolf Bjarne Kvinge 3dbdc1ea81
[dotnet-linker] Add the RemoveUserResources sub step. (#10456)
* [dotnet-linker] Add the RemoveUserResources sub step.

This comes with a few changes to the RemoveUserResources sub step as well:

* Bail out earlier if we're in the simulator (no need to do any processing at
  all - we know at the very beginning if we're building for the simulator).
* Do a positive simulator check, instead of a negative device check (because
  Mac[Catalyst] are neither devices - so they pass the negative device check).
* Remove all the conditional mtouch/mmp code, and figure out at runtime which
  resource prefixes we need to check for.

It was also necessary to change where steps are added to the pipeline: we have
to remove resources before the OutputStep, but at the same time we have to do
it after the ExtractBindingLibraries step, otherwise the
ExtractBindingLibraries step won't find any binding libraries to extract. So
move the ExtractBindingLibraries, LoadNonSkippedAssemblies and
ListExportedSymbols to before the OutputStep (to keep their internal order),
and then add the RemoveUserResources after those.

This fixes the following link sdk/link all test when running on device:

    BundledResources.ResourcesTest
        [FAIL] Bundled :   No resources
            Expected: 0
            But was:  2

* [tests] Update the BuildInterdependentBindingProjects test now that we're removing resources.
2021-01-19 14:06:25 +01:00
Rolf Bjarne Kvinge cfb32cba09
[dotnet-linker] Link with GSS when building for iOS/Mac Catalyst. (#10414)
* [dotnet-linker] Add support for writing to the same MSBuild output items multiple times.

* Split parts of LinkerConfiguration.WriteOutputForMSBuild into a FlushOutputForMSBuild
  method (the part that does the actual writing).
* Make WriteOutputForMSBuild just store the items in a dictionary.
* Add a DoneStep that runs at the very end and that writes out the MSBuild output
  items.

* [dotnet-linker] Link with GSS when building for iOS/Mac Catalyst.

Add a ComputeNativeBuildFlagsStep, which computes the flags to pass to the native
compiler + native linker. This is currently a very simple implementation, but it
will become more complex as support for missing features are added.

GSS is required because of libSystem.Net.Security.Native.a:

    Undefined symbols for architecture arm64:
      "___gss_c_nt_hostbased_service_oid_desc", referenced from:
          _NetSecurityNative_ImportPrincipalName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_c_nt_user_name_oid_desc", referenced from:
          _NetSecurityNative_ImportUserName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_krb5_cred_no_ci_flags_x_oid_desc", referenced from:
          _NetSecurityNative_InitiateCredSpNego in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitiateCredWithPassword in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_krb5_mechanism_oid_desc", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_ntlm_mechanism_oid_desc", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_AcceptSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_IsNtlmInstalled in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "___gss_spnego_mechanism_oid_desc", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          l___const.NetSecurityNative_AcquireCredSpNego.gss_mech_spnego_OID_set_desc in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_accept_sec_context", referenced from:
          _NetSecurityNative_AcceptSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_acquire_cred", referenced from:
          _NetSecurityNative_InitiateCredSpNego in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_AcquireAcceptorCred in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_acquire_cred_with_password", referenced from:
          _NetSecurityNative_InitiateCredWithPassword in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_delete_sec_context", referenced from:
          _NetSecurityNative_DeleteSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_display_name", referenced from:
          _NetSecurityNative_GetUser in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_display_status", referenced from:
          _NetSecurityNative_DisplayMinorStatus in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_DisplayMajorStatus in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_import_name", referenced from:
          _NetSecurityNative_ImportUserName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_ImportPrincipalName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_indicate_mechs", referenced from:
          _NetSecurityNative_IsNtlmInstalled in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_init_sec_context", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_inquire_context", referenced from:
          _NetSecurityNative_GetUser in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_oid_equal", referenced from:
          _NetSecurityNative_InitSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitSecContextEx in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_AcceptSecContext in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_buffer", referenced from:
          _NetSecurityNative_ReleaseGssBuffer in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_cred", referenced from:
          _NetSecurityNative_ReleaseCred in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_name", referenced from:
          _NetSecurityNative_GetUser in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_ReleaseName in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_release_oid_set", referenced from:
          _NetSecurityNative_IsNtlmInstalled in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_set_cred_option", referenced from:
          _NetSecurityNative_InitiateCredSpNego in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
          _NetSecurityNative_InitiateCredWithPassword in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_unwrap", referenced from:
          _NetSecurityNative_Unwrap in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
      "_gss_wrap", referenced from:
          _NetSecurityNative_Wrap in libSystem.Net.Security.Native.a(pal_gssapi.c.o)
    ld: symbol(s) not found for architecture arm64
2021-01-14 07:50:49 +01:00
Filip Navara 17722deab4
[dotnet] Prevent linking out code referenced by P/Invoke (#10182)
* [dotnet] Generate references.mm to prevent linking out code referenced by P/Invoke

* Address PR feedback: Namespaces.Foundation -> "Foundation."

* Address PR feedback: Simplify hasSymbols

* Reuse ListExportedSymbols step, respect App.SymbolMode

* Address PR feedback

* Workaround for tvOS
2020-12-03 14:04:11 +01:00
Rolf Bjarne Kvinge 831f55796e [dotnet-linker] Add a StoreAttributesStep to store attributes that are removed by the linker.
Add a StoreAttributesStep to store attributes that are removed by the linker, but
that the static registrar needs.

In particular, in .NET 6 the linker removes the System.Runtime.CompilerServices.ExtensionAttribute,
which the static registrar needs to handle category methods properly.

This involved copying and slightly modifying the RemoveAttributesBase code.
2020-11-10 11:41:30 +01:00
Rolf Bjarne Kvinge 1770af11b1
[dotnet-linker] Catch any exceptions from our custom steps and show them using our error reporting logic. (#9954)
* [dotnet-linker] Catch any exceptions from our custom steps and show them using our error reporting logic.

* Letting the linker handle the exceptions will not result in a particularly
  good experience, because the linker will crash.

* We can also show better information, since we have more knowledge about many
  of the exceptions we raise ourselves.

* [dotnet] Make ConfigurationAwareSubStep inherit from ExceptionalSubStep.

This required a minor modification to ExceptionalSubStep to allow for custom reporting.

* [dotnet] Implement ConfigurationAwareStep's exception handling like it's done in ExceptionalSubStep.
2020-10-26 20:16:03 +01:00
Rolf Bjarne Kvinge b111ce0e5c
[dotnet-linker] Add a CollectUnmarkedMembersStep that will keep linked away types around for the static registrar. (#9722)
The static registrar may need access to types that have been linked away, so
store unmarked types so that the static registrar can access them later.

This also makes all the monotouch-test variations green, so enable them all.

Fixes this monotouch-test when all optimizations are enabled:

    MonoTouchFixtures.ObjCRuntime.RegistrarTest
        [FAIL] TestProtocolRegistration :   UIApplicationDelegate/17669
            Expected: True
            But was:  False
                at MonoTouchFixtures.ObjCRuntime.RegistrarTest.TestProtocolRegistration() in xamarin-macios/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs:line 1350
2020-09-29 16:41:47 +02:00
Rolf Bjarne Kvinge a5d06f0d1e
[dotnet-linker] Add a RemoveAttributesStep that will remove some of the attributes we don't need. (#9707)
The .NET linker comes with a way to remove attributes (by passing '--link-attributes
some.xml' as a command-line argument), but this has a few problems:

* We'd need to figure out which attributes to remove before running the linker,
  but the code to figure out which optimizations have been enabled (and which attributes
  should be removed) is in our custom linker code. We'd need to refactor a big chunk
  of code to move this logic out of our custom linker code.
* We need to keep the removed attributes around, because the static registrar needs
  them. Our custom linker logic is not notified for removed attributes, which means
  we'd need to store all attributes for the attribute types we're interested in (as
  opposed to this solution, where we only store attributes that are actually removed).
* The attributes we want removed may contain references to types we don't want
  linked away. If we ask the linker to remove those attributes, then the types may
  be linked away as well, and there's no good way around this.

The end result is that a custom step is the best solution for now.

Fixes these monotouch-test tests when enabling all optimizations:

    Xamarin.BindingTests.ProtocolTest
        [FAIL] OnlyProtocol :   [Protocol] IP1
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.OnlyProtocol() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 47

        [FAIL] ProtocolWithBaseType :   [Protocol] IP2
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.ProtocolWithBaseType() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 79

        [FAIL] ProtocolWithBaseTypeAndModel :   [Protocol] IP3
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.ProtocolWithBaseTypeAndModel() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 115
2020-09-29 09:12:22 +02:00
Rolf Bjarne Kvinge ac496baabb
[dotnet-linker] Make sure to preserve block-related generated code. Fixes #9562. (#9685)
Fixes https://github.com/xamarin/xamarin-macios/issues/9562.

It also fixes this monotouch-test when enabling all optimizations:

    [FAIL] BlockReturnTest : ObjCRuntime.RuntimeException : Invalid DelegateProxyAttribute for the return value for the method MonoTouchFixtures.ObjCRuntime.RegistrarTest+BlockReturnTestClass.MethodReturningBlock: DelegateType (ObjCRuntime.Trampolines+SDRegistrarTestBlock) specifies a type without a 'Handler' field.
2020-09-25 16:57:04 +02:00
Rolf Bjarne Kvinge eb5206f082
[dotnet-linker] Add OptimizeGeneratedCodeSubStep into the pipeline. (#9608)
Fixes these linkall tests:

    Linker.Shared.OptimizeGeneratedCodeTest
        [FAIL] IsARM64CallingConvention :   optimized: no ldsfld instruction
        Expected: 0
        But was:  1
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.IsARM64CallingConvention() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 527
    
    [FAIL] SetupBlockPerfTest :   At least 6x speedup
        Expected: greater than 6
        But was:  1.0876440665344851d
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.SetupBlockPerfTest() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 120

And linkall is now green for .NET/Debug.
2020-09-10 08:30:45 +02:00
Rolf Bjarne Kvinge 4f004e78b3
[dotnet-linker] Add MarkNSObjects into the pipeline. (#9543)
A few compat fixes were necessary to make the code compile and run correctly.

Fixes this startup crash with the linkall test:

    2020-08-27 18:15:09.648352+0200 link all[91128:1963430] *** Assertion failure in void _UIApplicationMainPreparations(int, char **, NSString *__strong, NSString *__strong)(), /Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3920.31.100/UIApplication.m:4765
    2020-08-27 18:15:09.697128+0200 link all[91128:1963430]
    Unhandled Exception:
    Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.
    Native stack trace:
    	0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
    	3   Foundation                          0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    	4   UIKitCore                           0x00007fff48c8baed UIApplicationMain + 1862
    	5   ???                                 0x00000001087d2504 0x0 + 4437386500
    	6   ???                                 0x00000001087d237b 0x0 + 4437386107
    	7   ???                                 0x00000001087cef93 0x0 + 4437372819
    	8   ???                                 0x00000001087cedcb 0x0 + 4437372363
    	9   ???                                 0x00000001087ceec1 0x0 + 4437372609
    	10  libmonosgen-2.0.dylib               0x00000001081a2d7e mono_jit_runtime_invoke + 1911
    	11  libmonosgen-2.0.dylib               0x000000010832ee0a do_runtime_invoke + 80
    	12  libmonosgen-2.0.dylib               0x0000000108331fd0 do_exec_main_checked + 92
    	13  libmonosgen-2.0.dylib               0x00000001081f191e mono_jit_exec + 369
    	14  libxamarin-debug.dylib              0x000000010802badd xamarin_main + 2685
    	15  link all                            0x0000000107f0cced main + 45
    	16  libdyld.dylib                       0x00007fff51a231fd start + 1

       at ObjCRuntime.Runtime.ThrowNSException(IntPtr ns_exception)
       at ObjCRuntime.Runtime.throw_ns_exception(IntPtr exc)
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15
    --- End of stack trace from previous location ---
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15	0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
    	3   Foundation                          0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    	4   UIKitCore                           0x00007fff48c8baed UIApplicationMain + 1862
    	5   ???                                 0x00000001087d2504 0x0 + 4437386500
    	6   ???                                 0x00000001087d237b 0x0 + 4437386107
    	7   ???                                 0x00000001087cef93 0x0 + 4437372819
    	8   ???                                 0x00000001087cedcb 0x0 + 4437372363
    	9   ???                                 0x00000001087ceec1 0x0 + 4437372609
    	10  libmonosgen-2.0.dylib               0x00000001081a2d7e mono_jit_runtime_invoke + 1911
    	11  libmonosgen-2.0.dylib               0x000000010832ee0a do_runtime_invoke + 80
    	12  libmonosgen-2.0.dylib               0x0000000108331fd0 do_exec_main_checked + 92
    	13  libmonosgen-2.0.dylib               0x00000001081f191e mono_jit_exec + 369
    	14  libxamarin-debug.dylib              0x000000010802badd xamarin_main + 2685
    	15  link all                            0x0000000107f0cced main + 45
    	16  libdyld.dylib                       0x00007fff51a231fd start + 1
    2020-08-27 18:15:09.698283+0200 link all[91128:1963430] Unhandled managed exception: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.
    Native stack trace:
    	0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
    	3   Foundation                          0x00007fff258b8c9b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
    	4   UIKitCore                           0x00007fff48c8baed UIApplicationMain + 1862
    	5   ???                                 0x00000001087d2504 0x0 + 4437386500
    	6   ???                                 0x00000001087d237b 0x0 + 4437386107
    	7   ???                                 0x00000001087cef93 0x0 + 4437372819
    	8   ???                                 0x00000001087cedcb 0x0 + 4437372363
    	9   ???                                 0x00000001087ceec1 0x0 + 4437372609
    	10  libmonosgen-2.0.dylib               0x00000001081a2d7e mono_jit_runtime_invoke + 1911
    	11  libmonosgen-2.0.dylib               0x000000010832ee0a do_runtime_invoke + 80
    	12  libmonosgen-2.0.dylib               0x0000000108331fd0 do_exec_main_checked + 92
    	13  libmonosgen-2.0.dylib               0x00000001081f191e mono_jit_exec + 369
    	14  libxamarin-debug.dylib              0x000000010802badd xamarin_main + 2685
    	15  link all                            0x0000000107f0cced main + 45
    	16  libdyld.dylib                       0x00007fff51a231fd start + 1
     (Foundation.MonoTouchException)
       at ObjCRuntime.Runtime.ThrowNSException(IntPtr ns_exception)
       at ObjCRuntime.Runtime.throw_ns_exception(IntPtr exc)
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15
    --- End of stack trace from previous location ---
       at UIKit.UIApplication.Main(String[] args, IntPtr principal, IntPtr delegate)
       at UIKit.UIApplication.Main(String[] args, String principalClassName, String delegateClassName)
       at LinkAll.Application.Main(String[] args) in [...]/xamarin-macios/tests/linker/ios/link all/Main.cs:line 15

    =================================================================
    	Native Crash Reporting
    =================================================================
    Got a abrt while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x108273f92 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    	0x1082207bd - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
    	0x1082737e9 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
    	0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x0 - Unknown
    	0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
    	0x10801979f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
    	0x1082e4980 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
    	0x108220166 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
    	0x10821ea47 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
    	0x10826ea06 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
    	0x1086105b0 - Unknown
    	0x1080194fb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
    	0x108019377 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
    	0x108019333 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_ftnptr_exception_handler
    	0x10821feeb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
    	0x10821ea47 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
    	0x10826ea06 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
    	0x1086105b0 - Unknown
    	0x1087d264b - Unknown
    	0x10869439b - Unknown
    	0x108016c07 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_throw_ns_exception
    	0x10801a1cb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : _ZL17exception_handlerP11NSException
    	0x7fff23e3d36d - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __handleUncaughtException
    	0x7fff50ba8c05 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL15_objc_terminatev
    	0x7fff4f9f6c87 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : _ZSt11__terminatePFvvE
    	0x7fff4f9f940b - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : __cxa_get_exception_ptr
    	0x7fff4f9f93d2 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++abi.dylib : _ZN10__cxxabiv1L22exception_cleanup_funcE19_Unwind_Reason_CodeP17_Unwind_Exception
    	0x7fff50ba8ad6 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL26_objc_exception_destructorPv
    	0x7fff23e3cc88 - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : +[NSException raise:format:arguments:]
    	0x7fff258b8c9b - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
    	0x7fff48c8baed - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
    	0x1087d2504 - Unknown
    	0x1087d237b - Unknown
    	0x1087cef93 - Unknown
    	0x1087cedcb - Unknown
    	0x1087ceec1 - Unknown
    	0x1081a2d7e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    	0x10832ee0a - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : do_runtime_invoke
    	0x108331fd0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : do_exec_main_checked
    	0x1081f191e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libmonosgen-2.0.dylib : mono_jit_exec
    	0x10802badd - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/libxamarin-debug.dylib : xamarin_main
    	0x107f0cced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/2394E0CC-9F77-4BAD-8ADE-6CEE69EF8D6C/link all.app/link all : main
    	0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
2020-08-31 08:38:11 +02:00
Rolf Bjarne Kvinge 56953b143f [dotnet-linker] Add PreserveSmartEnumConversionsSubStep into the pipeline.
Fixes this startup crash in link all:

    2020-08-26 19:56:03.936330+0200 link all[45665:6121665] Could not register the assembly 'link all': ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.get_Signature()
       at Registrar.Registrar.ObjCMethod.get_Trampoline()
       at Registrar.DynamicRegistrar.RegisterMethod(ObjCMethod method)
       at Registrar.DynamicRegistrar.OnRegisterType(ObjCType type)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)
       at Registrar.Registrar.RegisterAssembly(Assembly assembly)
    2020-08-26 19:56:03.939327+0200 link all[45665:6121665] System.AggregateException: One or more errors occurred. (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.) (The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.)
     ---> ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)
       --- End of inner exception stack trace ---
     ---> (Inner Exception #1) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the return value in the method LinkAll.Attributes.SmartConsumer.GetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeReturnType()
       at Registrar.Registrar.VerifyInSdk(List`1& exceptions, ObjCMethod method)
       at Registrar.Registrar.ObjCType.Add(ObjCMethod method, List`1& exceptions)
       at Registrar.Registrar.RegisterTypeUnsafe(Type type, List`1& exceptions)<---

     ---> (Inner Exception #2) ObjCRuntime.RuntimeException: The registrar can't convert from 'LinkAll.Attributes.SmartEnum' to 'Foundation.NSString' for the parameter 'value' in the method LinkAll.Attributes.SmartConsumer.SetSmartEnumValue.
       at Registrar.Registrar.ObjCMethod.get_NativeParameters()
       at Registrar.Registrar.ComputeSignature(Type DeclaringType, MethodBase Method, ObjCMember member, Boolean isCategoryInstance, Boolean isBlockSignature)
       at Registrar.Registrar.ObjCMethod.ComputeSignature()
       at Registrar.Registrar.ObjCMethod.ValidateSignature(List`1& exceptions)<---

    =================================================================
    	Native Crash Reporting
    =================================================================
    Got a abrt while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x10d57eb0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    	0x10d52b437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
    	0x10d57e365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
    	0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x0 - Unknown
    	0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
    	0x10d32478f - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_unhandled_exception_handler
    	0x10d5eef68 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_invoke_unhandled_exception_hook
    	0x10d52ade0 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception_internal
    	0x10d5296c1 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_handle_exception
    	0x10d579582 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libmonosgen-2.0.dylib : mono_amd64_throw_exception
    	0x10d91b5b0 - Unknown
    	0x10d3244eb - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception
    	0x10d324367 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_process_managed_exception_gchandle
    	0x10d336851 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/libxamarin-debug.dylib : xamarin_main
    	0x10d217ced - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/5CB344E3-EC61-4720-92E6-4C8B91A67A85/link all.app/link all : main
    	0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
2020-08-27 20:04:08 +02:00
Rolf Bjarne Kvinge e2f7c2f64f
[dotnet-linker] Add ApplyPreserveAttribute into the pipeline. (#9529)
This means:

* Move the parts of the ApplyPreserveAttribute step that we don't need for.NET
  into a new MobileApplyPreserveAttribute step, and have mtouch and mmp use
  that step instead of the ApplyPreserveAttribute step.

* Copy ApplyPreserveAttributeBase into dotnet-linker from the upstream tuner
  source (with minor modifications) so that our ApplyPreserveAttribute step
  compiles.

* Create a DotNetSubStepDispatcher class that we're going to use as our
  substep dispatcher, create an instance of it and insert it into the list of
  linker steps.

* Also a workaround for the lack of LinkContext.GetAssemblies (): add a step
  that collects all the assemblies and stores them in a list, so that we can
  have our own GetAssemblies implementation.

  I filed a linker issue to see if we can get LinkContext.GetAssemblies ()
  exposed to us: https://github.com/mono/linker/issues/1455.

Fixes this startup crash with the linkall test:

     2020-08-26 19:47:10.219697+0200 link all[32709:6065783] Xamarin.iOS: Fatal error: failed to load the method 'ObjCRuntime.Runtime.Initialize'.

    =================================================================
      Native Crash Reporting
    =================================================================
    Got a abrt while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
      Native stacktrace:
    =================================================================
      0x104007b0e - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
      0x103fb4437 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : mono_handle_native_crash
      0x104007365 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
      0x7fff51c005fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
      0x0 - Unknown
      0x7fff51af0b7c - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
      0x103daad98 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_assertion_message
      0x103dade77 - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_initialize
      0x103dbf80b - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/libxamarin-debug.dylib : xamarin_main
      0x103cd2f0d - /Users/rolf/Library/Developer/CoreSimulator/Devices/289E372A-501C-4499-A1A6-59C5B3B6A9AE/data/Containers/Bundle/Application/4A5F3968-6980-4E90-88A2-2E77AE039C40/link all.app/link all : main
      0x7fff51a231fd - /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start

This is a partial/modified port of the initial linker support (bc88790201)

Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
2020-08-27 18:30:19 +02:00
Rolf Bjarne Kvinge 8ebb66eca0
[dotnet-linker] Print out substeps too when printing pipeline steps. (#9528) 2020-08-27 17:11:02 +02:00
Rolf Bjarne Kvinge ffea143135 [dotnet-linker] Add a Registrar step, and implement support for the partial static registrar.
Add a Registrar step that is responsible for dealing with the registrar during the
build. Currently only supports the dynamic and partial static registrar, the full
static registrar support will come later.
2020-08-21 10:32:56 +02:00
Rolf Bjarne Kvinge 1d303fe856 [dotnet-linker] Add an ExtractBindingLibrariesStep.
This step will extract native libraries from binding assemblies, and adjust the native
linker flags to link with those native libraries.
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 7a446f6531 [dotnet-linker] Add a LoadNonSkippedAssembliesStep.
This step is used to load the result of the linker into our Application/Target/Assembly
instances.
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 4a5dc20338
[dotnet] Only pass a single custom step to the linker. (#9173)
* [dotnet] Only pass a single custom step to the linker.

The linker will load the assemblies with the custom steps once per custom step
argument, which means that each step is effectively in a different assembly,
making it impossible to share state between steps.

This behavior is filed as a linker bug: https://github.com/mono/linker/issues/1314

Until this is fixed, we can just have a single step that injects all the other
steps programmatically.

* [tests] Adjust .NET tests according to new behavior.
2020-07-24 09:20:52 +02:00
Rolf Bjarne Kvinge c6abc2fea1 [dotnet-linker] Add CacheDirectory and ItemsDirectory to the linker configuration. 2020-06-18 15:57:01 +02:00
Rolf Bjarne Kvinge 197026622e [dotnet-linker] Add the MachO.cs file to get the Abi enum.
This also requires adding support for the ErrorHandler machinery, which the
MachO.cs file needs.

I considered extracting the Abi enum from the MachO.cs file, but it's used in
several places (including externally, such as binding-tools-for-swift), which
means this would be a rather disruptive change.

I also considered modifying MachO.cs to make it possible to build without the
ErrorHandler machinery, but since we'll need it all anyway eventually, I
decided against this option as well.
2020-06-18 15:52:16 +02:00
Rolf Bjarne Kvinge 85e3113858
[dotnet-linker] Add support for passing configuration from the MSBuild targets to our linker steps. (#8780)
Add support for passing configuration from the MSBuild targets to our linker
steps using the linker's --custom-data option.

There are just two values being passed now, but this will grow significantly
over time as linker steps are implemented.
2020-06-05 16:04:53 +02:00
Rolf Bjarne Kvinge c06ece7276 Add some documentation. 2020-06-03 09:10:27 +02:00
Rolf Bjarne Kvinge fcd8956d70 [tools] Add dotnet-linker, a project to contain custom linker steps for our net5.0 build. 2020-06-02 15:55:56 +02:00