diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-21 07:16:05 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-21 07:16:05 +0000 |
commit | 9e18f3ef417194517260de7ee1c06181944ebe76 (patch) | |
tree | 1e0494985c9a89df2a9c96515e15f334b9d470c2 /base | |
parent | 2e5f3a0fb85bc2dc88317ab7a49096d5b4a489a1 (diff) | |
download | chromium_src-9e18f3ef417194517260de7ee1c06181944ebe76.zip chromium_src-9e18f3ef417194517260de7ee1c06181944ebe76.tar.gz chromium_src-9e18f3ef417194517260de7ee1c06181944ebe76.tar.bz2 |
Fixes in base for [P]NaCl port of remoting client
Various minor fixes in base needed for [P]NaCl port of remoting client:
- added base_i18n_untrusted target
- md5 is included in base_untrusted.
- base/metrics is compiled in base_untrusted (src/net depends on it).
- enabled PNaCl build of base_untrusted
- __builtin_extract_return_addr() is not allowed in PNaCl (validator
rejects it).
- sys_byteorder.h now works in NaCl.
BUG=276739
Review URL: https://codereview.chromium.org/116803005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242270 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base.gyp | 41 | ||||
-rw-r--r-- | base/base.gypi | 43 | ||||
-rw-r--r-- | base/base_untrusted.gyp | 27 | ||||
-rw-r--r-- | base/location.cc | 3 | ||||
-rw-r--r-- | base/sys_byteorder.h | 58 | ||||
-rw-r--r-- | base/third_party/nspr/prcpucfg_nacl.h | 2 |
6 files changed, 86 insertions, 88 deletions
diff --git a/base/base.gyp b/base/base.gyp index 1c2e931..d378d14 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -255,8 +255,6 @@ 'event_recorder_win.cc', 'linux_util.cc', 'linux_util.h', - 'md5.cc', - 'md5.h', 'message_loop/message_pump_android.cc', 'message_loop/message_pump_android.h', 'message_loop/message_pump_glib.cc', @@ -287,6 +285,7 @@ 'variables': { 'enable_wexit_time_destructors': 1, 'optimize': 'max', + 'base_i18n_target': 1, }, 'dependencies': [ 'base', @@ -311,42 +310,8 @@ 'export_dependent_settings': [ 'base', ], - 'defines': [ - 'BASE_I18N_IMPLEMENTATION', - ], - 'sources': [ - 'i18n/base_i18n_export.h', - 'i18n/bidi_line_iterator.cc', - 'i18n/bidi_line_iterator.h', - 'i18n/break_iterator.cc', - 'i18n/break_iterator.h', - 'i18n/char_iterator.cc', - 'i18n/char_iterator.h', - 'i18n/case_conversion.cc', - 'i18n/case_conversion.h', - 'i18n/file_util_icu.cc', - 'i18n/file_util_icu.h', - 'i18n/i18n_constants.cc', - 'i18n/i18n_constants.h', - 'i18n/icu_encoding_detection.cc', - 'i18n/icu_encoding_detection.h', - 'i18n/icu_string_conversions.cc', - 'i18n/icu_string_conversions.h', - 'i18n/icu_util.cc', - 'i18n/icu_util.h', - 'i18n/number_formatting.cc', - 'i18n/number_formatting.h', - 'i18n/rtl.cc', - 'i18n/rtl.h', - 'i18n/string_compare.cc', - 'i18n/string_compare.h', - 'i18n/string_search.cc', - 'i18n/string_search.h', - 'i18n/time_formatting.cc', - 'i18n/time_formatting.h', - 'i18n/timezone.cc', - 'i18n/timezone.h', - ], + + }, { 'target_name': 'base_message_loop_tests', diff --git a/base/base.gypi b/base/base.gypi index 6a2585f..b33dd41 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -6,6 +6,7 @@ 'target_defaults': { 'variables': { 'base_target': 0, + 'base_i18n_target': 0, }, 'target_conditions': [ # This part is shared between the targets defined below. @@ -291,6 +292,8 @@ 'mac/scoped_sending_event.h', 'mac/scoped_sending_event.mm', 'mac/sdk_forward_declarations.h', + 'md5.cc', + 'md5.h', 'memory/aligned_memory.cc', 'memory/aligned_memory.h', 'memory/discardable_memory.h', @@ -772,8 +775,6 @@ 'third_party/dynamic_annotations/dynamic_annotations.c', ], 'sources/': [ - # Metrics won't work in the NaCl sandbox. - ['exclude', '^metrics/'], ['include', '^threading/platform_thread_linux\\.cc$'], ], }], @@ -949,6 +950,44 @@ }], ], }], + ['base_i18n_target==1', { + 'defines': [ + 'BASE_I18N_IMPLEMENTATION', + ], + 'sources': [ + 'i18n/base_i18n_export.h', + 'i18n/bidi_line_iterator.cc', + 'i18n/bidi_line_iterator.h', + 'i18n/break_iterator.cc', + 'i18n/break_iterator.h', + 'i18n/char_iterator.cc', + 'i18n/char_iterator.h', + 'i18n/case_conversion.cc', + 'i18n/case_conversion.h', + 'i18n/file_util_icu.cc', + 'i18n/file_util_icu.h', + 'i18n/i18n_constants.cc', + 'i18n/i18n_constants.h', + 'i18n/icu_encoding_detection.cc', + 'i18n/icu_encoding_detection.h', + 'i18n/icu_string_conversions.cc', + 'i18n/icu_string_conversions.h', + 'i18n/icu_util.cc', + 'i18n/icu_util.h', + 'i18n/number_formatting.cc', + 'i18n/number_formatting.h', + 'i18n/rtl.cc', + 'i18n/rtl.h', + 'i18n/string_compare.cc', + 'i18n/string_compare.h', + 'i18n/string_search.cc', + 'i18n/string_search.h', + 'i18n/time_formatting.cc', + 'i18n/time_formatting.h', + 'i18n/timezone.cc', + 'i18n/timezone.h', + ], + }] ], }, } diff --git a/base/base_untrusted.gyp b/base/base_untrusted.gyp index e4b005b..a0b65bb 100644 --- a/base/base_untrusted.gyp +++ b/base/base_untrusted.gyp @@ -23,6 +23,7 @@ 'build_glibc': 1, 'build_newlib': 1, 'build_irt': 1, + 'build_pnacl_newlib': 1, 'sources': [ 'base_switches.cc', 'base_switches.h', @@ -35,6 +36,32 @@ '<(DEPTH)/native_client/tools.gyp:prep_toolchain', ], }, + { + 'target_name': 'base_i18n_untrusted', + 'type': 'none', + 'variables': { + 'base_i18n_target': 1, + 'nacl_untrusted_build': 1, + 'nlib_target': 'libbase_i18n_untrusted.a', + 'build_glibc': 0, + 'build_newlib': 1, + 'build_irt': 0, + 'build_pnacl_newlib': 1, + 'sources': [ + 'base_switches.cc', + 'base_switches.h', + 'strings/string16.cc', + 'sync_socket_nacl.cc', + 'time/time_posix.cc', + ], + }, + 'dependencies': [ + '<(DEPTH)/third_party/icu/icu_untrusted.gyp:icudata_untrusted', + '<(DEPTH)/third_party/icu/icu_untrusted.gyp:icui18n_untrusted', + '<(DEPTH)/third_party/icu/icu_untrusted.gyp:icuuc_untrusted', + '<(DEPTH)/native_client/tools.gyp:prep_toolchain', + ], + }, ], }], ], diff --git a/base/location.cc b/base/location.cc index b5da027..d87ed35 100644 --- a/base/location.cc +++ b/base/location.cc @@ -92,10 +92,9 @@ __declspec(noinline) BASE_EXPORT const void* GetProgramCounter() { #if defined(COMPILER_MSVC) return _ReturnAddress(); -#elif defined(COMPILER_GCC) +#elif defined(COMPILER_GCC) && !defined(OS_NACL) return __builtin_extract_return_addr(__builtin_return_address(0)); #endif // COMPILER_GCC - return NULL; } diff --git a/base/sys_byteorder.h b/base/sys_byteorder.h index 17b662c..6235d69 100644 --- a/base/sys_byteorder.h +++ b/base/sys_byteorder.h @@ -20,59 +20,27 @@ #include <arpa/inet.h> #endif -// Include headers to provide byteswap for all platforms. -#if defined(COMPILER_MSVC) -#include <stdlib.h> -#elif defined(OS_MACOSX) -#include <libkern/OSByteOrder.h> -#elif defined(OS_BSD) -#include <sys/endian.h> -#else -#include <byteswap.h> -#endif - - namespace base { // Returns a value with all bytes in |x| swapped, i.e. reverses the endianness. inline uint16 ByteSwap(uint16 x) { -#if defined(COMPILER_MSVC) - return _byteswap_ushort(x); -#elif defined(OS_MACOSX) - return OSSwapInt16(x); -#elif defined(OS_OPENBSD) - return swap16(x); -#elif defined(OS_FREEBSD) - return bswap16(x); -#else - return bswap_16(x); -#endif + return ((x & 0x00ff) << 8) | ((x & 0xff00) >> 8); } + inline uint32 ByteSwap(uint32 x) { -#if defined(COMPILER_MSVC) - return _byteswap_ulong(x); -#elif defined(OS_MACOSX) - return OSSwapInt32(x); -#elif defined(OS_OPENBSD) - return swap32(x); -#elif defined(OS_FREEBSD) - return bswap32(x); -#else - return bswap_32(x); -#endif + return ((x & 0x000000fful) << 24) | ((x & 0x0000ff00ul) << 8) | + ((x & 0x00ff0000ul) >> 8) | ((x & 0xff000000ul) >> 24); } + inline uint64 ByteSwap(uint64 x) { -#if defined(COMPILER_MSVC) - return _byteswap_uint64(x); -#elif defined(OS_MACOSX) - return OSSwapInt64(x); -#elif defined(OS_OPENBSD) - return swap64(x); -#elif defined(OS_FREEBSD) - return bswap64(x); -#else - return bswap_64(x); -#endif + return ((x & 0x00000000000000ffull) << 56) | + ((x & 0x000000000000ff00ull) << 40) | + ((x & 0x0000000000ff0000ull) << 24) | + ((x & 0x00000000ff000000ull) << 8) | + ((x & 0x000000ff00000000ull) >> 8) | + ((x & 0x0000ff0000000000ull) >> 24) | + ((x & 0x00ff000000000000ull) >> 40) | + ((x & 0xff00000000000000ull) >> 56); } // Converts the bytes in |x| from host order (endianness) to little endian, and diff --git a/base/third_party/nspr/prcpucfg_nacl.h b/base/third_party/nspr/prcpucfg_nacl.h index d8602d3..ed44dd7 100644 --- a/base/third_party/nspr/prcpucfg_nacl.h +++ b/base/third_party/nspr/prcpucfg_nacl.h @@ -94,7 +94,7 @@ #define PR_BYTES_PER_WORD_LOG2 3 #define PR_BYTES_PER_DWORD_LOG2 3 -#elif defined(__i386__) +#elif defined(__i386__) || defined(__pnacl__) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN |