[PATCH] D19001: [ppc64] Disable sibling-call-optimization when building tsan library by clang

Chuang-Yu Cheng via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 18:53:10 PDT 2016


cycheng created this revision.
cycheng added reviewers: samsonov, hfinkel, kbarton, tjablin.
cycheng added a subscriber: llvm-commits.

Use "-mllvm -disable-ppc-sco=true" for clang when building tsan library, because there is a distance (in terms of instruction count) assumption between StackTrace::GetCurrentPc and BufferedStackTrace::Unwind.

Tail-call to "PrintCurrentStackSlow" break this assumption on PPC64.

See: https://llvm.org/bugs/show_bug.cgi?id=27280#c1

http://reviews.llvm.org/D19001

Files:
  lib/tsan/CMakeLists.txt

Index: lib/tsan/CMakeLists.txt
===================================================================
--- lib/tsan/CMakeLists.txt
+++ lib/tsan/CMakeLists.txt
@@ -154,6 +154,14 @@
         LANGUAGE C)
    elseif(arch MATCHES "powerpc64|powerpc64le")
      set(TSAN_ASM_SOURCES rtl/tsan_rtl_ppc64.S)
+     # On PPC64, when using clang with sibling-call-optimization to build
+     # tsan library, sibling-call (tail-call) to PrintCurrentStackSlow breaks
+     # distance assumption between StackTrace::GetCurrentPc() and
+     # BufferedStackTrace::Unwind(), so we turn off sco to work around it.
+     # See https://llvm.org/bugs/show_bug.cgi?id=27280#c1
+     if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+       set(TSAN_RTL_CFLAGS ${TSAN_RTL_CFLAGS} -mllvm -disable-ppc-sco=true)
+     endif ()
      # Pass ASM file directly to the C++ compiler.
      set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
        LANGUAGE C)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19001.53347.patch
Type: text/x-patch
Size: 934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/aa9099eb/attachment.bin>


More information about the llvm-commits mailing list