[PATCH] [ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib
Alexey Samsonov
samsonov at google.com
Thu Oct 31 11:26:05 PDT 2013
I think we should implement generic build rules for osx and iossim:
(1) Determine whether we can build for iossim, and what is the set of platforms we target on Mac (either "osx", or "osx;iossim"). We have test_target_arch/COMPILER_RT_SUPPORTED_ARCH stuff that do similar things to determine target arches. They allow us to write code like this:
foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH})
add_compiler_rt_object_library(RTInterception ${arch}
SOURCES ${INTERCEPTION_SOURCES} CFLAGS ${INTERCEPTION_CFLAGS})
endforeach()
================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:60
@@ +59,3 @@
+ add_library(${libname} OBJECT ${LIB_SOURCES})
+ set_target_compile_flags(${libname} ${LIB_CFLAGS_IOSSIM})
+ set_target_properties(${libname} PROPERTIES OSX_ARCHITECTURES "${LIB_ARCH}")
----------------
I guess you need both LIB_CFLAGS and iossim cflags. The naming LIB_CFLAGS_IOSSIM is confusing - IOSSIM_CFLAGS is maybe better - they are common for all the libraries.
================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:67
@@ +66,3 @@
+macro(add_compiler_rt_object_library_iossim name arch)
+ add_custom_target(${name})
+endmacro()
----------------
No, this macro should only be called if iossim is supported, otherwise we should diagnose error.
================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:56
@@ +55,3 @@
+# DEFS <compile definitions>)
+macro(add_compiler_rt_iossim_object_library name)
+ parse_arguments(LIB "ARCH;SOURCES;CFLAGS;DEFS" "" ${ARGN})
----------------
This looks too much like add_compiler_rt_osx_object_library. I think they should be merged and "osx"/"iossim" should be a macro parameter.
================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:5
@@ -4,1 +4,3 @@
+execute_process(
+ COMMAND xcodebuild -version -sdk iphonesimulator Path
----------------
Move this to CMakeLists.txt at compiler-rt root for now.
================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:154
@@ +153,3 @@
+ set_target_link_flags(${name} ${LIB_LINKFLAGS}
+ -Wl,-ios_simulator_version_min,7.0.0
+ -Wl,-syslibroot,${iossim_sdk_path}
----------------
I guess you need IOSSIM_LINKFLAGS or some such
================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:149
@@ +148,3 @@
+# LINKFLAGS <link flags>)
+macro(add_compiler_rt_iossim_dynamic_runtime name)
+ parse_arguments(LIB "ARCH;SOURCES;CFLAGS;DEFS;LINKFLAGS" "" ${ARGN})
----------------
This should also be merged with add_compiler_rt_osx_dynamic_runtime.
================
Comment at: ../projects/compiler-rt/lib/asan/CMakeLists.txt:105
@@ +104,3 @@
+ $<TARGET_OBJECTS:RTLSanCommon.iossim>
+ CFLAGS ${ASAN_CFLAGS} -mios-simulator-version-min=7.0
+ DEFS ${ASAN_COMMON_DEFINITIONS}
----------------
-mios-simulator-version-min=7.0 should be added automatically by IOSSIM_CFLAGS instead.
================
Comment at: ../projects/compiler-rt/lib/asan/CMakeLists.txt:65
@@ -64,1 +64,3 @@
DEFS ${ASAN_COMMON_DEFINITIONS})
+ add_compiler_rt_iossim_object_library(RTAsan
+ ARCH ${ASAN_SUPPORTED_ARCH}
----------------
here and below - I want a loop for each supported platform like we have on Linux
http://llvm-reviews.chandlerc.com/D2080
More information about the llvm-commits
mailing list