Commit f43ab9ce authored by jam's avatar jam Committed by Commit bot

Revert of Enable libc++ on Android (patchset #16 id:460001 of...

Revert of Enable libc++ on Android (patchset #16 id:460001 of https://codereview.chromium.org/835633003/)

Reason for revert:
Slows down the slowest bot on CQ by 20 minutes.

BUG=456396

Original issue's description:
> Enable libc++ on Android
>
> Switch Chrome on Android to use libc++ instead of stlport. WebView AOSP
> builds will continue to use stlport for the time being.
>
> Note that this change is exploratory, and likely to be reverted before
> branch point (ensuring WebView and Chrome remain in lockstep with
> respect to standard library dependencies).
>
> BUG=427718
> TBR=cpu@chromium.org
>
> Committed: https://crrev.com/8681920fa22ded465054301ce96657a4ddaf2a04
> Cr-Commit-Position: refs/heads/master@{#315085}

TBR=fdegans@chromium.org,pasko@chromium.org,jamesr@chromium.org,thakis@chromium.org,boliu@chromium.org,davidben@chromium.org,cpu@chromium.org,piman@chromium.org,jdduke@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=427718

Review URL: https://codereview.chromium.org/903323002

Cr-Commit-Position: refs/heads/master@{#315174}
parent b60049a8
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "base/memory/memory_pressure_listener.h" #include "base/memory/memory_pressure_listener.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/pickle.h" #include "base/pickle.h"
#include "base/stl_util.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/supports_user_data.h" #include "base/supports_user_data.h"
#include "components/autofill/content/browser/content_autofill_driver_factory.h" #include "components/autofill/content/browser/content_autofill_driver_factory.h"
...@@ -844,7 +843,7 @@ jboolean AwContents::RestoreFromOpaqueState( ...@@ -844,7 +843,7 @@ jboolean AwContents::RestoreFromOpaqueState(
std::vector<uint8> state_vector; std::vector<uint8> state_vector;
base::android::JavaByteArrayToByteVector(env, state, &state_vector); base::android::JavaByteArrayToByteVector(env, state, &state_vector);
Pickle pickle(reinterpret_cast<const char*>(vector_as_array(&state_vector)), Pickle pickle(reinterpret_cast<const char*>(state_vector.begin()),
state_vector.size()); state_vector.size());
PickleIterator iterator(pickle); PickleIterator iterator(pickle);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/android/jni_android.h" #include "base/android/jni_android.h"
#include "base/android/jni_string.h" #include "base/android/jni_string.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/stl_util.h"
namespace base { namespace base {
namespace android { namespace android {
...@@ -54,7 +53,7 @@ ScopedJavaLocalRef<jintArray> ToJavaIntArray( ...@@ -54,7 +53,7 @@ ScopedJavaLocalRef<jintArray> ToJavaIntArray(
ScopedJavaLocalRef<jintArray> ToJavaIntArray( ScopedJavaLocalRef<jintArray> ToJavaIntArray(
JNIEnv* env, const std::vector<int>& ints) { JNIEnv* env, const std::vector<int>& ints) {
return ToJavaIntArray(env, vector_as_array(&ints), ints.size()); return ToJavaIntArray(env, ints.begin(), ints.size());
} }
ScopedJavaLocalRef<jlongArray> ToJavaLongArray( ScopedJavaLocalRef<jlongArray> ToJavaLongArray(
...@@ -73,7 +72,7 @@ ScopedJavaLocalRef<jlongArray> ToJavaLongArray( ...@@ -73,7 +72,7 @@ ScopedJavaLocalRef<jlongArray> ToJavaLongArray(
// Returns a new Java long array converted from the given int64 array. // Returns a new Java long array converted from the given int64 array.
BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray( BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray(
JNIEnv* env, const std::vector<int64>& longs) { JNIEnv* env, const std::vector<int64>& longs) {
return ToJavaLongArray(env, vector_as_array(&longs), longs.size()); return ToJavaLongArray(env, longs.begin(), longs.size());
} }
ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray(
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#undef __DEPRECATED #undef __DEPRECATED
#endif #endif
#if defined(OS_ANDROID) && defined(USE_STLPORT) #if defined(OS_ANDROID)
#include <hash_map> #include <hash_map>
#include <hash_set> #include <hash_set>
#define BASE_HASH_IMPL_NAMESPACE std #define BASE_HASH_IMPL_NAMESPACE std
...@@ -84,7 +84,7 @@ struct hash<T*> { ...@@ -84,7 +84,7 @@ struct hash<T*> {
} }
}; };
#if !defined(USE_STLPORT) #if !defined(OS_ANDROID)
// The GNU C++ library provides identity hash functions for many integral types, // The GNU C++ library provides identity hash functions for many integral types,
// but not for |long long|. This hash function will truncate if |size_t| is // but not for |long long|. This hash function will truncate if |size_t| is
// narrower than |long long|. This is probably good enough for what we will // narrower than |long long|. This is probably good enough for what we will
...@@ -102,7 +102,7 @@ DEFINE_TRIVIAL_HASH(long long); ...@@ -102,7 +102,7 @@ DEFINE_TRIVIAL_HASH(long long);
DEFINE_TRIVIAL_HASH(unsigned long long); DEFINE_TRIVIAL_HASH(unsigned long long);
#undef DEFINE_TRIVIAL_HASH #undef DEFINE_TRIVIAL_HASH
#endif // !defined(USE_STLPORT) #endif // !defined(OS_ANDROID)
// Implement string hash functions so that strings of various flavors can // Implement string hash functions so that strings of various flavors can
// be used as keys in STL maps and sets. The hash algorithm comes from the // be used as keys in STL maps and sets. The hash algorithm comes from the
......
...@@ -454,8 +454,8 @@ bool LowerCaseEqualsASCII(string16::const_iterator a_begin, ...@@ -454,8 +454,8 @@ bool LowerCaseEqualsASCII(string16::const_iterator a_begin,
return DoLowerCaseEqualsASCII(a_begin, a_end, b); return DoLowerCaseEqualsASCII(a_begin, a_end, b);
} }
// TODO(jdduke): Remove guards after complete adoption of libc++ on Android. // TODO(port): Resolve wchar_t/iterator issues that require OS_ANDROID here.
#if !defined(OS_ANDROID) || !defined(USE_STLPORT) #if !defined(OS_ANDROID)
bool LowerCaseEqualsASCII(const char* a_begin, bool LowerCaseEqualsASCII(const char* a_begin,
const char* a_end, const char* a_end,
const char* b) { const char* b) {
...@@ -467,7 +467,8 @@ bool LowerCaseEqualsASCII(const char16* a_begin, ...@@ -467,7 +467,8 @@ bool LowerCaseEqualsASCII(const char16* a_begin,
const char* b) { const char* b) {
return DoLowerCaseEqualsASCII(a_begin, a_end, b); return DoLowerCaseEqualsASCII(a_begin, a_end, b);
} }
#endif // !defined(OS_ANDROID) || !defined(USE_STLPORT)
#endif // !defined(OS_ANDROID)
bool EqualsASCII(const string16& a, const base::StringPiece& b) { bool EqualsASCII(const string16& a, const base::StringPiece& b) {
if (a.length() != b.length()) if (a.length() != b.length())
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
{ {
'destination': '<(SHARED_LIB_DIR)/', 'destination': '<(SHARED_LIB_DIR)/',
'files': [ 'files': [
'<(android_libcpp_libs_dir)/libc++_shared.so', '<(android_stlport_libs_dir)/libstlport_shared.so',
], ],
}, },
], ],
......
...@@ -1668,7 +1668,7 @@ ...@@ -1668,7 +1668,7 @@
'android_ndk_root%': '<(android_ndk_root)', 'android_ndk_root%': '<(android_ndk_root)',
'android_sdk_root%': '<(android_sdk_root)', 'android_sdk_root%': '<(android_sdk_root)',
'android_sdk_version%': '<(android_sdk_version)', 'android_sdk_version%': '<(android_sdk_version)',
'android_libcpp_root': '<(android_ndk_root)/sources/cxx-stl/llvm-libc++', 'android_stlport_root': '<(android_ndk_root)/sources/cxx-stl/stlport',
'host_os%': '<(host_os)', 'host_os%': '<(host_os)',
'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)', 'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
...@@ -1745,10 +1745,9 @@ ...@@ -1745,10 +1745,9 @@
'android_sdk%': '<(android_sdk)', 'android_sdk%': '<(android_sdk)',
'android_sdk_jar%': '<(android_sdk)/android.jar', 'android_sdk_jar%': '<(android_sdk)/android.jar',
'android_libcpp_root': '<(android_libcpp_root)', 'android_stlport_root': '<(android_stlport_root)',
'android_libcpp_include': '<(android_libcpp_root)/libcxx/include', 'android_stlport_include': '<(android_stlport_root)/stlport',
'android_libcpp_libs_dir': '<(android_libcpp_root)/libs/<(android_app_abi)', 'android_stlport_libs_dir': '<(android_stlport_root)/libs/<(android_app_abi)',
'host_os%': '<(host_os)', 'host_os%': '<(host_os)',
# Location of the "objcopy" binary, used by both gyp and scripts. # Location of the "objcopy" binary, used by both gyp and scripts.
...@@ -4501,9 +4500,9 @@ ...@@ -4501,9 +4500,9 @@
# Figure this out early since it needs symbols from libgcc.a, so it # Figure this out early since it needs symbols from libgcc.a, so it
# has to be before that in the set of libraries. # has to be before that in the set of libraries.
['component=="shared_library"', { ['component=="shared_library"', {
'android_libcpp_library': 'c++_shared', 'android_stlport_library': 'stlport_shared',
}, { }, {
'android_libcpp_library': 'c++_static', 'android_stlport_library': 'stlport_static',
}], }],
], ],
...@@ -4587,6 +4586,8 @@ ...@@ -4587,6 +4586,8 @@
'defines': [ 'defines': [
'ANDROID', 'ANDROID',
'__GNU_SOURCE=1', # Necessary for clone() '__GNU_SOURCE=1', # Necessary for clone()
'USE_STLPORT=1',
'_STLP_USE_PTR_SPECIALIZATIONS=1',
'CHROME_BUILD_ID="<(chrome_build_id)"', 'CHROME_BUILD_ID="<(chrome_build_id)"',
], ],
'ldflags!': [ 'ldflags!': [
...@@ -4660,13 +4661,12 @@ ...@@ -4660,13 +4661,12 @@
'-nostdlib', '-nostdlib',
], ],
'libraries': [ 'libraries': [
'-l<(android_libcpp_library)', '-l<(android_stlport_library)',
'-latomic',
# Manually link the libgcc.a that the cross compiler uses. # Manually link the libgcc.a that the cross compiler uses.
'<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)', '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
'-lm',
'-lc', '-lc',
'-ldl', '-ldl',
'-lm',
], ],
}], }],
['android_webview_build==1', { ['android_webview_build==1', {
...@@ -4718,20 +4718,20 @@ ...@@ -4718,20 +4718,20 @@
'-Wl,--icf=safe', '-Wl,--icf=safe',
], ],
}], }],
# NOTE: The stlport header include paths below are specified in
# cflags rather than include_dirs because they need to come
# after include_dirs. Think of them like system headers, but
# don't use '-isystem' because the arm-linux-androideabi-4.4.3
# toolchain (circa Gingerbread) will exhibit strange errors.
# The include ordering here is important; change with caution.
['android_webview_build==0', { ['android_webview_build==0', {
'cflags': [ 'cflags': [
'-isystem<(android_libcpp_include)', '-isystem<(android_stlport_include)',
'-isystem<(android_ndk_root)/sources/cxx-stl/llvm-libc++abi/libcxxabi/include',
'-isystem<(android_ndk_root)/sources/android/support/include',
], ],
'ldflags': [ 'ldflags': [
'-L<(android_libcpp_libs_dir)', '-L<(android_stlport_libs_dir)',
], ],
}, { # else: android_webview_build!=0 }, { # else: android_webview_build!=0
'defines': [
'USE_STLPORT=1',
'_STLP_USE_PTR_SPECIALIZATIONS=1',
],
'aosp_build_settings': { 'aosp_build_settings': {
# Specify that we want to statically link stlport from the # Specify that we want to statically link stlport from the
# NDK. This will provide all the include and library paths # NDK. This will provide all the include and library paths
......
...@@ -129,6 +129,14 @@ if (is_android) { ...@@ -129,6 +129,14 @@ if (is_android) {
android_gdbserver = android_gdbserver =
"$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver" "$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver"
# stlport stuff --------------------------------------------------------------
if (component_mode == "shared_library") {
android_stlport_library = "stlport_shared"
} else {
android_stlport_library = "stlport_static"
}
# ABI ------------------------------------------------------------------------ # ABI ------------------------------------------------------------------------
if (cpu_arch == "x86") { if (cpu_arch == "x86") {
......
...@@ -531,7 +531,7 @@ config("runtime_library") { ...@@ -531,7 +531,7 @@ config("runtime_library") {
] ]
} }
# Android standard library setup. # Stlport setup. Android uses a different (smaller) version of the STL.
if (is_android) { if (is_android) {
if (is_clang) { if (is_clang) {
# Work around incompatibilities between bionic and clang headers. # Work around incompatibilities between bionic and clang headers.
...@@ -541,44 +541,55 @@ config("runtime_library") { ...@@ -541,44 +541,55 @@ config("runtime_library") {
] ]
} }
defines += [ "__GNU_SOURCE=1" ] # Necessary for clone(). defines += [
"USE_STLPORT=1",
"_STLP_USE_PTR_SPECIALIZATIONS=1",
"__GNU_SOURCE=1", # Necessary for clone().
]
ldflags += [ ldflags += [
"-Wl,--warn-shared-textrel", "-Wl,--warn-shared-textrel",
"-nostdlib", "-nostdlib",
] ]
android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++" # NOTE: The stlport header include paths below are specified in cflags
# rather than include_dirs because they need to come after include_dirs.
# Think of them like system headers, but don't use '-isystem' because the
# arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
# strange errors. The include ordering here is important; change with
# caution.
android_stlport_root = "$android_ndk_root/sources/cxx-stl/stlport"
cflags += [ cflags += [ "-isystem" +
"-isystem" + rebase_path("$android_stlport_root/stlport", root_build_dir) ]
rebase_path("$android_libcpp_root/libcxx/include", root_build_dir), lib_dirs += [ "$android_stlport_root/libs/$android_app_abi" ]
"-isystem" + rebase_path(
"$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include",
root_build_dir),
"-isystem" +
rebase_path("$android_ndk_root/sources/android/support/include",
root_build_dir),
]
lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ]
if (component_mode == "shared_library") { if (component_mode == "shared_library") {
android_libcpp_library = "c++_shared" libs += [ "stlport_shared" ]
} else { } else {
android_libcpp_library = "c++_static" libs += [ "stlport_static" ]
} }
libs += [ if (cpu_arch == "mipsel") {
"$android_libcpp_library", libs += [
"atomic", # ld linker is used for mips Android, and ld does not accept library
# absolute path prefixed by "-l"; Since libgcc does not exist in mips
# sysroot the proper library will be linked.
# TODO(gordanac): Remove once gold linker is used for mips Android.
"gcc",
]
} else {
libs += [
# Manually link the libgcc.a that the cross compiler uses. This is
# absolute because the linker will look inside the sysroot if it's not.
rebase_path(android_libgcc_file),
]
}
# Manually link the libgcc.a that the cross compiler uses. This is libs += [
# absolute because the linker will look inside the sysroot if it's not.
rebase_path(android_libgcc_file),
"m",
"c", "c",
"dl", "dl",
"m",
] ]
} }
} }
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "base/files/scoped_file.h" #include "base/files/scoped_file.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_tokenizer.h" #include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -69,7 +68,11 @@ bool TryConvertNativeToNetIPAttributes(int native_attributes, ...@@ -69,7 +68,11 @@ bool TryConvertNativeToNetIPAttributes(int native_attributes,
namespace internal { namespace internal {
inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) {
return vector_as_array(&ip); #if defined(OS_ANDROID)
return ip.begin();
#else
return ip.data();
#endif
} }
// Gets the connection type for interface |ifname| by checking for wireless // Gets the connection type for interface |ifname| by checking for wireless
......
...@@ -46,7 +46,13 @@ ...@@ -46,7 +46,13 @@
"_GLAPI_NO_EXPORTS", "_GLAPI_NO_EXPORTS",
], ],
'conditions': [ 'conditions': [
['OS == "linux" or OS == "android"', { ['OS=="android"', {
'defines': [
'__GLIBC__',
'_GNU_SOURCE',
],
}],
['OS=="linux"', {
'defines': [ 'defines': [
'_GNU_SOURCE', '_GNU_SOURCE',
], ],
......
...@@ -12,12 +12,3 @@ index 8f54040..de1ef5b 100644 ...@@ -12,12 +12,3 @@ index 8f54040..de1ef5b 100644
#include <tr1/unordered_set> #include <tr1/unordered_set>
using std::tr1::unordered_set; using std::tr1::unordered_set;
@@ -54,7 +55,7 @@ using std::tr1::unordered_set;
#else
#include <unordered_set>
-#if defined(WIN32) || defined(OS_ANDROID)
+#if defined(WIN32) || (defined(OS_ANDROID) && !defined(_LIBCPP_ABI_VERSION))
using std::tr1::unordered_set;
#else
using std::unordered_set;
...@@ -55,7 +55,7 @@ using std::tr1::unordered_set; ...@@ -55,7 +55,7 @@ using std::tr1::unordered_set;
#else #else
#include <unordered_set> #include <unordered_set>
#if defined(WIN32) || (defined(OS_ANDROID) && !defined(_LIBCPP_ABI_VERSION)) #if defined(WIN32) || defined(OS_ANDROID)
using std::tr1::unordered_set; using std::tr1::unordered_set;
#else #else
using std::unordered_set; using std::unordered_set;
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
'ldflags!': [ 'ldflags!': [
'-pie', '-pie',
], ],
# Don't inherit unneeded dependencies on libc++, so the binary remains # Don't inherit unneeded dependencies on stlport.so, so the binary remains
# self-contained also in component=shared_library builds. # self-contained also in component=shared_library builds.
'libraries!': [ 'libraries!': [
'-l<(android_libcpp_library)', '-l<(android_stlport_library)',
], ],
}, },
{ {
......
...@@ -904,7 +904,7 @@ if [[ -n "${with_android}" ]]; then ...@@ -904,7 +904,7 @@ if [[ -n "${with_android}" ]]; then
--platform=android-14 \ --platform=android-14 \
--install-dir="${LLVM_BUILD_DIR}/android-toolchain" \ --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \
--system=linux-x86_64 \ --system=linux-x86_64 \
--stl=libcxx \ --stl=stlport \
--toolchain=arm-linux-androideabi-4.9 --toolchain=arm-linux-androideabi-4.9
# Android NDK r9d copies a broken unwind.h into the toolchain, see # Android NDK r9d copies a broken unwind.h into the toolchain, see
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment