[compiler-rt] r224597 - builtins: rely on the compiler for user label prefix

Saleem Abdulrasool compnerd at compnerd.org
Fri Dec 19 10:54:14 PST 2014


Author: compnerd
Date: Fri Dec 19 12:54:13 2014
New Revision: 224597

URL: http://llvm.org/viewvc/llvm-project?rev=224597&view=rev
Log:
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.

Modified:
    compiler-rt/trunk/lib/builtins/atomic.c

Modified: compiler-rt/trunk/lib/builtins/atomic.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/atomic.c?rev=224597&r1=224596&r2=224597&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/atomic.c (original)
+++ compiler-rt/trunk/lib/builtins/atomic.c Fri Dec 19 12:54:13 2014
@@ -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





More information about the llvm-commits mailing list