summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-03-20 18:45:27 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-03-20 18:45:27 +0000
commitdc8b945decb8d19208975f9c90c0037cbb408d80 (patch)
tree6cd1078e8bf405738284c710687246f17ae4f719
parenta36125098f2fec54690d0d20965a6010dc5d3e38 (diff)
Revert r298174, r298173, r298169, r298159.
Revert "Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF." Revert "[asan] Remove gc-sections test with bfd." Revert "[asan] Disable globals-gc test with ld.bfd." Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)" OOM in gold linker. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298287 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt8
-rw-r--r--lib/asan/asan_globals.cc20
-rw-r--r--lib/asan/asan_interface.inc2
-rw-r--r--lib/asan/asan_interface_internal.h5
-rw-r--r--test/asan/CMakeLists.txt2
-rw-r--r--test/asan/TestCases/Linux/global-overflow-bfd.cc18
-rw-r--r--test/asan/TestCases/Linux/global-overflow-lld.cc19
-rw-r--r--test/asan/TestCases/Linux/globals-gc-sections-lld.cc15
-rw-r--r--test/asan/TestCases/Linux/globals-gc-sections.cc13
-rw-r--r--test/cfi/CMakeLists.txt2
-rw-r--r--test/lit.common.configured.in2
11 files changed, 20 insertions, 86 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14e493d3b..cbde83113 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -253,12 +253,12 @@ else()
endif()
set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
-if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
- set(COMPILER_RT_HAS_LLD TRUE)
+if(EXISTS ${COMPILER_RT_LLD_PATH}/)
+ set(COMPILER_RT_HAS_LLD_SOURCES TRUE)
else()
- set(COMPILER_RT_HAS_LLD FALSE)
+ set(COMPILER_RT_HAS_LLD_SOURCES FALSE)
endif()
-pythonize_bool(COMPILER_RT_HAS_LLD)
+pythonize_bool(COMPILER_RT_HAS_LLD_SOURCES)
add_subdirectory(lib)
diff --git a/lib/asan/asan_globals.cc b/lib/asan/asan_globals.cc
index eebada804..b72330673 100644
--- a/lib/asan/asan_globals.cc
+++ b/lib/asan/asan_globals.cc
@@ -332,26 +332,6 @@ void __asan_unregister_image_globals(uptr *flag) {
*flag = 0;
}
-void __asan_register_elf_globals(uptr *flag, void *start, void *stop) {
- if (*flag) return;
- if (!start) return;
- CHECK_EQ(0, ((uptr)stop - (uptr)start) % sizeof(__asan_global));
- __asan_global *globals_start = (__asan_global*)start;
- __asan_global *globals_stop = (__asan_global*)stop;
- __asan_register_globals(globals_start, globals_stop - globals_start);
- *flag = 1;
-}
-
-void __asan_unregister_elf_globals(uptr *flag, void *start, void *stop) {
- if (!*flag) return;
- if (!start) return;
- CHECK_EQ(0, ((uptr)stop - (uptr)start) % sizeof(__asan_global));
- __asan_global *globals_start = (__asan_global*)start;
- __asan_global *globals_stop = (__asan_global*)stop;
- __asan_unregister_globals(globals_start, globals_stop - globals_start);
- *flag = 0;
-}
-
// Register an array of globals.
void __asan_register_globals(__asan_global *globals, uptr n) {
if (!flags()->report_globals) return;
diff --git a/lib/asan/asan_interface.inc b/lib/asan/asan_interface.inc
index e65f61722..351be4da5 100644
--- a/lib/asan/asan_interface.inc
+++ b/lib/asan/asan_interface.inc
@@ -64,7 +64,6 @@ INTERFACE_FUNCTION(__asan_poison_stack_memory)
INTERFACE_FUNCTION(__asan_print_accumulated_stats)
INTERFACE_FUNCTION(__asan_region_is_poisoned)
INTERFACE_FUNCTION(__asan_register_globals)
-INTERFACE_FUNCTION(__asan_register_elf_globals)
INTERFACE_FUNCTION(__asan_register_image_globals)
INTERFACE_FUNCTION(__asan_report_error)
INTERFACE_FUNCTION(__asan_report_exp_load1)
@@ -150,7 +149,6 @@ INTERFACE_FUNCTION(__asan_unpoison_intra_object_redzone)
INTERFACE_FUNCTION(__asan_unpoison_memory_region)
INTERFACE_FUNCTION(__asan_unpoison_stack_memory)
INTERFACE_FUNCTION(__asan_unregister_globals)
-INTERFACE_FUNCTION(__asan_unregister_elf_globals)
INTERFACE_FUNCTION(__asan_unregister_image_globals)
INTERFACE_FUNCTION(__asan_version_mismatch_check_v8)
INTERFACE_FUNCTION(__sanitizer_finish_switch_fiber)
diff --git a/lib/asan/asan_interface_internal.h b/lib/asan/asan_interface_internal.h
index b974c0cc4..b18c31548 100644
--- a/lib/asan/asan_interface_internal.h
+++ b/lib/asan/asan_interface_internal.h
@@ -67,11 +67,6 @@ extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __asan_unregister_image_globals(uptr *flag);
- SANITIZER_INTERFACE_ATTRIBUTE
- void __asan_register_elf_globals(uptr *flag, void *start, void *stop);
- SANITIZER_INTERFACE_ATTRIBUTE
- void __asan_unregister_elf_globals(uptr *flag, void *start, void *stop);
-
// These two functions should be called by the instrumented code.
// 'globals' is an array of structures describing 'n' globals.
SANITIZER_INTERFACE_ATTRIBUTE
diff --git a/test/asan/CMakeLists.txt b/test/asan/CMakeLists.txt
index b253742f0..893276767 100644
--- a/test/asan/CMakeLists.txt
+++ b/test/asan/CMakeLists.txt
@@ -16,7 +16,7 @@ endmacro()
set(ASAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND ASAN_TEST_DEPS asan)
- if(NOT APPLE AND COMPILER_RT_HAS_LLD)
+ if(WIN32 AND COMPILER_RT_HAS_LLD_SOURCES)
list(APPEND ASAN_TEST_DEPS
lld
)
diff --git a/test/asan/TestCases/Linux/global-overflow-bfd.cc b/test/asan/TestCases/Linux/global-overflow-bfd.cc
deleted file mode 100644
index 117a761af..000000000
--- a/test/asan/TestCases/Linux/global-overflow-bfd.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// Test that gc-sections-friendly instrumentation of globals does not introduce
-// false negatives with the BFD linker.
-// RUN: %clangxx_asan -fuse-ld=bfd -Wl,-gc-sections -ffunction-sections -fdata-sections -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-#include <string.h>
-int main(int argc, char **argv) {
- static char XXX[10];
- static char YYY[10];
- static char ZZZ[10];
- memset(XXX, 0, 10);
- memset(YYY, 0, 10);
- memset(ZZZ, 0, 10);
- int res = YYY[argc * 10]; // BOOOM
- // CHECK: {{READ of size 1 at}}
- // CHECK: {{located 0 bytes to the right of global variable}}
- res += XXX[argc] + ZZZ[argc];
- return res;
-}
diff --git a/test/asan/TestCases/Linux/global-overflow-lld.cc b/test/asan/TestCases/Linux/global-overflow-lld.cc
deleted file mode 100644
index f4d0bc977..000000000
--- a/test/asan/TestCases/Linux/global-overflow-lld.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-// Test that gc-sections-friendly instrumentation of globals does not introduce
-// false negatives with the LLD linker.
-// RUN: %clangxx_asan -fuse-ld=lld -Wl,-gc-sections -ffunction-sections -fdata-sections -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// REQUIRES: lld
-
-#include <string.h>
-int main(int argc, char **argv) {
- static char XXX[10];
- static char YYY[10];
- static char ZZZ[10];
- memset(XXX, 0, 10);
- memset(YYY, 0, 10);
- memset(ZZZ, 0, 10);
- int res = YYY[argc * 10]; // BOOOM
- // CHECK: {{READ of size 1 at}}
- // CHECK: {{located 0 bytes to the right of global variable}}
- res += XXX[argc] + ZZZ[argc];
- return res;
-}
diff --git a/test/asan/TestCases/Linux/globals-gc-sections-lld.cc b/test/asan/TestCases/Linux/globals-gc-sections-lld.cc
deleted file mode 100644
index 0d8bcdd1c..000000000
--- a/test/asan/TestCases/Linux/globals-gc-sections-lld.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=0
-// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=1
-
-// https://code.google.com/p/address-sanitizer/issues/detail?id=260
-// REQUIRES: lld
-
-int undefined();
-
-// On i386 clang adds --export-dynamic when linking with ASan, which adds all
-// non-hidden globals to GC roots.
-__attribute__((visibility("hidden"))) int (*unused)() = undefined;
-
-int main() {
- return 0;
-}
diff --git a/test/asan/TestCases/Linux/globals-gc-sections.cc b/test/asan/TestCases/Linux/globals-gc-sections.cc
new file mode 100644
index 000000000..72a9e9498
--- /dev/null
+++ b/test/asan/TestCases/Linux/globals-gc-sections.cc
@@ -0,0 +1,13 @@
+// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -ffunction-sections -mllvm -asan-globals=0
+// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -ffunction-sections -mllvm -asan-globals=1
+
+// https://code.google.com/p/address-sanitizer/issues/detail?id=260
+// XFAIL: *
+
+int undefined();
+
+int (*unused)() = undefined;
+
+int main() {
+ return 0;
+}
diff --git a/test/cfi/CMakeLists.txt b/test/cfi/CMakeLists.txt
index c3123a820..bd51eacb6 100644
--- a/test/cfi/CMakeLists.txt
+++ b/test/cfi/CMakeLists.txt
@@ -34,7 +34,7 @@ if(NOT COMPILER_RT_STANDALONE_BUILD)
LTO
)
endif()
- if(WIN32 AND COMPILER_RT_HAS_LLD)
+ if(WIN32 AND COMPILER_RT_HAS_LLD_SOURCES)
list(APPEND CFI_TEST_DEPS
lld
)
diff --git a/test/lit.common.configured.in b/test/lit.common.configured.in
index 387f4d4a7..862d06bf2 100644
--- a/test/lit.common.configured.in
+++ b/test/lit.common.configured.in
@@ -26,7 +26,7 @@ set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
set_default("compiler_rt_libdir", "@COMPILER_RT_LIBRARY_OUTPUT_DIR@")
set_default("emulator", "@COMPILER_RT_EMULATOR@")
set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
-set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
+set_default("has_lld", @COMPILER_RT_HAS_LLD_SOURCES_PYBOOL@)
set_default("can_symbolize", @CAN_SYMBOLIZE@)
config.available_features.add('target-is-%s' % config.target_arch)