From e73d71cbe8e4720cc640884eb665071bee21a1ea Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 25 Jan 2017 11:51:53 +0100 Subject: [PATCH] [mtouch] Build into arch-specific temporary directories, instead of having arch-specific filenames. This makes dylibs automatically have the correct dylib id, which means no fixups are required. For instance: we'd build libpinvokes.armv7.dylib from libpinvokes.armv7.m, which by default ends up with a dylib id of "libpinvokes.armv7.dylib". With this fix no change is required, since we now build armv7/libpinvokes.dylib from armv7/libpinvokes.m. --- tests/mtouch/MTouch.cs | 6 +++--- tests/scripted/bug-13945/Makefile | 2 +- tools/common/CompilerFlags.cs | 2 +- tools/mtouch/Assembly.cs | 10 +++++----- tools/mtouch/BuildTasks.mtouch.cs | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index bfe10100d1..4ff3157c72 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -1723,10 +1723,10 @@ class Test { mtouch.AssertOutputPattern ("Undefined symbols for architecture arm64:"); mtouch.AssertOutputPattern (".*_OBJC_METACLASS_._Inexistent., referenced from:.*"); - mtouch.AssertOutputPattern (".*_OBJC_METACLASS_._Test_Subexistent in registrar.arm64.o.*"); + mtouch.AssertOutputPattern (".*_OBJC_METACLASS_._Test_Subexistent in registrar.o.*"); mtouch.AssertOutputPattern (".*_OBJC_CLASS_._Inexistent., referenced from:.*"); - mtouch.AssertOutputPattern (".*_OBJC_CLASS_._Test_Subexistent in registrar.arm64.o.*"); - mtouch.AssertOutputPattern (".*objc-class-ref in registrar.arm64.o.*"); + mtouch.AssertOutputPattern (".*_OBJC_CLASS_._Test_Subexistent in registrar.o.*"); + mtouch.AssertOutputPattern (".*objc-class-ref in registrar.o.*"); mtouch.AssertOutputPattern (".*ld: symbol.s. not found for architecture arm64.*"); mtouch.AssertOutputPattern (".*clang: error: linker command failed with exit code 1 .use -v to see invocation.*"); diff --git a/tests/scripted/bug-13945/Makefile b/tests/scripted/bug-13945/Makefile index d58512aa2d..8585d24605 100644 --- a/tests/scripted/bug-13945/Makefile +++ b/tests/scripted/bug-13945/Makefile @@ -27,7 +27,7 @@ bug-13945: @$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/mtouch -r:binding.dll app.exe --abi=armv7 -sdk "$(IOS_SDK_VERSION)" -dev:TheApp.app -sdkroot $(XCODE_DEVELOPER_ROOT) --cache=$(shell pwd)/cache -r:$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll # this will verify that binding.dll wasn't AOT'ed again - if binding.dll.armv7.s differ then the AOT compiler executed. - @diff -u cache-first/binding.dll.armv7.s cache/binding.dll.armv7.s + @diff -u cache-first/armv7/binding.dll.s cache/armv7/binding.dll.s @echo "$@: Success" include $(TOP)/mk/rules.mk diff --git a/tools/common/CompilerFlags.cs b/tools/common/CompilerFlags.cs index 06942e724f..21781c39fd 100644 --- a/tools/common/CompilerFlags.cs +++ b/tools/common/CompilerFlags.cs @@ -129,7 +129,7 @@ namespace Xamarin.Utils if (!Application.FastDev || !Application.RequiresPInvokeWrappers) return; - AddOtherFlag (Driver.Quote (Path.Combine (Application.Cache.Location, "libpinvokes." + abi.AsArchString () + ".dylib"))); + AddOtherFlag (Driver.Quote (Path.Combine (Application.Cache.Location, abi.AsArchString (), "libpinvokes.dylib"))); } public void AddFramework (string framework) diff --git a/tools/mtouch/Assembly.cs b/tools/mtouch/Assembly.cs index 33a03d365f..1b219ef4c4 100644 --- a/tools/mtouch/Assembly.cs +++ b/tools/mtouch/Assembly.cs @@ -212,9 +212,9 @@ namespace Xamarin.Bundler { IEnumerable CreateManagedToAssemblyTasks (string s, Abi abi, string build_dir) { var arch = abi.AsArchString (); - var asm_dir = App.Cache.Location; - var asm = Path.Combine (asm_dir, Path.GetFileName (s)) + "." + arch + ".s"; - var llvm_asm = Path.Combine (asm_dir, Path.GetFileName (s)) + "." + arch + "-llvm.s"; + var asm_dir = Path.Combine (App.Cache.Location, arch); + var asm = Path.Combine (asm_dir, Path.GetFileName (s)) + ".s"; + var llvm_asm = Path.Combine (asm_dir, Path.GetFileName (s)) + "-llvm.s"; var data = Path.Combine (asm_dir, Path.GetFileNameWithoutExtension (s)) + ".aotdata" + "." + arch; string llvm_ofile, llvm_aot_ofile = ""; var is_llvm = (abi & Abi.LLVM) == Abi.LLVM; @@ -237,11 +237,11 @@ namespace Xamarin.Bundler { // // In llvm-only mode, the AOT compiler emits a .bc file and no .s file for JITted code // - llvm_ofile = Path.Combine (asm_dir, Path.GetFileName (s)) + "." + arch + ".bc"; + llvm_ofile = Path.Combine (asm_dir, Path.GetFileName (s)) + ".bc"; outputs.Add (llvm_ofile); llvm_aot_ofile = llvm_ofile; } else { - llvm_ofile = Path.Combine (asm_dir, Path.GetFileName (s)) + "." + arch + "-llvm.o"; + llvm_ofile = Path.Combine (asm_dir, Path.GetFileName (s)) + ".-llvm.o"; outputs.Add (asm); if (is_llvm) { diff --git a/tools/mtouch/BuildTasks.mtouch.cs b/tools/mtouch/BuildTasks.mtouch.cs index 17be689b15..9e4f4b437c 100644 --- a/tools/mtouch/BuildTasks.mtouch.cs +++ b/tools/mtouch/BuildTasks.mtouch.cs @@ -107,8 +107,8 @@ namespace Xamarin.Bundler { var app = target.App; var arch = abi.AsArchString (); - var ofile = Path.Combine (app.Cache.Location, "main." + arch + ".o"); - var ifile = Path.Combine (app.Cache.Location, "main." + arch + ".m"); + var ofile = Path.Combine (app.Cache.Location, arch, "main.o"); + var ifile = Path.Combine (app.Cache.Location, arch, "main.m"); var files = assemblies.Select (v => v.FullPath); @@ -169,7 +169,7 @@ namespace Xamarin.Bundler { var arch = abi.AsArchString (); var ext = target.App.FastDev ? ".dylib" : ".o"; - var ofile = Path.Combine (target.App.Cache.Location, "lib" + Path.GetFileNameWithoutExtension (ifile) + "." + arch + ext); + var ofile = Path.Combine (target.App.Cache.Location, arch, "lib" + Path.GetFileNameWithoutExtension (ifile) + ext); if (!Application.IsUptodate (ifile, ofile)) { var task = new PinvokesTask () @@ -214,7 +214,7 @@ namespace Xamarin.Bundler { var app = target.App; var arch = abi.AsArchString (); - var ofile = Path.Combine (app.Cache.Location, Path.GetFileNameWithoutExtension (ifile) + "." + arch + ".o"); + var ofile = Path.Combine (app.Cache.Location, arch, Path.GetFileNameWithoutExtension (ifile) + ".o"); if (!Application.IsUptodate (ifile, ofile)) { tasks.Add (new CompileRegistrarTask ()