Chromium Code Reviews| Index: build/mac/copy_asan_runtime_dylib.sh |
| =================================================================== |
| --- build/mac/copy_asan_runtime_dylib.sh (revision 236207) |
| +++ 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. |
| + exit 0 |
| +fi |
|
Nico
2013/11/22 01:48:19
This script is called for non-binaries due to that
Alexander Potapenko
2013/11/22 09:26:13
This is because the script is being also called fo
|
| + |
| 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 |
| +fi |
| +if [[ "${BUILTIN_DYLIB_PATH}" == *asan_osx_dynamic* ]]; then |
|
Nico
2013/11/22 01:48:19
elif
Alexander Potapenko
2013/11/22 09:26:13
Done.
|
| + 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. |
|
Nico
2013/11/22 01:48:19
Mention that you fixed this TODO in the cl descrip
Alexander Potapenko
2013/11/22 09:26:13
Done.
|
| - 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 |