[llvm-commits] [compiler-rt] r165863 - in /compiler-rt/trunk/lib/ubsan: ubsan_diag.cc ubsan_value.cc ubsan_value.h

Chandler Carruth chandlerc at gmail.com
Fri Oct 12 19:30:10 PDT 2012


Author: chandlerc
Date: Fri Oct 12 21:30:10 2012
New Revision: 165863

URL: http://llvm.org/viewvc/llvm-project?rev=165863&view=rev
Log:
Fix the bootstrap of CompilerRT with host compilers that don't support
emulating 128-bit arithmetic on 32-bit x86 targets. This should get the
bootstrap back for GCC 4.6 at least.

Suggestions on better ways to do the detection here are welcome...

Modified:
    compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
    compiler-rt/trunk/lib/ubsan/ubsan_value.cc
    compiler-rt/trunk/lib/ubsan/ubsan_value.h

Modified: compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_diag.cc?rev=165863&r1=165862&r2=165863&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.cc Fri Oct 12 21:30:10 2012
@@ -36,7 +36,7 @@
 
 /// Hexadecimal printing for numbers too large for fprintf to handle directly.
 static void PrintHex(UIntMax Val) {
-#ifdef HAVE_INT128_T
+#if HAVE_INT128_T
   fprintf(stderr, "0x%08x%08x%08x%08x",
           (unsigned int)(Val >> 96),
           (unsigned int)(Val >> 64),

Modified: compiler-rt/trunk/lib/ubsan/ubsan_value.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_value.cc?rev=165863&r1=165862&r2=165863&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_value.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_value.cc Fri Oct 12 21:30:10 2012
@@ -27,7 +27,7 @@
   }
   if (getType().getIntegerBitWidth() == 64)
     return *reinterpret_cast<s64*>(Val);
-#ifdef HAVE_INT128_T
+#if HAVE_INT128_T
   if (getType().getIntegerBitWidth() == 128)
     return *reinterpret_cast<s128*>(Val);
 #endif
@@ -40,7 +40,7 @@
     return Val;
   if (getType().getIntegerBitWidth() == 64)
     return *reinterpret_cast<u64*>(Val);
-#ifdef HAVE_INT128_T
+#if HAVE_INT128_T
   if (getType().getIntegerBitWidth() == 128)
     return *reinterpret_cast<u128*>(Val);
 #endif

Modified: compiler-rt/trunk/lib/ubsan/ubsan_value.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_value.h?rev=165863&r1=165862&r2=165863&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_value.h (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_value.h Fri Oct 12 21:30:10 2012
@@ -23,15 +23,19 @@
 #include "sanitizer_common/sanitizer_common.h"
 
 // FIXME: Move this out to a config header.
+#if defined(__clang__) || _LP64
 typedef __int128 s128;
 typedef unsigned __int128 u128;
 #define HAVE_INT128_T 1
+#else
+#define HAVE_INT128_T 0
+#endif
 
 
 namespace __ubsan {
 
 /// \brief Largest integer types we support.
-#ifdef HAVE_INT128_T
+#if HAVE_INT128_T
 typedef s128 SIntMax;
 typedef u128 UIntMax;
 #else





More information about the llvm-commits mailing list