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

6 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot 3511995fd7
[linker] Obsolete 'LinkerSafeAttribute' in favor of `AssemblyMetadata` (#11229)
In this case we can obsolete the attribute on both legacy and dotnet
since the replacement attribute is available on both. However this does
require a small update to the legacy linker (and is part of the PR).

Fix https://github.com/xamarin/xamarin-macios/issues/10674
2021-04-16 15:06:49 -04:00
Rolf Bjarne Kvinge 0e56df74a4
[tools] Simplify code a little bit by making DerivedLinkContext.StaticRegistrar a fetch property instead of a push property (#9677) 2020-09-21 17:54:23 +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 392200d930
[mtouch/mmp] Share numerous command-line arguments. (#8599)
* [mtouch/mmp] Share Application.IsDualBuild, Is32Build and Is64Build.

* [mtouch/mmp] Share --tls-provider and --http-message-handler.

* [mtouch/mmp] Share --force.

* [mtouch/mmp] Share --cache.

* [mtouch/mmp] Share --nolink, --linksdkonly, --linkplatform and --linkskip.

* [mtouch/mmp] Share --i18n.

* [mtouch/mmp] Share --xml.

* [mtouch/mmp] Share --registrar and --runregistrar.

* [mtouch/mmp] Share --warn-on-type-ref.

* [mtouch/mmp] Share --sdk.

* [mtouch/mmp] Share --debug.

* [mtouch/mmp] Share --reference, and deprecate -r|--ref and -a|--assembly.

* [mtouch/mmp] Share --targetver, and deprecate mmp's --minos.

* [msbuild] Adjust tests after switching to use --reference instead of -r.

* Update according to review.

* [mmp] Remove --registrar:il.

The IL generator was what MonoMac had before the dynamic/static registrar code
got shared between MonoTouch and MonoMac. The IL registrar been gone for
years, and as far as I know nobody ever used --registrar:il, even though it
was provided as a compatibility option in the beginning (we still had the IL
registrar around for a while after adding the static+dynamic registrars, until
it was completely replaced by the dynamic registrar).

So just remove this option, if anyone ever used it they can replace it with
--registrar:dynamic.

* [mtouch/mmp] Keep bundler-specific code in its corresponding file.
2020-05-19 15:30:38 +02:00
Rolf Bjarne Kvinge 76fc9dc3bf
Improve our error handling code. (#8591)
* Move much of ErrorHandler.cs into a partial class in ErrorHandler.tools.cs,
  which is referenced by mtouch and mmp (but not our runtime).
* Add ErrorHandler.runtime.cs for runtime-specific bits, including a simpler
  version of ErrorHandler.Show. In particular this gets rid of the call to
  Environment.Exit, which should never happen at runtime.
* Rename MonoTouchException and MonoMacException to ProductException, which
  allows us to remove a lot of ifdefs.
* This required moving Application.LoadSymbols and Target.LoadSymbols to
  shared mtouch/mmp code.
2020-05-14 16:45:05 +02:00
Rolf Bjarne Kvinge 570f5ad8a3
[mtouch/mmp] Rework the project files. (#8575)
* Files outside the project directory now show up with a much more logical
  name in the IDE. External files have a link target which is relative to the
  root xamarin-macios directory, and files included from the mono archive show
  up as such as well.
* Rename a few mtouch/mmp-specific files to contain 'mtouch' or 'mmp' in the
  filename, to avoid having multiple files in the projects with the same name
  (it's confusing every time you search for a filename in the IDE and get
  multiple filenames where only the directory is different).
* Add a tools.sln that contains only the mtouch and mmp projects. This makes
  it easier to work with both mtouch and mmp and the same time, while not
  making VSfM unbearably slow by loading many projects in the same solution.
2020-05-12 16:37:43 +02:00