[compiler-rt] r319339 - [sanitizer] Refactor how assembly files are handled

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 11:27:25 PST 2017


Author: kuba.brecka
Date: Wed Nov 29 11:27:25 2017
New Revision: 319339

URL: http://llvm.org/viewvc/llvm-project?rev=319339&view=rev
Log:
[sanitizer] Refactor how assembly files are handled

This renames ASM_TSAN_SYMBOL and ASM_TSAN_SYMBOL_INTERCEPTOR to just ASM_SYMBOL and ASM_SYMBOL_INTERCEPTOR, because they can be useful in more places than just TSan. Also introduce a CMake function to add ASM sources to a target.

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


Modified:
    compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h
    compiler-rt/trunk/lib/tsan/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S
    compiler-rt/trunk/lib/xray/CMakeLists.txt
    compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S

Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=319339&r1=319338&r2=319339&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Wed Nov 29 11:27:25 2017
@@ -93,6 +93,17 @@ function(add_compiler_rt_component name)
   add_dependencies(compiler-rt ${name})
 endfunction()
 
+function(add_asm_sources output)
+  set(${output} ${ARGN} PARENT_SCOPE)
+  # Xcode will try to compile asm files as C ('clang -x c'), and that will fail.
+  if (${CMAKE_GENERATOR} STREQUAL "Xcode")
+    enable_language(ASM)
+  else()
+    # Pass ASM file directly to the C++ compiler.
+    set_source_files_properties(${ARGN} PROPERTIES LANGUAGE C)
+  endif()
+endfunction()
+
 macro(set_output_name output name arch)
   if(ANDROID AND ${arch} STREQUAL "i386")
     set(${output} "${name}-i686${COMPILER_RT_OS_SUFFIX}")

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h?rev=319339&r1=319338&r2=319339&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h Wed Nov 29 11:27:25 2017
@@ -47,12 +47,12 @@
 # define ASM_HIDDEN(symbol) .hidden symbol
 # define ASM_TYPE_FUNCTION(symbol) .type symbol, @function
 # define ASM_SIZE(symbol) .size symbol, .-symbol
-# define ASM_TSAN_SYMBOL(symbol) symbol
-# define ASM_TSAN_SYMBOL_INTERCEPTOR(symbol) symbol
+# define ASM_SYMBOL(symbol) symbol
+# define ASM_SYMBOL_INTERCEPTOR(symbol) symbol
 #else
 # define ASM_HIDDEN(symbol)
 # define ASM_TYPE_FUNCTION(symbol)
 # define ASM_SIZE(symbol)
-# define ASM_TSAN_SYMBOL(symbol) _##symbol
-# define ASM_TSAN_SYMBOL_INTERCEPTOR(symbol) _wrap_##symbol
+# define ASM_SYMBOL(symbol) _##symbol
+# define ASM_SYMBOL_INTERCEPTOR(symbol) _wrap_##symbol
 #endif

Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=319339&r1=319338&r2=319339&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Wed Nov 29 11:27:25 2017
@@ -100,14 +100,7 @@ set(TSAN_RUNTIME_LIBRARIES)
 add_compiler_rt_component(tsan)
 
 if(APPLE)
-  set(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S rtl/tsan_rtl_aarch64.S)
-  # Xcode will try to compile this file as C ('clang -x c'), and that will fail.
-  if (${CMAKE_GENERATOR} STREQUAL "Xcode")
-    enable_language(ASM)
-  else()
-    # Pass ASM file directly to the C++ compiler.
-    set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES LANGUAGE C)
-  endif()
+  add_asm_sources(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S rtl/tsan_rtl_aarch64.S)
 
   set(TSAN_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
 
@@ -145,10 +138,7 @@ if(APPLE)
 else()
   foreach(arch ${TSAN_SUPPORTED_ARCH})
     if(arch STREQUAL "x86_64")
-      set(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S)
-      # Pass ASM file directly to the C++ compiler.
-      set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
-        LANGUAGE C)
+      add_asm_sources(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S)
       # Sanity check for Go runtime.
       set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
       add_custom_target(GotsanRuntimeCheck
@@ -159,20 +149,11 @@ else()
         COMMENT "Checking TSan Go runtime..."
         VERBATIM)
     elseif(arch STREQUAL "aarch64")
