Add some macro magic: user __USER_LABEL_PREFIX__ instead of hardcoding it for each platform


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@129818 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/assembly.h b/lib/assembly.h
index 245f96d..0ce83ac 100644
--- a/lib/assembly.h
+++ b/lib/assembly.h
@@ -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                       \