[compiler-rt] r298287 - Revert r298174, r298173, r298169, r298159.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 11:45:27 PDT 2017


Author: eugenis
Date: Mon Mar 20 13:45:27 2017
New Revision: 298287

URL: http://llvm.org/viewvc/llvm-project?rev=298287&view=rev
Log:
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.

Added:
    compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections.cc
Removed:
    compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-bfd.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-lld.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections-lld.cc
Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/lib/asan/asan_globals.cc
    compiler-rt/trunk/lib/asan/asan_interface.inc
    compiler-rt/trunk/lib/asan/asan_interface_internal.h
    compiler-rt/trunk/test/asan/CMakeLists.txt
    compiler-rt/trunk/test/cfi/CMakeLists.txt
    compiler-rt/trunk/test/lit.common.configured.in

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=298287&r1=298286&r2=298287&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Mon Mar 20 13:45:27 2017
@@ -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)
 

Modified: compiler-rt/trunk/lib/asan/asan_globals.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_globals.cc?rev=298287&r1=298286&r2=298287&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_globals.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_globals.cc Mon Mar 20 13:45:27 2017
@@ -332,26 +332,6 @@ void __asan_unregister_image_globals(upt
   *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;

Modified: compiler-rt/trunk/lib/asan/asan_interface.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface.inc?rev=298287&r1=298286&r2=298287&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interface.inc (original)
+++ compiler-rt/trunk/lib/asan/asan_interface.inc Mon Mar 20 13:45:27 2017
@@ -64,7 +64,6 @@ INTERFACE_FUNCTION(__asan_poison_stack_m
 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
 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)

Modified: compiler-rt/trunk/lib/asan/asan_interface_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interface_internal.h?rev=298287&r1=298286&r2=298287&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interface_internal.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interface_internal.h Mon Mar 20 13:45:27 2017
@@ -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

Modified: compiler-rt/trunk/test/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/CMakeLists.txt?rev=298287&r1=298286&r2=298287&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/asan/CMakeLists.txt Mon Mar 20 13:45:27 2017
@@ -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
     )

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-bfd.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-bfd.cc?rev=298286&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-bfd.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-bfd.cc (removed)
@@ -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;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-lld.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-lld.cc?rev=298286&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-lld.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/global-overflow-lld.cc (removed)
@@ -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;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections-lld.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections-lld.cc?rev=298286&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections-lld.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections-lld.cc (removed)
@@ -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;
-}

Added: compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections.cc?rev=298287&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/globals-gc-sections.cc Mon Mar 20 13:45:27 2017
@@ -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;
+}

Modified: compiler-rt/trunk/test/cfi/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/cfi/CMakeLists.txt?rev=298287&r1=298286&r2=298287&view=diff
==============================================================================
--- compiler-rt/trunk/test/cfi/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/cfi/CMakeLists.txt Mon Mar 20 13:45:27 2017
@@ -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
     )

Modified: compiler-rt/trunk/test/lit.common.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.configured.in?rev=298287&r1=298286&r2=298287&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.configured.in (original)
+++ compiler-rt/trunk/test/lit.common.configured.in Mon Mar 20 13:45:27 2017
@@ -26,7 +26,7 @@ set_default("compiler_rt_debug", @COMPIL
 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)
 




More information about the llvm-commits mailing list