-      set(TSAN_ASM_SOURCES rtl/tsan_rtl_aarch64.S)
-      # Pass ASM file directly to the C++ compiler.
-      set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
-        LANGUAGE C)
-   elseif(arch MATCHES "powerpc64|powerpc64le")
-     set(TSAN_ASM_SOURCES rtl/tsan_rtl_ppc64.S)
-     # Pass ASM file directly to the C++ compiler.
-     set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
-       LANGUAGE C)
+      add_asm_sources(TSAN_ASM_SOURCES rtl/tsan_rtl_aarch64.S)
+    elseif(arch MATCHES "powerpc64|powerpc64le")
+      add_asm_sources(TSAN_ASM_SOURCES rtl/tsan_rtl_ppc64.S)
     elseif(arch MATCHES "mips64|mips64le")
-     set(TSAN_ASM_SOURCES rtl/tsan_rtl_mips64.S)
-     # Pass ASM file directly to the C++ compiler.
-     set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
-       LANGUAGE C)
+      add_asm_sources(TSAN_ASM_SOURCES rtl/tsan_rtl_mips64.S)
     else()
       set(TSAN_ASM_SOURCES)
     endif()

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S?rev=319339&r1=319338&r2=319339&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S Wed Nov 29 11:27:25 2017
@@ -6,7 +6,7 @@
 #if !defined(__APPLE__)
 .section .bss
 .type	__tsan_pointer_chk_guard, %object
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(__tsan_pointer_chk_guard))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__tsan_pointer_chk_guard))
 __tsan_pointer_chk_guard:
 .zero	8
 #endif
@@ -51,7 +51,7 @@ _sigsetjmp$non_lazy_ptr:
 // original ones.
 ASM_HIDDEN(_Z18InitializeGuardPtrv)
 .global _Z18InitializeGuardPtrv
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(_Z18InitializeGuardPtrv))
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_Z18InitializeGuardPtrv))
 _Z18InitializeGuardPtrv:
   CFI_STARTPROC
   // Allocates a jmp_buf for the setjmp call.
@@ -88,14 +88,14 @@ _Z18InitializeGuardPtrv:
   CFI_DEF_CFA (31, 0)
   ret
   CFI_ENDPROC
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(_Z18InitializeGuardPtrv))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_Z18InitializeGuardPtrv))
 #endif
 
 ASM_HIDDEN(__tsan_setjmp)
 .comm _ZN14__interception11real_setjmpE,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(setjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp))
+ASM_SYMBOL_INTERCEPTOR(setjmp):
   CFI_STARTPROC
 
   // save env parameters for function call
@@ -125,7 +125,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
 #endif
 
   // call tsan interceptor
-  bl      ASM_TSAN_SYMBOL(__tsan_setjmp)
+  bl      ASM_SYMBOL(__tsan_setjmp)
 
   // restore env parameter
   mov     x0, x19
@@ -148,12 +148,12 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
   br      x1
 
   CFI_ENDPROC
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp))
 
 .comm _ZN14__interception12real__setjmpE,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(_setjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp))
+ASM_SYMBOL_INTERCEPTOR(_setjmp):
   CFI_STARTPROC
 
   // save env parameters for function call
@@ -183,7 +183,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
 #endif
 
   // call tsan interceptor
-  bl      ASM_TSAN_SYMBOL(__tsan_setjmp)
+  bl      ASM_SYMBOL(__tsan_setjmp)
 
   // Restore jmp_buf parameter
   mov     x0, x19
