summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-10-13 02:30:10 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-10-13 02:30:10 +0000
commiteea8a482183c7e20cb79d229216a78b321ec3c7f (patch)
tree6cb998e6cf5e804946ceafa409ec43c898e524ba /compiler-rt
parentf402f78eb7c259501b0924a54e7e5d94c3b40949 (diff)
downloadbcm5719-llvm-eea8a482183c7e20cb79d229216a78b321ec3c7f.tar.gz
bcm5719-llvm-eea8a482183c7e20cb79d229216a78b321ec3c7f.zip
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... llvm-svn: 165863
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/ubsan/ubsan_diag.cc2
-rw-r--r--compiler-rt/lib/ubsan/ubsan_value.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_value.h6
3 files changed, 8 insertions, 4 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cc b/compiler-rt/lib/ubsan/ubsan_diag.cc
index 80955420489..05d81320c27 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cc
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cc
@@ -36,7 +36,7 @@ Diag &Diag::operator<<(const Value &V) {
/// 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),
diff --git a/compiler-rt/lib/ubsan/ubsan_value.cc b/compiler-rt/lib/ubsan/ubsan_value.cc
index 0b368953e12..3d6a73548f4 100644
--- a/compiler-rt/lib/ubsan/ubsan_value.cc
+++ b/compiler-rt/lib/ubsan/ubsan_value.cc
@@ -27,7 +27,7 @@ SIntMax Value::getSIntValue() const {
}
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 @@ UIntMax Value::getUIntValue() const {
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
diff --git a/compiler-rt/lib/ubsan/ubsan_value.h b/compiler-rt/lib/ubsan/ubsan_value.h
index 9426c6943db..e92b2d6fcc1 100644
--- a/compiler-rt/lib/ubsan/ubsan_value.h
+++ b/compiler-rt/lib/ubsan/ubsan_value.h
@@ -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
OpenPOWER on IntegriCloud