diff options
author | eugenis <eugenis@chromium.org> | 2015-08-03 21:57:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-04 04:59:31 +0000 |
commit | 301af9347c32ac621ab06b08eb089f8ee643795f (patch) | |
tree | 90f8a162a11347dffc55c2b5178d6fdf21b4b660 | |
parent | 0112f1037b342f1f1718c8615e9a17559b1bdfde (diff) | |
download | chromium_src-301af9347c32ac621ab06b08eb089f8ee643795f.zip chromium_src-301af9347c32ac621ab06b08eb089f8ee643795f.tar.gz chromium_src-301af9347c32ac621ab06b08eb089f8ee643795f.tar.bz2 |
Link libc++_shared with asan=1 on Android.
ASan needs to interpose operator new/delete symbols to provide good
allocation/deallocation stacks. This requires shared linking of the
C++ standard library.
BUG=515261
Review URL: https://codereview.chromium.org/1263713005
Cr-Commit-Position: refs/heads/master@{#341675}
-rw-r--r-- | build/android/native_app_dependencies.gypi | 2 | ||||
-rw-r--r-- | build/android/pack_relocations.gypi | 2 | ||||
-rw-r--r-- | build/android/setup.gyp | 2 | ||||
-rw-r--r-- | build/android/strip_native_libraries.gypi | 2 | ||||
-rw-r--r-- | build/common.gypi | 28 | ||||
-rw-r--r-- | build/java_apk.gypi | 2 | ||||
-rw-r--r-- | chrome/android/chrome_apk.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_android.gypi | 2 |
8 files changed, 26 insertions, 16 deletions
diff --git a/build/android/native_app_dependencies.gypi b/build/android/native_app_dependencies.gypi index 6032274..f74e7ae 100644 --- a/build/android/native_app_dependencies.gypi +++ b/build/android/native_app_dependencies.gypi @@ -29,7 +29,7 @@ 'include_main_binary%': 1, }, 'conditions': [ - ['component == "shared_library"', { + ['android_must_copy_system_libraries == 1', { 'dependencies': [ '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', ], diff --git a/build/android/pack_relocations.gypi b/build/android/pack_relocations.gypi index 8567fa6..61b4e2c 100644 --- a/build/android/pack_relocations.gypi +++ b/build/android/pack_relocations.gypi @@ -67,7 +67,7 @@ '--stamp=<(stamp)', ], }], - ['component == "shared_library"', { + ['android_must_copy_system_libraries == 1', { # Add a fake output to force the build to always re-run this step. This # is required because the real inputs are not known at gyp-time and # changing base.so may not trigger changes to dependent libraries. diff --git a/build/android/setup.gyp b/build/android/setup.gyp index 0e1c2c4..419ed98 100644 --- a/build/android/setup.gyp +++ b/build/android/setup.gyp @@ -3,7 +3,7 @@ # found in the LICENSE file. { 'conditions': [ - ['component == "shared_library"', { + ['android_must_copy_system_libraries == 1', { 'targets': [ { # These libraries from the Android ndk are required to be packaged with diff --git a/build/android/strip_native_libraries.gypi b/build/android/strip_native_libraries.gypi index bdffcfd..be8a5cb 100644 --- a/build/android/strip_native_libraries.gypi +++ b/build/android/strip_native_libraries.gypi @@ -35,7 +35,7 @@ '<(stamp)', ], 'conditions': [ - ['component == "shared_library"', { + ['android_must_copy_system_libraries == 1', { # Add a fake output to force the build to always re-run this step. This # is required because the real inputs are not known at gyp-time and # changing base.so may not trigger changes to dependent libraries. diff --git a/build/common.gypi b/build/common.gypi index 052d297..7127a59 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -1711,6 +1711,21 @@ 'android_sdk_version%': '22', 'android_sdk_build_tools_version%': '22.0.0', 'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')", + + 'conditions': [ + # Figure this out early since it needs symbols from libgcc.a, so it + # has to be before that in the set of libraries. + # ASan needs to dynamically link to libc++ even in static builds so + # that it can interpose operator new. + ['component=="shared_library" or asan==1', { + 'android_libcpp_library': 'c++_shared', + 'android_must_copy_system_libraries': 1, + }, { + 'android_libcpp_library': 'c++_static', + 'android_must_copy_system_libraries': 0, + }], + ], + }, # Copy conditionally-set variables out one scope. 'android_ndk_root%': '<(android_ndk_root)', @@ -1718,6 +1733,8 @@ 'android_sdk_root%': '<(android_sdk_root)', 'android_sdk_version%': '<(android_sdk_version)', 'android_libcpp_root': '<(android_ndk_root)/sources/cxx-stl/llvm-libc++', + 'android_libcpp_library': '<(android_libcpp_library)', + 'android_must_copy_system_libraries': '<(android_must_copy_system_libraries)', 'host_os%': '<(host_os)', 'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)', @@ -1795,8 +1812,10 @@ 'android_sdk_jar%': '<(android_sdk)/android.jar', 'android_libcpp_root': '<(android_libcpp_root)', + 'android_libcpp_library': '<(android_libcpp_library)', 'android_libcpp_include': '<(android_libcpp_root)/libcxx/include', 'android_libcpp_libs_dir%': '<(android_libcpp_root)/libs/<(android_app_abi)', + 'android_must_copy_system_libraries': '<(android_must_copy_system_libraries)', 'host_os%': '<(host_os)', # Location of the "objcopy" binary, used by both gyp and scripts. @@ -4741,15 +4760,6 @@ # identifying various build artifacts corresponding to a particular # build of chrome (e.g. where to find archived symbols). 'chrome_build_id%': '', - 'conditions': [ - # Figure this out early since it needs symbols from libgcc.a, so it - # has to be before that in the set of libraries. - ['component=="shared_library"', { - 'android_libcpp_library': 'c++_shared', - }, { - 'android_libcpp_library': 'c++_static', - }], - ], # Placing this variable here prevents from forking libvpx, used # by remoting. Remoting is off, so it needn't built, diff --git a/build/java_apk.gypi b/build/java_apk.gypi index ff837c3..a1fc857 100644 --- a/build/java_apk.gypi +++ b/build/java_apk.gypi @@ -247,7 +247,7 @@ 'additional_R_text_files': ['<(intermediate_dir)/R.txt'], }, }], - ['native_lib_target != "" and component == "shared_library"', { + ['native_lib_target != "" and android_must_copy_system_libraries == 1', { 'dependencies': [ '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', ], diff --git a/chrome/android/chrome_apk.gypi b/chrome/android/chrome_apk.gypi index f1143b8a..feee8a2 100644 --- a/chrome/android/chrome_apk.gypi +++ b/chrome/android/chrome_apk.gypi @@ -25,7 +25,7 @@ 'proguard_flags_paths': ['<(DEPTH)/chrome/android/java/proguard.flags'], 'additional_input_paths' : ['<@(chrome_android_pak_output_resources)'], 'conditions': [ - ['component != "shared_library"', { + ['android_must_copy_system_libraries == 0', { # Only enable the chromium linker on regular builds, since the # component build crashes on Android 4.4. See b/11379966 'use_chromium_linker': '<(chrome_apk_use_chromium_linker)', diff --git a/chrome/chrome_android.gypi b/chrome/chrome_android.gypi index 734cda9..d4880fd 100644 --- a/chrome/chrome_android.gypi +++ b/chrome/chrome_android.gypi @@ -5,7 +5,7 @@ 'variables': { 'chromium_code': 1, 'conditions': [ - ['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', { + ['android_must_copy_system_libraries == 0 and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', { # Only enable the chromium linker on regular builds, since the # component build crashes on Android 4.4. See b/11379966 'use_chromium_linker': '1', |