Fix libdl dependency on Android and remove librt hack.

The libdl library is already included on target builds of Android and needs
to be added to the build command line with a particular order to avoid
undefined references in other libraries. Fix this by only explicitly including
it in host builds and relying on the implicit inclusion on target builds.

Also remove the librt hack which is not longer necessary due to the AOSP build
bot having been removed.

BUG=chromium:469973
LOG=Y

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

Cr-Commit-Position: refs/heads/master@{#27535}
This commit is contained in:
rmcilroy 2015-03-31 05:08:10 -07:00 committed by Commit bot
parent df40d51e7d
commit 11c4e2f2f7
5 changed files with 18 additions and 55 deletions

View File

@ -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" ]

View File

@ -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);

View File

@ -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<KernelTimestampClock,
DefaultConstructTrait<KernelTimestampClock>,

View File

@ -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

View File

@ -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'
]