Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 3589a62

Browse files
Julien Gillitjfontaine
Julien Gilli
authored andcommitted
build: fix build for SmartOS
This change in V8: https://code.google.com/p/v8/source/detail?r=22210 has introduced a method named OS::GetCurrentThreadId which fails to compile on OSes where a "gettid" syscall does not exist. This build issue has been fixed upstream by several changes: - https://code.google.com/p/v8/source/detail?r=23459. - https://codereview.chromium.org/649553002 - https://codereview.chromium.org/642223003 Another minor fix to the upstream changes was also necessary. See https://code.google.com/p/v8/issues/detail?id=3620 for more information. The other build issue was due to the fact that alloca.h is not included by other system includes on SmartOS, which is assumed by V8. Built and tested on Linux, MacOS X, Windows and SmartOS.
1 parent f65a5cb commit 3589a62

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

deps/v8/src/base/platform/platform-posix.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,15 @@ int OS::GetCurrentProcessId() {
321321

322322

323323
int OS::GetCurrentThreadId() {
324-
#if defined(ANDROID)
324+
#if V8_OS_MACOSX
325+
return static_cast<int>(pthread_mach_thread_np(pthread_self()));
326+
#elif V8_OS_LINUX
325327
return static_cast<int>(syscall(__NR_gettid));
328+
#elif V8_OS_ANDROID
329+
return static_cast<int>(gettid());
326330
#else
327-
return static_cast<int>(syscall(SYS_gettid));
328-
#endif // defined(ANDROID)
331+
return static_cast<int>(pthread_self());
332+
#endif
329333
}
330334

331335

deps/v8/src/base/platform/platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace std {
3535
int signbit(double x);
3636
}
3737
# endif
38+
#include <alloca.h>
3839
#endif
3940

4041
#if V8_OS_QNX

0 commit comments

Comments
 (0)