[PATCH] D39156: [libunwind] Make HIDDEN_DIRECTIVE a function-like macro. NFCI.

2017-10-22 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316300: Make HIDDEN_DIRECTIVE a function-like macro. NFCI. 
(authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D39156?vs=119740=119792#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39156

Files:
  libunwind/trunk/src/assembly.h


Index: libunwind/trunk/src/assembly.h
===
--- libunwind/trunk/src/assembly.h
+++ libunwind/trunk/src/assembly.h
@@ -24,27 +24,14 @@
 #define SEPARATOR ;
 #endif
 
-#if defined(__APPLE__)
-#define HIDDEN_DIRECTIVE .private_extern
-#elif defined(_WIN32)
-// In the COFF object file format, there's no attributes for a global,
-// non-static symbol to make it somehow hidden. So on windows, we don't
-// want to set this at all. To avoid conditionals in
-// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already
-// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the
-// duplicate .globl directives are harmless).
-#define HIDDEN_DIRECTIVE .globl
-#else
-#define HIDDEN_DIRECTIVE .hidden
-#endif
-
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
 #elif defined(__ELF__)
@@ -54,24 +41,30 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
 defined(__linux__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE
 #endif
 
-#else
+#elif defined(_WIN32)
 
 #define SYMBOL_IS_FUNC(name)   
\
   .def name SEPARATOR  
\
 .scl 2 SEPARATOR   
\
 .type 32 SEPARATOR 
\
   .endef
+#define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
 
+#else
+
+#error Unsupported target
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
@@ -81,7 +74,7 @@
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\
+  HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR  \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
   SYMBOL_NAME(name):
 


Index: libunwind/trunk/src/assembly.h
===
--- libunwind/trunk/src/assembly.h
+++ libunwind/trunk/src/assembly.h
@@ -24,27 +24,14 @@
 #define SEPARATOR ;
 #endif
 
-#if defined(__APPLE__)
-#define HIDDEN_DIRECTIVE .private_extern
-#elif defined(_WIN32)
-// In the COFF object file format, there's no attributes for a global,
-// non-static symbol to make it somehow hidden. So on windows, we don't
-// want to set this at all. To avoid conditionals in
-// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already
-// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the
-// duplicate .globl directives are harmless).
-#define HIDDEN_DIRECTIVE .globl
-#else
-#define HIDDEN_DIRECTIVE .hidden
-#endif
-
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
 #elif defined(__ELF__)
@@ -54,24 +41,30 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
 defined(__linux__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE
 #endif
 
-#else
+#elif defined(_WIN32)
 
 #define SYMBOL_IS_FUNC(name)   \
   .def name SEPARATOR  \
 .scl 2 SEPARATOR   \
 .type 32 SEPARATOR \
   .endef
+#define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
 
+#else
+
+#error Unsupported target
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
@@ -81,7 +74,7 @@
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\
+  HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR  \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
  

[PATCH] D39156: [libunwind] Make HIDDEN_DIRECTIVE a function-like macro. NFCI.

2017-10-21 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.

Thanks for cleaning this up.  IIRC, I have similar behavior in compiler-rt for 
`HIDDEN_SYMBOL`.


https://reviews.llvm.org/D39156



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39156: [libunwind] Make HIDDEN_DIRECTIVE a function-like macro. NFCI.

2017-10-21 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo created this revision.

This avoids a hack for making it a no-op for windows.

Also explicitly check for `_WIN32` instead of asduming it.


https://reviews.llvm.org/D39156

Files:
  src/assembly.h


Index: src/assembly.h
===
--- src/assembly.h
+++ src/assembly.h
@@ -24,27 +24,14 @@
 #define SEPARATOR ;
 #endif
 
-#if defined(__APPLE__)
-#define HIDDEN_DIRECTIVE .private_extern
-#elif defined(_WIN32)
-// In the COFF object file format, there's no attributes for a global,
-// non-static symbol to make it somehow hidden. So on windows, we don't
-// want to set this at all. To avoid conditionals in
-// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already
-// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the
-// duplicate .globl directives are harmless).
-#define HIDDEN_DIRECTIVE .globl
-#else
-#define HIDDEN_DIRECTIVE .hidden
-#endif
-
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
 #elif defined(__ELF__)
@@ -54,24 +41,30 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
 defined(__linux__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE
 #endif
 
-#else
+#elif defined(_WIN32)
 
 #define SYMBOL_IS_FUNC(name)   
\
   .def name SEPARATOR  
\
 .scl 2 SEPARATOR   
\
 .type 32 SEPARATOR 
\
   .endef
+#define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
 
+#else
+
+#error Unsupported target
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
@@ -81,7 +74,7 @@
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\
+  HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR  \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
   SYMBOL_NAME(name):
 


Index: src/assembly.h
===
--- src/assembly.h
+++ src/assembly.h
@@ -24,27 +24,14 @@
 #define SEPARATOR ;
 #endif
 
-#if defined(__APPLE__)
-#define HIDDEN_DIRECTIVE .private_extern
-#elif defined(_WIN32)
-// In the COFF object file format, there's no attributes for a global,
-// non-static symbol to make it somehow hidden. So on windows, we don't
-// want to set this at all. To avoid conditionals in
-// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already
-// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the
-// duplicate .globl directives are harmless).
-#define HIDDEN_DIRECTIVE .globl
-#else
-#define HIDDEN_DIRECTIVE .hidden
-#endif
-
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
 #elif defined(__ELF__)
@@ -54,24 +41,30 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
 defined(__linux__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE
 #endif
 
-#else
+#elif defined(_WIN32)
 
 #define SYMBOL_IS_FUNC(name)   \
   .def name SEPARATOR  \
 .scl 2 SEPARATOR   \
 .type 32 SEPARATOR \
   .endef
+#define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
 
+#else
+
+#error Unsupported target
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
@@ -81,7 +74,7 @@
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\
+  HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR  \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
   SYMBOL_NAME(name):
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits