summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2015-03-26 17:26:04 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2015-03-26 17:26:04 +0000
commit0781e98cc74223fd73491bc44a9d406f2c0b41c1 (patch)
tree4cf467a50da58b65e7d4cf8649298026a1c7377b
parent5b305d2d66ebc0243795bce74466702f9901a434 (diff)
downloadbcm5719-llvm-0781e98cc74223fd73491bc44a9d406f2c0b41c1.tar.gz
bcm5719-llvm-0781e98cc74223fd73491bc44a9d406f2c0b41c1.zip
[UBSan] Explicitly list all supported OS/arch pairs supported by UBSan.
llvm-svn: 233295
-rw-r--r--compiler-rt/lib/ubsan/ubsan_diag.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_flags.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_handlers.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_handlers_cxx.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_init.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_platform.h26
-rw-r--r--compiler-rt/lib/ubsan/ubsan_type_hash.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_value.cc4
-rw-r--r--compiler-rt/lib/ubsan/ubsan_value.h7
9 files changed, 54 insertions, 7 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cc b/compiler-rt/lib/ubsan/ubsan_diag.cc
index 0eff1f63694..2314fb6edbd 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cc
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cc
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ubsan_platform.h"
+#if CAN_SANITIZE_UB
#include "ubsan_diag.h"
#include "ubsan_init.h"
#include "ubsan_flags.h"
@@ -361,3 +363,5 @@ bool __ubsan::IsVptrCheckSuppressed(const char *TypeName) {
Suppression *s;
return suppression_ctx->Match(TypeName, kVptrCheck, &s);
}
+
+#endif // CAN_SANITIZE_UB
diff --git a/compiler-rt/lib/ubsan/ubsan_flags.cc b/compiler-rt/lib/ubsan/ubsan_flags.cc
index 0dbffc9b102..49ada8a2650 100644
--- a/compiler-rt/lib/ubsan/ubsan_flags.cc
+++ b/compiler-rt/lib/ubsan/ubsan_flags.cc
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ubsan_platform.h"
+#if CAN_SANITIZE_UB
#include "ubsan_flags.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flags.h"
@@ -77,3 +79,5 @@ SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
const char *__ubsan_default_options() { return ""; }
} // extern "C"
#endif
+
+#endif // CAN_SANITIZE_UB
diff --git a/compiler-rt/lib/ubsan/ubsan_handlers.cc b/compiler-rt/lib/ubsan/ubsan_handlers.cc
index 78e7508f7f9..a65b2f5e3fc 100644
--- a/compiler-rt/lib/ubsan/ubsan_handlers.cc
+++ b/compiler-rt/lib/ubsan/ubsan_handlers.cc
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ubsan_platform.h"
+#if CAN_SANITIZE_UB
#include "ubsan_handlers.h"
#include "ubsan_diag.h"
@@ -419,3 +421,5 @@ void __ubsan::__ubsan_handle_nonnull_arg_abort(NonNullArgData *Data) {
handleNonNullArg(Data, Opts);
Die();
}
+
+#endif // CAN_SANITIZE_UB
diff --git a/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cc b/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cc
index 4718e6eacee..b3cda32a98f 100644
--- a/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cc
+++ b/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cc
@@ -13,6 +13,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ubsan_platform.h"
+#if CAN_SANITIZE_UB
#include "ubsan_handlers_cxx.h"
#include "ubsan_diag.h"
#include "ubsan_type_hash.h"
@@ -79,3 +81,5 @@ void __ubsan::__ubsan_handle_dynamic_type_cache_miss_abort(
GET_REPORT_OPTIONS(true);
HandleDynamicTypeCacheMiss(Data, Pointer, Hash, Opts);
}
+
+#endif // CAN_SANITIZE_UB
diff --git a/compiler-rt/lib/ubsan/ubsan_init.cc b/compiler-rt/lib/ubsan/ubsan_init.cc
index 219273d5192..9527269773d 100644
--- a/compiler-rt/lib/ubsan/ubsan_init.cc
+++ b/compiler-rt/lib/ubsan/ubsan_init.cc
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ubsan_platform.h"
+#if CAN_SANITIZE_UB
#include "ubsan_diag.h"
#include "ubsan_init.h"
#include "ubsan_flags.h"
@@ -61,3 +63,5 @@ class UbsanInitializer {
};
static UbsanInitializer ubsan_initializer;
#endif // SANITIZER_CAN_USE_PREINIT_ARRAY
+
+#endif // CAN_SANITIZE_UB
diff --git a/compiler-rt/lib/ubsan/ubsan_platform.h b/compiler-rt/lib/ubsan/ubsan_platform.h
new file mode 100644
index 00000000000..efb7974d46d
--- /dev/null
+++ b/compiler-rt/lib/ubsan/ubsan_platform.h
@@ -0,0 +1,26 @@
+//===-- ubsan_platform.h ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Defines the platforms which UBSan is supported at.
+//
+//===----------------------------------------------------------------------===//
+#ifndef UBSAN_PLATFORM_H
+#define UBSAN_PLATFORM_H
+
+// Other platforms should be easy to add, and probably work as-is.
+#if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \
+ (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
+ defined(__aarch64__) || defined(__mips__))
+# define CAN_SANITIZE_UB 1
+#else
+# define CAN_SANITIZE_UB 0
+# error "UBSan not supported for this platform!"
+#endif
+
+#endif
diff --git a/compiler-rt/lib/ubsan/ubsan_type_hash.cc b/compiler-rt/lib/ubsan/ubsan_type_hash.cc
index a388bcc6d72..c85d68dfd5f 100644
--- a/compiler-rt/lib/ubsan/ubsan_type_hash.cc
+++ b/compiler-rt/lib/ubsan/ubsan_type_hash.cc
@@ -13,6 +13,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ubsan_platform.h"
+#if CAN_SANITIZE_UB
#include "ubsan_type_hash.h"
#include "sanitizer_common/sanitizer_common.h"
@@ -248,3 +250,5 @@ __ubsan::DynamicTypeInfo __ubsan::getDynamicTypeInfo(void *Object) {
return DynamicTypeInfo(Vtable->TypeInfo->__type_name, -Vtable->Offset,
ObjectType ? ObjectType->__type_name : "<unknown>");
}
+
+#endif // CAN_SANITIZE_UB
diff --git a/compiler-rt/lib/ubsan/ubsan_value.cc b/compiler-rt/lib/ubsan/ubsan_value.cc
index ab74720f60c..ea91d63bbb8 100644
--- a/compiler-rt/lib/ubsan/ubsan_value.cc
+++ b/compiler-rt/lib/ubsan/ubsan_value.cc
@@ -12,6 +12,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ubsan_platform.h"
+#if CAN_SANITIZE_UB
#include "ubsan_value.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_libc.h"
@@ -100,3 +102,5 @@ FloatMax Value::getFloatValue() const {
}
UNREACHABLE("unexpected floating point bit width");
}
+
+#endif // CAN_SANITIZE_UB
diff --git a/compiler-rt/lib/ubsan/ubsan_value.h b/compiler-rt/lib/ubsan/ubsan_value.h
index a6810844049..72eee15551e 100644
--- a/compiler-rt/lib/ubsan/ubsan_value.h
+++ b/compiler-rt/lib/ubsan/ubsan_value.h
@@ -14,12 +14,6 @@
#ifndef UBSAN_VALUE_H
#define UBSAN_VALUE_H
-// For now, only support Linux, FreeBSD and Darwin. Other platforms should
-// be easy to add, and probably work as-is.
-#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__APPLE__)
-#error "UBSan not supported for this platform!"
-#endif
-
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_common.h"
@@ -32,7 +26,6 @@ __extension__ typedef unsigned __int128 u128;
#define HAVE_INT128_T 0
#endif
-
namespace __ubsan {
/// \brief Largest integer types we support.
OpenPOWER on IntegriCloud