[PATCH] [ASan] Add CMake configs for libclang_rt.asan_iossim_dynamic.dylib

Alexey Samsonov samsonov at google.com
Tue Nov 5 16:00:29 PST 2013



================
Comment at: ../projects/compiler-rt/lib/asan/CMakeLists.txt:86
@@ -90,4 +85,3 @@
     # provided by the instrumented modules.
-    LINKFLAGS "-framework Foundation"
-              "-undefined dynamic_lookup")
-  list(APPEND ASAN_RUNTIME_LIBRARIES clang_rt.asan_osx_dynamic)
+    if (os STREQUAL "osx")
+      set(ASAN_RUNTIME_LDFLAGS
----------------
Nit: I'd prefer
  set(ASAN_RUNTIME_LDFLAGS
    "-undefined dynamic_lookup")
  if (os STREQUAL "osx")
    list(APPEND ASAN_RUNTIME_LDFLAGS "-framework Foundation")
  endif()

================
Comment at: ../projects/compiler-rt/lib/asan/CMakeLists.txt:102
@@ +101,3 @@
+      DEFS ${ASAN_COMMON_DEFINITIONS}
+      LINKFLAGS ${ASAN_RUNTIME_LDFLAGS}
+    )
----------------
Nit: don't put ) on the next line (for consistency)

================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:99
@@ +98,3 @@
+  if (os STREQUAL "osx")
+    set_target_compile_flags(${name} ${LIB_CFLAGS} ${OSX_CFLAGS})
+    set_target_link_flags(${name} ${LIB_LINKFLAGS})
----------------
OSX_CFLAGS -> DARWIN_${os}_CFLAGS (same for IOSSIM_CFLAGS below).

================
Comment at: ../projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:103
@@ +102,3 @@
+    set_target_compile_flags(${name} ${LIB_CFLAGS} ${IOSSIM_CFLAGS})
+    set_target_link_flags(${name} ${LIB_LINKFLAGS}
+      -Wl,-ios_simulator_version_min,7.0.0
----------------
So... why not have (empty) DARWIN_osx_LINKFLAGS and non-empty DARWIN_iossim_LINKFLAGS?

================
Comment at: ../projects/compiler-rt/CMakeLists.txt:34
@@ -33,1 +33,3 @@
 
+# Obtain the iOS Simulator SDK path from xcodebuild.
+# ${IOSSIM_SDK_DIR} is used in AddCompilerRT and can't be moved below it.
----------------
Can't it? AddCompilerRT.cmake just defines some macro, and the actual substitution should happen when we actually call these macro from lib/asan/CMakeLists.txt (or whatever). IOSSIM_SDK_DIR will already be defined at that point.


http://llvm-reviews.chandlerc.com/D2080



More information about the llvm-commits mailing list