summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2017-09-18 22:47:36 +0000
committerVitaly Buka <vitalybuka@google.com>2017-09-18 22:47:36 +0000
commit6863972b48e91440ff4f0ef24a96a9bd6e3eb8b8 (patch)
tree0e20e147b2ba4b162a2c0270eaa777a179136dab
parent3c1c34d5c51406f878373273610e9aefa115916e (diff)
downloadbcm5719-llvm-6863972b48e91440ff4f0ef24a96a9bd6e3eb8b8.tar.gz
bcm5719-llvm-6863972b48e91440ff4f0ef24a96a9bd6e3eb8b8.zip
Revert "[ubsan] Split ubsan_init_standalone"
Breaks build. This reverts commit r313583 and r313584. llvm-svn: 313585
-rw-r--r--compiler-rt/lib/ubsan/CMakeLists.txt15
-rw-r--r--compiler-rt/lib/ubsan/ubsan_init_standalone.cc7
-rw-r--r--compiler-rt/lib/ubsan/ubsan_init_standalone_preinit.cc26
3 files changed, 10 insertions, 38 deletions
diff --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt
index 0375cffb98e..a29c0eed9d3 100644
--- a/compiler-rt/lib/ubsan/CMakeLists.txt
+++ b/compiler-rt/lib/ubsan/CMakeLists.txt
@@ -10,6 +10,7 @@ set(UBSAN_SOURCES
set(UBSAN_STANDALONE_SOURCES
ubsan_diag_standalone.cc
+ ubsan_init_standalone.cc
)
set(UBSAN_CXXABI_SOURCES
@@ -63,7 +64,6 @@ if(APPLE)
OS ${SANITIZER_COMMON_SUPPORTED_OS}
ARCHS ${UBSAN_SUPPORTED_ARCH}
SOURCES ${UBSAN_STANDALONE_SOURCES}
- ubsan_init_standalone.cc
CFLAGS ${UBSAN_STANDALONE_CFLAGS})
add_weak_symbols("ubsan" WEAK_SYMBOL_LINK_FLAGS)
@@ -133,15 +133,7 @@ else()
# Initializer of standalone UBSan runtime.
add_compiler_rt_object_libraries(RTUbsan_standalone
ARCHS ${UBSAN_SUPPORTED_ARCH}
- SOURCES ${UBSAN_STANDALONE_SOURCES}
- ubsan_init_standalone
- CFLAGS ${UBSAN_STANDALONE_CFLAGS})
- # This can't not be linked into share lib
- add_compiler_rt_object_libraries(RTUbsan_standalone_preinit
- ARCHS ${UBSAN_SUPPORTED_ARCH}
- SOURCES ${UBSAN_STANDALONE_SOURCES}
- ubsan_init_standalone_preinit.cc
- CFLAGS ${UBSAN_STANDALONE_CFLAGS})
+ SOURCES ${UBSAN_STANDALONE_SOURCES} CFLAGS ${UBSAN_STANDALONE_CFLAGS})
# Standalone UBSan runtimes.
add_compiler_rt_runtime(clang_rt.ubsan_standalone
@@ -150,7 +142,7 @@ else()
OBJECT_LIBS RTSanitizerCommon
RTSanitizerCommonLibc
RTUbsan
- RTUbsan_standalone_preinit
+ RTUbsan_standalone
CFLAGS ${UBSAN_CFLAGS}
PARENT_TARGET ubsan)
@@ -168,7 +160,6 @@ else()
OBJECT_LIBS RTSanitizerCommon
RTSanitizerCommonLibc
RTUbsan
- RTUbsan_standalone
CFLAGS ${UBSAN_CFLAGS}
LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}
LINK_LIBS ${UBSAN_DYNAMIC_LIBS}
diff --git a/compiler-rt/lib/ubsan/ubsan_init_standalone.cc b/compiler-rt/lib/ubsan/ubsan_init_standalone.cc
index 8e999e3aca1..ff1a20efea3 100644
--- a/compiler-rt/lib/ubsan/ubsan_init_standalone.cc
+++ b/compiler-rt/lib/ubsan/ubsan_init_standalone.cc
@@ -19,6 +19,11 @@
#include "sanitizer_common/sanitizer_internal_defs.h"
#include "ubsan_init.h"
+#if SANITIZER_CAN_USE_PREINIT_ARRAY
+__attribute__((section(".preinit_array"), used))
+void (*__local_ubsan_preinit)(void) = __ubsan::InitAsStandalone;
+#else
+// Use a dynamic initializer.
class UbsanStandaloneInitializer {
public:
UbsanStandaloneInitializer() {
@@ -26,3 +31,5 @@ class UbsanStandaloneInitializer {
}
};
static UbsanStandaloneInitializer ubsan_standalone_initializer;
+#endif // SANITIZER_CAN_USE_PREINIT_ARRAY
+
diff --git a/compiler-rt/lib/ubsan/ubsan_init_standalone_preinit.cc b/compiler-rt/lib/ubsan/ubsan_init_standalone_preinit.cc
deleted file mode 100644
index 229ecc5c8df..00000000000
--- a/compiler-rt/lib/ubsan/ubsan_init_standalone_preinit.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-//===-- ubsan_init_standalone_preinit.cc
-//------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Initialization of standalone UBSan runtime.
-//
-//===----------------------------------------------------------------------===//
-
-#include "ubsan_platform.h"
-#if !CAN_SANITIZE_UB
-#error "UBSan is not supported on this platform!"
-#endif
-
-#include "sanitizer_common/sanitizer_internal_defs.h"
-#include "ubsan_init.h"
-
-#if SANITIZER_CAN_USE_PREINIT_ARRAY
-__attribute__((section(".preinit_array"), used)) void (*__local_ubsan_preinit)(
- void) = __ubsan::InitAsStandalone;
-#endif // SANITIZER_CAN_USE_PREINIT_ARRAY
OpenPOWER on IntegriCloud