[PATCH] Adding experimental build support for building compiler-rt for iOS.

Chris Bieneman beanz at apple.com
Wed Jun 24 15:21:59 PDT 2015


> On Jun 24, 2015, at 3:15 PM, Filipe Cabecinhas <filcab+llvm.phabricator at gmail.com> wrote:
> 
> Hi Chris,
> 
> On Wed, Jun 24, 2015 at 2:58 PM, Chris Bieneman <beanz at apple.com <mailto:beanz at apple.com>> wrote:
> I will update the patches shortly.
> 
> 
> ================
> Comment at: cmake/Modules/CompilerRTDarwinUtils.cmake:2
> @@ +1,3 @@
> +# On OS X SDKs can be installed anywhere on the base system and xcode-select
> +# or SDKROOT can be used to set the default one to use. We want to find the SDKs
> +# that are present in the current Xcode
> ----------------
> filcab wrote:
> > This seems misleading. xcodebuild doesn't seem to honour SDKROOT.
> >
> > If I have 10.10 and 10.9 installed, and set SDKROOT=/.../Xcode.app/.../MacOSX10.9.sdk, I get:
> >   [~]% xcodebuild -version -sdk macosx Path
> >   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
> >
> > (This is really handy when you have an SDK available for 10.(X+1), but are running on 10.X.
> I'll reword. Xcodebuild doesn't respect SDKROOT if you specify -sdk, which is why you would see that behavior.
> Fair enough. Do you happen to know if there's a way (other than moving the 10.(X+1) sdk out of the way) to have my use-case work? (Just curious. It's not something that happens a lot (a few months per year, at most ;-) ).

Changing the value passed into the -sdk flag will allow you to specify a specific version. We should support that more formally eventually.

> 
> ================
> Comment at: lib/asan/CMakeLists.txt:116
> @@ -115,3 +115,3 @@
>      add_compiler_rt_darwin_dynamic_runtime(clang_rt.asan_${os}_dynamic ${os}
> -      ARCHS ${ASAN_SUPPORTED_ARCH}
> +      ARCHS ${SANITIZER_COMMON_DARWIN_${os}_ARCHES}
>        SOURCES $<TARGET_OBJECTS:RTAsan.${os}>
> ----------------
> filcab wrote:
> > Just to be sure, ASan will be supported on all of the arch + OS that sanitizer_common will run on? (at first sight, it almost looks like a copy-paste bug)
> >
> > You're adding object_libraries (line 80) for ASAN_SUPPORTED_ARCH, but then generate dynamic_runtimes for SANITIZER_COMMON_..._ARCHES. Shouldn't these be the same, at least?
> Anna would have to comment as to what ASan will or won't be supported on. I'm just trying to make it build, and ASAN_SUPPORTED_ARCH is set to i386;x86_64, which just doesn't work on iOS. For Darwin we always need platform-specific arch settings.
> 
> The line 80 thing is just an oddity of the moment. If you look at add_compiler_rt_object_libraries, it actually ignores the ARCH setting that comes in because it needs platform-specific archs.
> Fair enough. Can you please double check AddCompilerRT.cmake:42, then?
> It's setting the property OSX_ARCHITECTURES to ${LIB_ARCHS}. Please double-check if we care about it (It's used for CMake's Xcode generator, and "Local Generator", which I have no idea what it's for :-) ).

That’s in my patches:

Index: cmake/Modules/AddCompilerRT.cmake
===================================================================
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -19,6 +19,8 @@
       set(libname "${name}.${os}")
       set(libnames ${libnames} ${libname})
       set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS})
+      set(extra_linkflags_${libname} ${DARWIN_${os}_LINKFLAGS})
+      set(LIB_ARCHS_${libname} ${SANITIZER_COMMON_DARWIN_${os}_ARCHES})
     endforeach()
   else()
     foreach(arch ${LIB_ARCHS})
@@ -39,7 +41,9 @@
     set_property(TARGET ${libname} APPEND PROPERTY
       COMPILE_DEFINITIONS ${LIB_DEFS})
     if(APPLE)
-      set_target_properties(${libname} PROPERTIES OSX_ARCHITECTURES "${LIB_ARCHS}")
+      set_target_properties(${libname} PROPERTIES
+        OSX_ARCHITECTURES "${LIB_ARCHS_${libname}}"
+        LINK_FLAGS "${extra_linkflags_${libname}}")
     endif()
   endforeach()
 endfunction()

Thanks,
-Chris

> 
> Thanks,
> 
>  Filipe
>  
> 
> ================
> Comment at: lib/ubsan/CMakeLists.txt:47
> @@ -46,3 +46,3 @@
>        add_compiler_rt_darwin_dynamic_runtime(clang_rt.ubsan_${os}_dynamic ${os}
> -        ARCHS ${UBSAN_SUPPORTED_ARCH}
> +        ARCHS ${SANITIZER_COMMON_DARWIN_${os}_ARCHES}
>          SOURCES $<TARGET_OBJECTS:RTUbsan.${os}>
> ----------------
> filcab wrote:
> > Just to be sure, UBSan will be supported on all of the arch + OS that sanitizer_common will run on?
> >
> > Same comment as ASan (check line 42 here).
> Again, I can't really comment about official support. I'm just trying to make it build and you can't build UBSan for iOS targeting x86.
> 
> My goal in these patches was to identify up front the architectures that your host toolchain is capable of targeting for each target OS, and build everything for all of them.
> 
> http://reviews.llvm.org/D10710 <http://reviews.llvm.org/D10710>
> 
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/ <http://reviews.llvm.org/settings/panel/emailpreferences/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150624/1b3a3715/attachment.html>


More information about the llvm-commits mailing list