-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
LinkContext.GetAssemblies should be exposed in the reference assembly #1455
Labels
Comments
61 tasks
rolfbjarne
added a commit
to rolfbjarne/xamarin-macios
that referenced
this issue
Aug 27, 2020
…blies () 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: dotnet/linker#1455.
rolfbjarne
added a commit
to dotnet/macios
that referenced
this issue
Aug 27, 2020
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: dotnet/linker#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 (bc88790) Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
Having the custom step is the right approach instead of using GetAssemblies. We could add the API but there is high-risk it will be used wrongly as in your ApplyPreserveAttribute.cs case. |
21 tasks
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Xamarin.iOS needs the list of assemblies that are loaded in the linker, and the lack of LinkContext.GetAssemblies makes this more complicated than it should be (we have a custom step we inject after the LoadReferencesStep that overrides ProcessAssembly and collects the assemblies).
Adding LinkContext.GetAssemblies to the reference linker assembly would make this extra code unnecessary.
This is one place where we're using LinkContext.GetAssemblies now:
https://github.com/xamarin/xamarin-macios/blob/f613eacd9b80838924571e8e8452596a3fb50e0f/tools/linker/ApplyPreserveAttribute.cs#L32-L39
The text was updated successfully, but these errors were encountered: