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

Unified Diff: build/mac/copy_asan_runtime_dylib.sh

Issue 80603004: Handle both OSX and iOS Simulator runtimes in the ASan postbuild script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | 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 236732)
+++ build/mac/copy_asan_runtime_dylib.sh (working copy)
@@ -12,23 +12,36 @@
set -e
BINARY="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+
+if [[ ! -f "$BINARY" ]]; then
+ # This is neither an .app bundle nor a standalone executable.
+ # Most certainly the script has been called for a data bundle.
+ exit 0
+fi
+
BINARY_DIR="$(dirname "${BINARY}")"
-ASAN_DYLIB_NAME=libclang_rt.asan_osx_dynamic.dylib
-ASAN_DYLIB=$(find \
- "${BUILT_PRODUCTS_DIR}/../../third_party/llvm-build/Release+Asserts/lib/clang/" \
- -type f -path "*${ASAN_DYLIB_NAME}")
# Find the link to the ASan runtime encoded in the binary.
BUILTIN_DYLIB_PATH=$(otool -L "${BINARY}" | \
- sed -Ene 's/^[[:blank:]]+(.*libclang_rt\.asan_osx_dynamic\.dylib).*$/\1/p')
+ sed -Ene 's/^[[:blank:]]+(.*libclang_rt\.asan_.*_dynamic\.dylib).*$/\1/p')
+if [[ "${BUILTIN_DYLIB_PATH}" == *asan_iossim_dynamic* ]]; then
+ ASAN_DYLIB_NAME=libclang_rt.asan_iossim_dynamic.dylib
+elif [[ "${BUILTIN_DYLIB_PATH}" == *asan_osx_dynamic* ]]; then
+ ASAN_DYLIB_NAME=libclang_rt.asan_osx_dynamic.dylib
+fi
+
if [[ -z "${BUILTIN_DYLIB_PATH}" ]]; then
echo "${BINARY} does not depend on the ASan runtime library!" >&2
- # TODO(glider): make this return 1 when we fully switch to the dynamic
- # runtime in ASan.
- exit 0
+ exit 1
fi
+# TODO(glider): this doesn't work if we set CC and CXX to override the default
+# Clang.
+ASAN_DYLIB=$(find \
+ "${BUILT_PRODUCTS_DIR}/../../third_party/llvm-build/Release+Asserts/lib/clang/" \
+ -type f -path "*${ASAN_DYLIB_NAME}")
+
DYLIB_BASENAME=$(basename "${ASAN_DYLIB}")
if [[ "${DYLIB_BASENAME}" != "${ASAN_DYLIB_NAME}" ]]; then
echo "basename(${ASAN_DYLIB}) != ${ASAN_DYLIB_NAME}" >&2
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698