diff --git a/BUILD.gn b/BUILD.gn index fc0ea8eb68..6b102f37a1 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1398,17 +1398,15 @@ source_set("v8_libbase") { } else if (is_android) { defines += [ "CAN_USE_VFP_INSTRUCTIONS" ] - if (host_os == "mac") { - if (current_toolchain == host_toolchain) { + if (current_toolchain == host_toolchain) { + libs = [ "dl", "rt" ] + if (host_os == "mac") { sources += [ "src/base/platform/platform-macos.cc" ] } else { sources += [ "src/base/platform/platform-linux.cc" ] } } else { sources += [ "src/base/platform/platform-linux.cc" ] - if (current_toolchain == host_toolchain) { - defines += [ "V8_LIBRT_NOT_AVAILABLE" ] - } } } else if (is_mac) { sources += [ "src/base/platform/platform-macos.cc" ] diff --git a/src/base/platform/condition-variable.cc b/src/base/platform/condition-variable.cc index b91025a3db..982497fea4 100644 --- a/src/base/platform/condition-variable.cc +++ b/src/base/platform/condition-variable.cc @@ -15,11 +15,8 @@ namespace base { #if V8_OS_POSIX ConditionVariable::ConditionVariable() { - // TODO(bmeurer): The test for V8_LIBRT_NOT_AVAILABLE is a temporary - // hack to support cross-compiling Chrome for Android in AOSP. Remove - // this once AOSP is fixed. #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ - (V8_OS_LINUX && V8_LIBC_GLIBC)) && !V8_LIBRT_NOT_AVAILABLE + (V8_OS_LINUX && V8_LIBC_GLIBC)) // On Free/Net/OpenBSD and Linux with glibc we can change the time // source for pthread_cond_timedwait() to use the monotonic clock. pthread_condattr_t attr; @@ -81,11 +78,8 @@ bool ConditionVariable::WaitFor(Mutex* mutex, const TimeDelta& rel_time) { result = pthread_cond_timedwait_relative_np( &native_handle_, &mutex->native_handle(), &ts); #else - // TODO(bmeurer): The test for V8_LIBRT_NOT_AVAILABLE is a temporary - // hack to support cross-compiling Chrome for Android in AOSP. Remove - // this once AOSP is fixed. #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ - (V8_OS_LINUX && V8_LIBC_GLIBC)) && !V8_LIBRT_NOT_AVAILABLE + (V8_OS_LINUX && V8_LIBC_GLIBC)) // On Free/Net/OpenBSD and Linux with glibc we can change the time // source for pthread_cond_timedwait() to use the monotonic clock. result = clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/src/base/platform/time.cc b/src/base/platform/time.cc index 6734218e50..e4480e11f5 100644 --- a/src/base/platform/time.cc +++ b/src/base/platform/time.cc @@ -548,15 +548,6 @@ TimeTicks TimeTicks::HighResolutionNow() { info.numer / info.denom); #elif V8_OS_SOLARIS ticks = (gethrtime() / Time::kNanosecondsPerMicrosecond); -#elif V8_LIBRT_NOT_AVAILABLE - // TODO(bmeurer): This is a temporary hack to support cross-compiling - // Chrome for Android in AOSP. Remove this once AOSP is fixed, also - // cleanup the tools/gyp/v8.gyp file. - struct timeval tv; - int result = gettimeofday(&tv, NULL); - DCHECK_EQ(0, result); - USE(result); - ticks = (tv.tv_sec * Time::kMicrosecondsPerSecond + tv.tv_usec); #elif V8_OS_POSIX struct timespec ts; int result = clock_gettime(CLOCK_MONOTONIC, &ts); @@ -576,7 +567,7 @@ bool TimeTicks::IsHighResolutionClockWorking() { } -#if V8_OS_LINUX && !V8_LIBRT_NOT_AVAILABLE +#if V8_OS_LINUX class KernelTimestampClock { public: @@ -632,7 +623,7 @@ class KernelTimestampClock { bool Available() { return false; } }; -#endif // V8_OS_LINUX && !V8_LIBRT_NOT_AVAILABLE +#endif // V8_OS_LINUX static LazyStaticInstance, diff --git a/src/perf-jit.h b/src/perf-jit.h index 7872910b29..e1436cd9cb 100644 --- a/src/perf-jit.h +++ b/src/perf-jit.h @@ -33,13 +33,6 @@ namespace v8 { namespace internal { -// TODO(jarin) For now, we disable perf integration on Android because of a -// build problem - when building the snapshot with AOSP, librt is not -// available, so we cannot use the clock_gettime function. To fix this, we -// should thread through the V8_LIBRT_NOT_AVAILABLE flag here and only disable -// the perf integration when this flag is present (the perf integration is not -// needed when generating snapshot, so it is fine to ifdef it away). - #if V8_OS_LINUX // Linux perf tool logging support diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index d764b2fcf5..853d99ac97 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -1407,8 +1407,17 @@ '../../src/base/platform/platform-posix.cc' ], 'link_settings': { - 'libraries': [ - '-ldl' + 'target_conditions': [ + ['_toolset=="host"', { + # Only include libdl and librt on host builds because they + # are included by default on Android target builds, and we + # don't want to re-include them here since this will change + # library order and break (see crbug.com/469973). + 'libraries': [ + '-ldl', + '-lrt' + ] + }] ] }, 'conditions': [ @@ -1425,28 +1434,6 @@ }], ], }, { - # TODO(bmeurer): What we really want here, is this: - # - # 'link_settings': { - # 'target_conditions': [ - # ['_toolset=="host"', { - # 'libraries': [ - # '-lrt' - # ] - # }] - # ] - # }, - # - # but we can't do this right now, as the AOSP does not support - # linking against the host librt, so we need to work around this - # for now, using the following hack (see platform/time.cc): - 'target_conditions': [ - ['_toolset=="host"', { - 'defines': [ - 'V8_LIBRT_NOT_AVAILABLE=1', - ], - }], - ], 'sources': [ '../../src/base/platform/platform-linux.cc' ]