@@ -206,12 +206,12 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
   br      x1
 
   CFI_ENDPROC
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp))
 
 .comm _ZN14__interception14real_sigsetjmpE,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(sigsetjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
+ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
   CFI_STARTPROC
 
   // save env parameters for function call
@@ -243,7 +243,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
 #endif
 
   // call tsan interceptor
-  bl      ASM_TSAN_SYMBOL(__tsan_setjmp)
+  bl      ASM_SYMBOL(__tsan_setjmp)
 
   // restore env parameter
   mov     w1, w20
@@ -268,13 +268,13 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
 #endif
   br      x2
   CFI_ENDPROC
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
 
 #if !defined(__APPLE__)
 .comm _ZN14__interception16real___sigsetjmpE,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
+ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
   CFI_STARTPROC
 
   // save env parameters for function call
@@ -303,7 +303,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
 #endif
 
   // call tsan interceptor
-  bl      ASM_TSAN_SYMBOL(__tsan_setjmp)
+  bl      ASM_SYMBOL(__tsan_setjmp)
 
   mov     w1, w20
   mov     x0, x19
@@ -321,12 +321,12 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
   ldr     x2, [x2, #:got_lo12:_ZN14__interception16real___sigsetjmpE]
   ldr     x2, [x2]
 #else
-  adrp    x2, ASM_TSAN_SYMBOL(__sigsetjmp)@page
-  add     x2, x2, ASM_TSAN_SYMBOL(__sigsetjmp)@pageoff
+  adrp    x2, ASM_SYMBOL(__sigsetjmp)@page
+  add     x2, x2, ASM_SYMBOL(__sigsetjmp)@pageoff
 #endif
   br      x2
   CFI_ENDPROC
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
 #endif
 
 #if defined(__linux__)

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S?rev=319339&r1=319338&r2=319339&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S Wed Nov 29 11:27:25 2017
@@ -10,8 +10,8 @@
 #endif
 
 ASM_HIDDEN(__tsan_trace_switch)
-.globl ASM_TSAN_SYMBOL(__tsan_trace_switch_thunk)
-ASM_TSAN_SYMBOL(__tsan_trace_switch_thunk):
+.globl ASM_SYMBOL(__tsan_trace_switch_thunk)
+ASM_SYMBOL(__tsan_trace_switch_thunk):
   CFI_STARTPROC
   # Save scratch registers.
   push %rax
@@ -50,7 +50,7 @@ ASM_TSAN_SYMBOL(__tsan_trace_switch_thun
   shr $4, %rsp  # clear 4 lsb, align to 16
   shl $4, %rsp
 
-  call ASM_TSAN_SYMBOL(__tsan_trace_switch)
+  call ASM_SYMBOL(__tsan_trace_switch)
 
   # Unalign stack frame back.
   mov %rbx, %rsp  # restore the original rsp
@@ -90,8 +90,8 @@ ASM_TSAN_SYMBOL(__tsan_trace_switch_thun
   CFI_ENDPROC
 
 ASM_HIDDEN(__tsan_report_race)
-.globl ASM_TSAN_SYMBOL(__tsan_report_race_thunk)
-ASM_TSAN_SYMBOL(__tsan_report_race_thunk):
+.globl ASM_SYMBOL(__tsan_report_race_thunk)
+ASM_SYMBOL(__tsan_report_race_thunk):
   CFI_STARTPROC
   # Save scratch registers.
   push %rax
@@ -130,7 +130,7 @@ ASM_TSAN_SYMBOL(__tsan_report_race_thunk
   shr $4, %rsp  # clear 4 lsb, align to 16
   shl $4, %rsp
 
-  call ASM_TSAN_SYMBOL(__tsan_report_race)
+  call ASM_SYMBOL(__tsan_report_race)
 
   # Unalign stack frame back.
   mov %rbx, %rsp  # restore the original rsp
@@ -176,13 +176,13 @@ ASM_HIDDEN(__tsan_setjmp)
 .comm _ZN14__interception11real_setjmpE,8,8
 #endif
 #if defined(__NetBSD__)
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(__setjmp14)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(__setjmp14))
-ASM_TSAN_SYMBOL_INTERCEPTOR(__setjmp14):
-#else
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(__setjmp14)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__setjmp14))
+ASM_SYMBOL_INTERCEPTOR(__setjmp14):
+#else
+.globl ASM_SYMBOL_INTERCEPTOR(setjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp))
+ASM_SYMBOL_INTERCEPTOR(setjmp):
 #endif
   CFI_STARTPROC
   // save env parameter
@@ -205,7 +205,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
 # error "Unknown platform"
 #endif
   // call tsan interceptor
-  call ASM_TSAN_SYMBOL(__tsan_setjmp)
+  call ASM_SYMBOL(__tsan_setjmp)
   // restore env parameter
   pop %rdi
   CFI_ADJUST_CFA_OFFSET(-8)
@@ -219,19 +219,19 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp):
   movq _ZN14__interception11real_setjmpE at GOTPCREL(%rip), %rdx
   jmp *(%rdx)
 #else
-  jmp ASM_TSAN_SYMBOL(setjmp)
+  jmp ASM_SYMBOL(setjmp)
 #endif
   CFI_ENDPROC
 #if defined(__NetBSD__)
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(__setjmp14))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__setjmp14))
 #else
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(setjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp))
 #endif
 
 .comm _ZN14__interception12real__setjmpE,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(_setjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp))
+ASM_SYMBOL_INTERCEPTOR(_setjmp):
   CFI_STARTPROC
   // save env parameter
   push %rdi
