diff options
author | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-22 09:25:20 +0000 |
---|---|---|
committer | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-22 09:25:20 +0000 |
commit | ee1830a638fb3c0a99d2e5809cb6803838955141 (patch) | |
tree | 0194804e004a9472268c854a5587a1806cce5c1b /build/mac | |
parent | d8782c45fb0947776080f08999138a10534c0205 (diff) | |
download | chromium_src-ee1830a638fb3c0a99d2e5809cb6803838955141.zip chromium_src-ee1830a638fb3c0a99d2e5809cb6803838955141.tar.gz chromium_src-ee1830a638fb3c0a99d2e5809cb6803838955141.tar.bz2 |
Handle both OSX and iOS Simulator runtimes in the ASan postbuild script.
Also fixed a TODO: now the script bails out if a non-ASan executable is passed to it.
BUG=228243
R=thakis@chromium.org
Review URL: https://codereview.chromium.org/80603004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/mac')
-rwxr-xr-x | build/mac/copy_asan_runtime_dylib.sh | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/build/mac/copy_asan_runtime_dylib.sh b/build/mac/copy_asan_runtime_dylib.sh index b67b434..f221c4a 100755 --- a/build/mac/copy_asan_runtime_dylib.sh +++ b/build/mac/copy_asan_runtime_dylib.sh @@ -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 |