Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Unified Diff: build/mac/copy_asan_runtime_dylib.sh

Issue 11642018: Add a postbuild action for executables built with ASan on Mac OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« build/common.gypi ('K') | « build/common.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« build/common.gypi ('K') | « build/common.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698