@@ -253,7 +253,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
 # error "Unknown platform"
 #endif
   // call tsan interceptor
-  call ASM_TSAN_SYMBOL(__tsan_setjmp)
+  call ASM_SYMBOL(__tsan_setjmp)
   // restore env parameter
   pop %rdi
   CFI_ADJUST_CFA_OFFSET(-8)
@@ -264,21 +264,21 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp):
   movq _ZN14__interception12real__setjmpE at GOTPCREL(%rip), %rdx
   jmp *(%rdx)
 #else
-  jmp ASM_TSAN_SYMBOL(_setjmp)
+  jmp ASM_SYMBOL(_setjmp)
 #endif
   CFI_ENDPROC
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(_setjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp))
 
 #if defined(__NetBSD__)
 .comm _ZN14__interception18real___sigsetjmp14E,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp14)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp14))
-ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp14):
+.globl ASM_SYMBOL_INTERCEPTOR(__sigsetjmp14)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp14))
+ASM_SYMBOL_INTERCEPTOR(__sigsetjmp14):
 #else
 .comm _ZN14__interception14real_sigsetjmpE,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(sigsetjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
+ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
 #endif
   CFI_STARTPROC
   // save env parameter
@@ -308,7 +308,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
 # error "Unknown platform"
 #endif
   // call tsan interceptor
-  call ASM_TSAN_SYMBOL(__tsan_setjmp)
+  call ASM_SYMBOL(__tsan_setjmp)
   // unalign stack frame
   add $8, %rsp
   CFI_ADJUST_CFA_OFFSET(-8)
@@ -329,20 +329,20 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp):
   movq _ZN14__interception14real_sigsetjmpE at GOTPCREL(%rip), %rdx
   jmp *(%rdx)
 #else
-  jmp ASM_TSAN_SYMBOL(sigsetjmp)
+  jmp ASM_SYMBOL(sigsetjmp)
 #endif
   CFI_ENDPROC
 #if defined(__NetBSD__)
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp14))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp14))
 #else
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
 #endif
 
 #if !defined(__APPLE__) && !defined(__NetBSD__)
 .comm _ZN14__interception16real___sigsetjmpE,8,8
-.globl ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
-ASM_TYPE_FUNCTION(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp))
-ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp):
+.globl ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)
+ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
+ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
   CFI_STARTPROC
   // save env parameter
   push %rdi
@@ -366,7 +366,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
   rol $0x11, %rsi
 #endif
   // call tsan interceptor
-  call ASM_TSAN_SYMBOL(__tsan_setjmp)
+  call ASM_SYMBOL(__tsan_setjmp)
   // unalign stack frame
   add $8, %rsp
   CFI_ADJUST_CFA_OFFSET(-8)
@@ -383,7 +383,7 @@ ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp)
   movq _ZN14__interception16real___sigsetjmpE at GOTPCREL(%rip), %rdx
   jmp *(%rdx)
   CFI_ENDPROC
-ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(__sigsetjmp))
+ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
 #endif  // !defined(__APPLE__) && !defined(__NetBSD__)
 
 #if defined(__FreeBSD__) || defined(__linux__)

Modified: compiler-rt/trunk/lib/xray/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/CMakeLists.txt?rev=319339&r1=319338&r2=319339&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/CMakeLists.txt Wed Nov 29 11:27:25 2017
@@ -66,13 +66,7 @@ set(XRAY_COMMON_RUNTIME_OBJECT_LIBS
 
 if (APPLE)
   set(XRAY_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})
-  set(XRAY_ASM_SOURCES xray_trampoline_x86_64.S)
-
-  if (${CMAKE_GENERATOR} STREQUAL "Xcode")
-    enable_language(ASM)
-  else()
-    set_source_files_properties(${XRAY_ASM_SOURCES} PROPERTIES LANGUAGE C)
-  endif()
+  add_asm_sources(XRAY_ASM_SOURCES xray_trampoline_x86_64.S)
 
   add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
   add_weak_symbols("xray" WEAK_SYMBOL_LINK_FLAGS)

Modified: compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S?rev=319339&r1=319338&r2=319339&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S (original)
+++ compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S Wed Nov 29 11:27:25 2017
@@ -87,16 +87,16 @@
 
 //===----------------------------------------------------------------------===//
 
