Index: build/mac/copy_asan_runtime_dylib.sh |
=================================================================== |
--- build/mac/copy_asan_runtime_dylib.sh (revision 0) |
+++ build/mac/copy_asan_runtime_dylib.sh (revision 0) |
@@ -0,0 +1,31 @@ |
+#!/bin/bash |
+ |
+# For executables built with ASan, copies the runtime lib |
+# (libclang_rt.asan_osx_dynamic.dylib) on which they depend from the compiler |
+# installation path to the build dir and fixes the dylib's install name in the |
+# binary to be relative to @executable_path. This is needed if the executables |
+# are copied to a different machine (the ASan runtime library must be copied in |
+# this case as well). |
+ |
+set -e |
+set -x |
+ |
+BINARY="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" |
+BINARY_PATH="$(dirname "${BINARY}")" |
+RUNTIME_PATTERN="asan_osx_dynamic.dylib" |
+RUNTIME_LIB="$(otool -L "${BINARY}" | |
+ grep "${RUNTIME_PATTERN}" | |
+ tr -d '\011' | # remove leading tab |
+ sed "s/${RUNTIME_PATTERN}.*/${RUNTIME_PATTERN}/")" |
+if [ -z "${RUNTIME_LIB}" ] |
+then |
+ # TODO(glider): report an error here once we switch to ASan with dynamic |
+ # runtime. |
+ exit 0 |
+fi |
+ |
+RUNTIME_FNAME="$(basename "${RUNTIME_LIB}")" |
+cp "${RUNTIME_LIB}" "${BINARY_PATH}" |
+#install_name_tool \ |
+# -change "${RUNTIME_LIB}" "@executable_path/${RUNTIME_FNAME}" "${BINARY}" |
+touch "${BINARY_PATH}"/"${RUNTIME_LIB}" |
Property changes on: build/mac/copy_asan_runtime_dylib.sh |
___________________________________________________________________ |
Added: svn:executable |
+ * |
Added: svn:eol-style |
+ LF |