Reviewers: jochen, Benedikt Meurer (OOO), jarin,
Message:
jochen for libdl fix
bmeurer for librt hack removal
jarin as FYI for perf-jit comment removal.
PTAL, thanks!
Description:
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
Please review this at https://codereview.chromium.org/1036133005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+18, -55 lines):
M BUILD.gn
M src/base/platform/condition-variable.cc
M src/base/platform/time.cc
M src/perf-jit.h
M tools/gyp/v8.gyp
Index: BUILD.gn
diff --git a/BUILD.gn b/BUILD.gn
index
fc0ea8eb6802bfb5e4a94a353d87141128e67f4a..6b102f37a102c1a03734a186106032d001ea4ce7
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" ]
Index: src/base/platform/condition-variable.cc
diff --git a/src/base/platform/condition-variable.cc
b/src/base/platform/condition-variable.cc
index
b91025a3dbb86b9e242221695a071d1c8fef7c9b..982497fea449959c54d2ceea5ed0ee70809a7785
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);
Index: src/base/platform/time.cc
diff --git a/src/base/platform/time.cc b/src/base/platform/time.cc
index
6734218e5071a94180cfa007569100407589a6c3..e4480e11f58b5d3af3590bead49deb851b21eff7
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<KernelTimestampClock,
DefaultConstructTrait<KernelTimestampClock>,
Index: src/perf-jit.h
diff --git a/src/perf-jit.h b/src/perf-jit.h
index
7872910b29595c4061ad3c77f29d728c201a3102..e1436cd9cb9f5e9d8d7a2f2cc562b15c0a770f11
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
Index: tools/gyp/v8.gyp
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index
effec7b357613d658d37a0aa6c5b81bcea11ed65..5f372481a5167b44e47b69089d77193a8e56364a
100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -1393,8 +1393,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': [
@@ -1411,28 +1420,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'
]
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.