[llvm-commits] [compiler-rt] r129818 - /compiler-rt/trunk/lib/assembly.h

Anton Korobeynikov asl at math.spbu.ru
Tue Apr 19 14:22:14 PDT 2011


Author: asl
Date: Tue Apr 19 16:22:14 2011
New Revision: 129818

URL: http://llvm.org/viewvc/llvm-project?rev=129818&view=rev
Log:
Add some macro magic: user __USER_LABEL_PREFIX__ instead of hardcoding it for each platform

Modified:
    compiler-rt/trunk/lib/assembly.h

Modified: compiler-rt/trunk/lib/assembly.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/assembly.h?rev=129818&r1=129817&r2=129818&view=diff
==============================================================================
--- compiler-rt/trunk/lib/assembly.h (original)
+++ compiler-rt/trunk/lib/assembly.h Tue Apr 19 16:22:14 2011
@@ -22,18 +22,18 @@
 #define SEPARATOR ;
 #endif
 
-/* We can't use __USER_LABEL_PREFIX__ here, it isn't possible to concatenate the
-   *values* of two macros. This is quite brittle, though. */
 #if defined(__APPLE__)
-#define SYMBOL_NAME(name) _##name
 #define HIDDEN_DIRECTIVE .private_extern
 #define LOCAL_LABEL(name) L_##name
 #else
-#define SYMBOL_NAME(name) name
 #define HIDDEN_DIRECTIVE .hidden
 #define LOCAL_LABEL(name) .L_##name
 #endif
 
+#define GLUE2(a, b) a ## b
+#define GLUE(a, b) GLUE2(a, b)
+#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
+
 #ifdef VISIBILITY_HIDDEN
 #define DEFINE_COMPILERRT_FUNCTION(name)                   \
   .globl SYMBOL_NAME(name) SEPARATOR                       \





More information about the llvm-commits mailing list