[compiler-rt] 88d1724 - [sanitizer] Fix suffix-log-path_test.c on arm-linux-gnu

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 09:26:17 PST 2021


Author: Adhemerval Zanella
Date: 2021-02-11T14:26:04-03:00
New Revision: 88d1724d9b5615fd2e7acf808aac69eeadf7eae7

URL: https://github.com/llvm/llvm-project/commit/88d1724d9b5615fd2e7acf808aac69eeadf7eae7
DIFF: https://github.com/llvm/llvm-project/commit/88d1724d9b5615fd2e7acf808aac69eeadf7eae7.diff

LOG: [sanitizer] Fix suffix-log-path_test.c on arm-linux-gnu

The recent suffix-log-path_test.c checks for a full stacktrace and
since on some arm-linux-gnu configuration the slow unwinder is used
on default (when the compiler emits thumb code as default), it
requires -funwind-tables on tests.

It also seems to fix the issues disable by d025df3c1de.

Reviewed By: ostannard

Differential Revision: https://reviews.llvm.org/D96337

Added: 
    

Modified: 
    compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
    compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp
    compiler-rt/test/lsan/TestCases/disabler.c
    compiler-rt/test/lsan/TestCases/do_leak_check_override.cpp
    compiler-rt/test/lsan/TestCases/ignore_object.c
    compiler-rt/test/lsan/TestCases/use_after_return.cpp
    compiler-rt/test/sanitizer_common/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c b/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
index c26d33dce7d3..18476d5a9ade 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
+++ b/compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
@@ -8,9 +8,6 @@
 // RUN: %env_lsan_opts=$LSAN_BASE:use_tls=1 %run %t
 // RUN: %env_lsan_opts=$LSAN_BASE:use_tls=0 not %run %t 2>&1 | FileCheck %s
 
-// Investigate why it does not fail with use_stack=0
-// UNSUPPORTED: arm-linux || armhf-linux
-
 #include <assert.h>
 #include <pthread.h>
 #include <stdio.h>

diff  --git a/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp b/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp
index ecb6dbe4f764..650e6ad20aa9 100644
--- a/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp
+++ b/compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp
@@ -5,9 +5,6 @@
 // RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
 // RUN: %env_lsan_opts="" %run %t 2>&1
 
-// Investigate why it does not fail with use_tls=0
-// UNSUPPORTED: arm-linux || armhf-linux
-
 #include <assert.h>
 #include <pthread.h>
 #include <stdio.h>

diff  --git a/compiler-rt/test/lsan/TestCases/disabler.c b/compiler-rt/test/lsan/TestCases/disabler.c
index 6bfca7a9f914..73f1b3e36e93 100644
--- a/compiler-rt/test/lsan/TestCases/disabler.c
+++ b/compiler-rt/test/lsan/TestCases/disabler.c
@@ -3,9 +3,6 @@
 // RUN: %clang_lsan %s -o %t
 // RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
 
-// Investigate why it does not fail with use_stack=0
-// UNSUPPORTED: arm-linux || armhf-linux
-
 #include <stdio.h>
 #include <stdlib.h>
 

diff  --git a/compiler-rt/test/lsan/TestCases/do_leak_check_override.cpp b/compiler-rt/test/lsan/TestCases/do_leak_check_override.cpp
index 3503eb0f6426..40a97635cc10 100644
--- a/compiler-rt/test/lsan/TestCases/do_leak_check_override.cpp
+++ b/compiler-rt/test/lsan/TestCases/do_leak_check_override.cpp
@@ -6,9 +6,6 @@
 // RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck --check-prefix=CHECK-strict %s
 // RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck --check-prefix=CHECK-normal %s
 
-// Investigate why LeakyGlobal leak does show
-// UNSUPPORTED: arm-linux || armhf-linux
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <sanitizer/lsan_interface.h>

diff  --git a/compiler-rt/test/lsan/TestCases/ignore_object.c b/compiler-rt/test/lsan/TestCases/ignore_object.c
index e5fc0128cac7..92f03ee33a05 100644
--- a/compiler-rt/test/lsan/TestCases/ignore_object.c
+++ b/compiler-rt/test/lsan/TestCases/ignore_object.c
@@ -3,9 +3,6 @@
 // RUN: %clang_lsan %s -o %t
 // RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
 
-// Investigate why it does not fail with use_stack=0
-// UNSUPPORTED: arm-linux || armhf-linux
-
 #include <stdio.h>
 #include <stdlib.h>
 

diff  --git a/compiler-rt/test/lsan/TestCases/use_after_return.cpp b/compiler-rt/test/lsan/TestCases/use_after_return.cpp
index decab6c69611..5c60ec60f3e0 100644
--- a/compiler-rt/test/lsan/TestCases/use_after_return.cpp
+++ b/compiler-rt/test/lsan/TestCases/use_after_return.cpp
@@ -6,9 +6,6 @@
 // RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
 // RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts="" %run %t 2>&1
 
-// Investigate why it does not fail with use_stack=0
-// UNSUPPORTED: arm-linux || armhf-linux
-
 #include <stdio.h>
 #include <stdlib.h>
 #include "sanitizer_common/print_address.h"

diff  --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt
index 7f1b0f257716..3af62a0c71ad 100644
--- a/compiler-rt/test/sanitizer_common/CMakeLists.txt
+++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt
@@ -76,6 +76,15 @@ foreach(tool ${SUPPORTED_TOOLS})
     set(SANITIZER_COMMON_TEST_TARGET_ARCH ${arch})
     get_test_cc_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CC SANITIZER_COMMON_TEST_TARGET_CFLAGS)
     set(CONFIG_NAME ${tool}-${arch}-${OS_NAME})
+
+    # ARM on Linux might use the slow unwinder as default and the unwind table is
+    # required to get a complete stacktrace.
+    if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT ANDROID)
+      list(APPEND SANITIZER_COMMON_TEST_TARGET_CFLAGS -funwind-tables)
+      string(REPLACE ";" " " SANITIZER_COMMON_TEST_TARGET_CFLAGS
+                             "${SANITIZER_COMMON_TEST_TARGET_CFLAGS}")
+    endif()
+
     configure_lit_site_cfg(
       ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
       ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)


        


More information about the llvm-commits mailing list