From f3ec696f9142e5be94b752bad56246223bc491f3 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Thu, 19 Aug 2021 06:40:25 -0400 Subject: [PATCH] Add special Mac Catalyst values for mtriple to MonoAOTCompiler.props (#57687) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Effectively, we are correctly saying "build a Mac Catalyst app from runtime and these `-llvm.o` files, but the `-llvm.o` files are not correctly being built in a Mac Catalyst compatible way, resulting in the error ``` ld: building for Mac Catalyst, but linking in object file built for , file '/Users/filipnavara/Projects/llvmbug/obj/Debug/net6.0-maccatalyst/maccatalyst-arm64/nativelibraries/aot-output/arm64/llvmbug.dll.llvm.o' ``` The target platform parameter gets passed around a LOT - `src/tasks/AotCompilerTask/MonoAOTCompiler.props` specifies `` which passes through to MonoAOTCompiler.cs task which passes through to the `mono --aot=llvmopts=mtriple=arm64-ios` flag, which is processed by `src/mono/mono/mini/aot-compiler.c` and eventually regurgitated as `llc -mtriple=arm64-ios -march=aarch64`, which results in .o files which lack the required annotations to be considered Catalyst compatible. Thankfully, it seems that `llc` accepts `clang`'s `-target` triplet values as valid for `-mtriple`, so passing through Catalyst specific values for `mtriple` in `MonoAOTCompiler.props` results in .o files which are correctly linked later by `clang` during the AppleAppBuilder task. It's slow though! 🙀 Fixes https://github.com/dotnet/runtime/issues/57589 --- src/tasks/AotCompilerTask/MonoAOTCompiler.props | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.props b/src/tasks/AotCompilerTask/MonoAOTCompiler.props index 93bd704de3b89..6ef2f973eb814 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.props +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.props @@ -1,8 +1,10 @@ - + + - + +