[macos] Add unsupported force-unsupported-linker option to mmp (#2449)

- This option disables the check that prevents linking on non-modern profiles
- Due to System.Configuration, this is unsafe in general. It may cause assorted runtime crashes.
This commit is contained in:
Chris Hamons 2017-08-09 09:39:04 -05:00 коммит произвёл GitHub
Родитель ea73f99112
Коммит 35ae8318cd
2 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -714,6 +714,20 @@ namespace Xamarin.MMP.Tests
TI.TestUnifiedExecutable (test);
});
}
[Test]
public void UnifiedFull_AllowsLinking_WithForceFlag ()
{
RunMMPTest (tmpDir => {
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) {
XM45 = true,
CSProjConfig = "<LinkMode>Full</LinkMode>"
};
TI.TestUnifiedExecutable (test, shouldFail: true);
test.CSProjConfig = test.CSProjConfig + "<MonoBundlingExtraArgs>--force-unsupported-linker</MonoBundlingExtraArgs>";
TI.TestUnifiedExecutable (test);
});
}
}
}

Просмотреть файл

@ -90,6 +90,7 @@ namespace Xamarin.Bundler {
static LinkerOptions linker_options;
static bool? disable_lldb_attach = null;
static string machine_config_path = null;
static bool bypass_linking_checks = false;
static bool arch_set = false;
static string arch = "i386";
@ -348,6 +349,7 @@ namespace Xamarin.Bundler {
{ "http-message-handler=", "Specify the default HTTP Message Handler", v => { http_message_provider = v; }},
{ "extension", "Specifies an app extension", v => is_extension = true },
{ "allow-unsafe-gac-resolution", "Allow MSBuild to resolve from the System GAC", v => {} , true }, // Used in Xamarin.Mac.XM45.targets and must be ignored here. Hidden since it is a total hack. If you can use it, you don't need support
{ "force-unsupported-linker", "Bypass safety checkes preventing unsupported linking options.", v => bypass_linking_checks = true , true }, // Undocumented option for a reason, You get to keep the pieces when it breaks
{ "disable-lldb-attach=", "Disable automatic lldb attach on crash", v => disable_lldb_attach = ParseBool (v, "disable-lldb-attach")},
{ "machine-config=", "Custom machine.config file to copy into MonoBundle/mono/4.5/machine.config. Pass \"\" to copy in a valid \"empty\" config file.", v => machine_config_path = v },
{ "runregistrar:", "Runs the registrar on the input assembly and outputs a corresponding native library.",
@ -482,7 +484,7 @@ namespace Xamarin.Bundler {
throw new Exception ("IsClassic/IsUnified/IsUnifiedMobile/IsUnifiedFullSystemFramework/IsUnifiedFullXamMacFramework logic regression");
ValidateXamarinMacReference ();
if (IsUnifiedFullSystemFramework || IsUnifiedFullXamMacFramework) {
if (!bypass_linking_checks && (IsUnifiedFullSystemFramework || IsUnifiedFullXamMacFramework)) {
switch (App.LinkMode) {
case LinkMode.None:
case LinkMode.Platform: