Reviewers: jochen,

Message:
(see also http://llvm.org/PR20896)

Description:
Improve x32 detection macro.

When targeting the Microsoft ABI in 64bit mode, clang defines __x86_64__ but
doesn't define __LP64__ (Microsoft uses LLP64), so it would fall down the x32
path. cl.exe doesn't define __x86_64__ in the first place, so it didn't have
this problem.

Rather than trying to guess pointer size by looking at __x86_64__ and __LP64__, check for pointer size directly using __POINTER_SIZE__. This is defined by both
gcc and clang, and eliminiates this problem.

This should fix hundreds of "error(clang): unknown type name 'Atomic64'" when
compiling v8 on Windows with clang for 64 bit.

BUG=chromium:82385

Please review this at https://codereview.chromium.org/560903002/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files (+2, -2 lines):
  M     src/base/build_config.h


Index: src/base/build_config.h
===================================================================
--- src/base/build_config.h     (revision 23846)
+++ src/base/build_config.h     (working copy)
@@ -24,7 +24,7 @@
 #define V8_HOST_CAN_READ_UNALIGNED 1
 #else
 #define V8_HOST_ARCH_X64 1
-#if defined(__x86_64__) && !defined(__LP64__)
+#if defined(__x86_64__) && __SIZEOF_POINTER__ == 32  // Check for x32.
 #define V8_HOST_ARCH_32_BIT 1
 #else
 #define V8_HOST_ARCH_64_BIT 1
@@ -90,7 +90,7 @@
 #define V8_TARGET_ARCH_32_BIT 1
 #elif V8_TARGET_ARCH_X64
 #if !V8_TARGET_ARCH_32_BIT && !V8_TARGET_ARCH_64_BIT
-#if defined(__x86_64__) && !defined(__LP64__)
+#if defined(__x86_64__) && __SIZEOF_POINTER__ == 32  // Check for x32.
 #define V8_TARGET_ARCH_32_BIT 1
 #else
 #define V8_TARGET_ARCH_64_BIT 1


--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to