summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_asm.h
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2015-11-28 12:44:23 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2015-11-28 12:44:23 +0000
commitac79368a80c39af6f26d96d46d391b85f4bd201b (patch)
tree1bf89784307164b1c5c8e1510f22dbf522dfdf9d /lib/sanitizer_common/sanitizer_asm.h
parent29992b5ee630cce41306d98729d4f2d8e68c261c (diff)
[tsan] Port tsan_rtl_amd64.S to OS X to add support for setjmp/longjmp
This patch ports the assembly file tsan_rtl_amd64.S to OS X, where we need several changes: * Some assembler directives are not available on OS X (.hidden, .type, .size) * Symbol names need to start with an underscore (added a ASM_TSAN_SYMBOL macro for that). * To make the interceptors work, we ween to name the function "_wrap_setjmp" (added ASM_TSAN_SYMBOL_INTERCEPTOR for that). * Calling the original setjmp is done with a simple "jmp _setjmp". * __sigsetjmp doesn't exist on OS X. Differential Revision: http://reviews.llvm.org/D14947 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_asm.h')
-rw-r--r--lib/sanitizer_common/sanitizer_asm.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_asm.h b/lib/sanitizer_common/sanitizer_asm.h
index 731f1a539..47c2b12a2 100644
--- a/lib/sanitizer_common/sanitizer_asm.h
+++ b/lib/sanitizer_common/sanitizer_asm.h
@@ -43,4 +43,16 @@
# define CFI_RESTORE(reg)
#endif
-
+#if !defined(__APPLE__)
+# 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
+#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
+#endif