-	.globl ASM_TSAN_SYMBOL(__xray_FunctionEntry)
+	.globl ASM_SYMBOL(__xray_FunctionEntry)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_FunctionEntry)
-ASM_TSAN_SYMBOL(__xray_FunctionEntry):
+ASM_SYMBOL(__xray_FunctionEntry):
 	CFI_STARTPROC
 	SAVE_REGISTERS
 
 	// This load has to be atomic, it's concurrent with __xray_patch().
 	// On x86/amd64, a simple (type-aligned) MOV instruction is enough.
-	movq	ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
+	movq	ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
 	testq	%rax, %rax
 	je	.Ltmp0
 
@@ -113,10 +113,10 @@ ASM_TSAN_SYMBOL(__xray_FunctionEntry):
 
 //===----------------------------------------------------------------------===//
 
-	.globl ASM_TSAN_SYMBOL(__xray_FunctionExit)
+	.globl ASM_SYMBOL(__xray_FunctionExit)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_FunctionExit)
-ASM_TSAN_SYMBOL(__xray_FunctionExit):
+ASM_SYMBOL(__xray_FunctionExit):
 	CFI_STARTPROC
 	// Save the important registers first. Since we're assuming that this
 	// function is only jumped into, we only preserve the registers for
@@ -128,7 +128,7 @@ ASM_TSAN_SYMBOL(__xray_FunctionExit):
 	movupd	%xmm1, 16(%rsp)
 	movq	%rax, 8(%rsp)
 	movq	%rdx, 0(%rsp)
-	movq	ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
+	movq	ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
 	testq %rax,%rax
 	je	.Ltmp2
 
@@ -151,14 +151,14 @@ ASM_TSAN_SYMBOL(__xray_FunctionExit):
 
 //===----------------------------------------------------------------------===//
 
-	.globl ASM_TSAN_SYMBOL(__xray_FunctionTailExit)
+	.globl ASM_SYMBOL(__xray_FunctionTailExit)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_FunctionTailExit)
-ASM_TSAN_SYMBOL(__xray_FunctionTailExit):
+ASM_SYMBOL(__xray_FunctionTailExit):
 	CFI_STARTPROC
 	SAVE_REGISTERS
 
-	movq	ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
+	movq	ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
 	testq %rax,%rax
 	je	.Ltmp4
 
@@ -175,20 +175,20 @@ ASM_TSAN_SYMBOL(__xray_FunctionTailExit)
 
 //===----------------------------------------------------------------------===//
 
-	.globl ASM_TSAN_SYMBOL(__xray_ArgLoggerEntry)
+	.globl ASM_SYMBOL(__xray_ArgLoggerEntry)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_ArgLoggerEntry)
-ASM_TSAN_SYMBOL(__xray_ArgLoggerEntry):
+ASM_SYMBOL(__xray_ArgLoggerEntry):
 	CFI_STARTPROC
 	SAVE_REGISTERS
 
 	// Again, these function pointer loads must be atomic; MOV is fine.
-	movq	ASM_TSAN_SYMBOL(_ZN6__xray13XRayArgLoggerE)(%rip), %rax
+	movq	ASM_SYMBOL(_ZN6__xray13XRayArgLoggerE)(%rip), %rax
 	testq	%rax, %rax
 	jne	.Larg1entryLog
 
 	// If [arg1 logging handler] not set, defer to no-arg logging.
-	movq	ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
+	movq	ASM_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax
 	testq	%rax, %rax
 	je	.Larg1entryFail
 
@@ -212,17 +212,17 @@ ASM_TSAN_SYMBOL(__xray_ArgLoggerEntry):
 
 //===----------------------------------------------------------------------===//
 
-	.global ASM_TSAN_SYMBOL(__xray_CustomEvent)
+	.global ASM_SYMBOL(__xray_CustomEvent)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_CustomEvent)
-ASM_TSAN_SYMBOL(__xray_CustomEvent):
+ASM_SYMBOL(__xray_CustomEvent):
 	CFI_STARTPROC
 	SAVE_REGISTERS
 
 	// We take two arguments to this trampoline, which should be in rdi	and rsi
 	// already. We also make sure that we stash %rax because we use that register
 	// to call the logging handler.
-	movq ASM_TSAN_SYMBOL(_ZN6__xray22XRayPatchedCustomEventE)(%rip), %rax
+	movq ASM_SYMBOL(_ZN6__xray22XRayPatchedCustomEventE)(%rip), %rax
 	testq %rax,%rax
 	je .LcustomEventCleanup
 




More information about the llvm-commits mailing list