summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-12-19 18:54:13 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-12-19 18:54:13 +0000
commit9b3d3c59de6ff36fe9bc4d7cb03a19ce75ec6147 (patch)
tree13695cc9dbaf751614531ea0abd45fee785c7656
parent60172983779be9fd4a857327555a83dcb6c1ce85 (diff)
downloadcompiler-rt-9b3d3c59de6ff36fe9bc4d7cb03a19ce75ec6147.tar.gz
builtins: rely on the compiler for user label prefix
clang does not like the definition of builtins. In order to work around this, we use a SUN CC to redefine the generated name. However, this requires that we account for the user label prefix. Rather than hard coding that into the file, rely on the compiler to tell us the information and use the preprocessor to generate the name as we do in the assembly routines. NFC. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224597 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/builtins/atomic.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/builtins/atomic.c b/lib/builtins/atomic.c
index 02429a653..35c8837dc 100644
--- a/lib/builtins/atomic.c
+++ b/lib/builtins/atomic.c
@@ -28,20 +28,14 @@
#include <stdint.h>
#include <string.h>
+#include "assembly.h"
+
// Clang objects if you redefine a builtin. This little hack allows us to
// define a function with the same name as an intrinsic.
-#if __APPLE__
-// mach-o has extra leading underscore
-#pragma redefine_extname __atomic_load_c ___atomic_load
-#pragma redefine_extname __atomic_store_c ___atomic_store
-#pragma redefine_extname __atomic_exchange_c ___atomic_exchange
-#pragma redefine_extname __atomic_compare_exchange_c ___atomic_compare_exchange
-#else
-#pragma redefine_extname __atomic_load_c __atomic_load
-#pragma redefine_extname __atomic_store_c __atomic_store
-#pragma redefine_extname __atomic_exchange_c __atomic_exchange
-#pragma redefine_extname __atomic_compare_exchange_c __atomic_compare_exchange
-#endif
+#pragma redefine_extname __atomic_load_c SYMBOL_NAME(__atomic_load)
+#pragma redefine_extname __atomic_store_c SYMBOL_NAME(__atomic_store)
+#pragma redefine_extname __atomic_exchange_c SYMBOL_NAME(__atomic_exchange)
+#pragma redefine_extname __atomic_compare_exchange_c SYMBOL_NAME(__atomic_compare_exchange)
/// Number of locks. This allocates one page on 32-bit platforms, two on
/// 64-bit. This can be specified externally if a different trade between