[compiler-rt] eeaabe6 - [xray] Use hidden symbol visibility for xray trampolines

Ian Levesque via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 20:20:16 PDT 2020


Author: Ian Levesque
Date: 2020-04-21T23:19:52-04:00
New Revision: eeaabe64e3079d2847c0b94e398b5203ad2ab839

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

LOG: [xray] Use hidden symbol visibility for xray trampolines

Summary: We load multiple copies of the trampolines into memory when instrumenting DSOs.  Hidden visibility prevents conflicts in this scenario.

Reviewers: MaskRay, dberris, johnislarry

Subscribers: #sanitizers

Tags: #sanitizers

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

Added: 
    

Modified: 
    compiler-rt/lib/xray/xray_trampoline_AArch64.S
    compiler-rt/lib/xray/xray_trampoline_arm.S
    compiler-rt/lib/xray/xray_trampoline_x86_64.S

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/xray/xray_trampoline_AArch64.S b/compiler-rt/lib/xray/xray_trampoline_AArch64.S
index 4d1b04fb7d90..8f8ab35ce2fb 100644
--- a/compiler-rt/lib/xray/xray_trampoline_AArch64.S
+++ b/compiler-rt/lib/xray/xray_trampoline_AArch64.S
@@ -7,6 +7,7 @@
     .p2align 2
     /* Let C/C++ see the symbol */
     .global __xray_FunctionEntry
+    .hidden __xray_FunctionEntry
     .type __xray_FunctionEntry, %function
     /* In C++ it is void extern "C" __xray_FunctionEntry(uint32_t FuncId) with
          FuncId passed in W0 register. */
@@ -54,6 +55,7 @@ FunctionEntry_restore:
     .p2align 2
     /* Let C/C++ see the symbol */
     .global __xray_FunctionExit
+    .hidden __xray_FunctionExit
     .type __xray_FunctionExit, %function
     /* In C++ it is void extern "C" __xray_FunctionExit(uint32_t FuncId) with
          FuncId passed in W0 register. */
@@ -94,6 +96,7 @@ FunctionExit_restore:
     .p2align 2
     /* Let C/C++ see the symbol */
     .global __xray_FunctionTailExit
+    .hidden __xray_FunctionTailExit
     .type __xray_FunctionTailExit, %function
     /* In C++ it is void extern "C" __xray_FunctionTailExit(uint32_t FuncId)
          with FuncId passed in W0 register. */

diff  --git a/compiler-rt/lib/xray/xray_trampoline_arm.S b/compiler-rt/lib/xray/xray_trampoline_arm.S
index 71dbee65d825..528bc6c72fdd 100644
--- a/compiler-rt/lib/xray/xray_trampoline_arm.S
+++ b/compiler-rt/lib/xray/xray_trampoline_arm.S
@@ -10,6 +10,7 @@
     .p2align 2
     @ Let C/C++ see the symbol
     .global __xray_FunctionEntry
+    .hidden __xray_FunctionEntry
     @ It preserves all registers except r0, r12(ip), r14(lr) and r15(pc)
     @ Assume that "q" part of the floating-point registers is not used
     @   for passing parameters to C/C++ functions.
@@ -40,6 +41,7 @@ FunctionEntry_restore:
     .p2align 2
     @ Let C/C++ see the symbol
 	.global __xray_FunctionExit
+	.hidden __xray_FunctionExit
 	@ Assume that d1-d7 are not used for the return value.
     @ Assume that "q" part of the floating-point registers is not used for the
     @   return value in C/C++.
@@ -71,6 +73,7 @@ FunctionExit_restore:
     .p2align 2
     @ Let C/C++ see the symbol
     .global __xray_FunctionTailExit
+    .hidden __xray_FunctionTailExit
     @ It preserves all registers except r0, r12(ip), r14(lr) and r15(pc)
     @ Assume that "q" part of the floating-point registers is not used
     @   for passing parameters to C/C++ functions.

diff  --git a/compiler-rt/lib/xray/xray_trampoline_x86_64.S b/compiler-rt/lib/xray/xray_trampoline_x86_64.S
index 1e58362cdc80..12c5a6ccd9a4 100644
--- a/compiler-rt/lib/xray/xray_trampoline_x86_64.S
+++ b/compiler-rt/lib/xray/xray_trampoline_x86_64.S
@@ -98,6 +98,7 @@
 //===----------------------------------------------------------------------===//
 
 	.globl ASM_SYMBOL(__xray_FunctionEntry)
+	ASM_HIDDEN(__xray_FunctionEntry)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_FunctionEntry)
 # LLVM-MCA-BEGIN __xray_FunctionEntry
@@ -126,6 +127,7 @@ ASM_SYMBOL(__xray_FunctionEntry):
 //===----------------------------------------------------------------------===//
 
 	.globl ASM_SYMBOL(__xray_FunctionExit)
+	ASM_HIDDEN(__xray_FunctionExit)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_FunctionExit)
 # LLVM-MCA-BEGIN __xray_FunctionExit
@@ -166,6 +168,7 @@ ASM_SYMBOL(__xray_FunctionExit):
 //===----------------------------------------------------------------------===//
 
 	.globl ASM_SYMBOL(__xray_FunctionTailExit)
+	ASM_HIDDEN(__xray_FunctionTailExit)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_FunctionTailExit)
 # LLVM-MCA-BEGIN __xray_FunctionTailExit
@@ -192,6 +195,7 @@ ASM_SYMBOL(__xray_FunctionTailExit):
 //===----------------------------------------------------------------------===//
 
 	.globl ASM_SYMBOL(__xray_ArgLoggerEntry)
+	ASM_HIDDEN(__xray_ArgLoggerEntry)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_ArgLoggerEntry)
 # LLVM-MCA-BEGIN __xray_ArgLoggerEntry
@@ -231,6 +235,7 @@ ASM_SYMBOL(__xray_ArgLoggerEntry):
 //===----------------------------------------------------------------------===//
 
 	.global ASM_SYMBOL(__xray_CustomEvent)
+	ASM_HIDDEN(__xray_CustomEvent)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_CustomEvent)
 # LLVM-MCA-BEGIN __xray_CustomEvent
@@ -256,6 +261,7 @@ ASM_SYMBOL(__xray_CustomEvent):
 //===----------------------------------------------------------------------===//
 
 	.global ASM_SYMBOL(__xray_TypedEvent)
+	ASM_HIDDEN(__xray_TypedEvent)
 	.align 16, 0x90
 	ASM_TYPE_FUNCTION(__xray_TypedEvent)
 # LLVM-MCA-BEGIN __xray_TypedEvent


        


More information about the llvm-commits mailing list