[PATCH] D51508: Export public functions implemented in assembly on Windows.

2018-08-31 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341232: Export public functions implemented in assembly on 
Windows. (authored by cdavis, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D51508

Files:
  libunwind/trunk/src/assembly.h


Index: libunwind/trunk/src/assembly.h
===
--- libunwind/trunk/src/assembly.h
+++ libunwind/trunk/src/assembly.h
@@ -44,6 +44,7 @@
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
@@ -54,6 +55,7 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
@@ -70,6 +72,11 @@
 .scl 2 SEPARATOR   
\
 .type 32 SEPARATOR 
\
   .endef
+#define EXPORT_SYMBOL2(name)  \
+  .section .drectve,"yn" SEPARATOR\
+  .ascii "-export:", #name, "\0" SEPARATOR\
+  .text
+#define EXPORT_SYMBOL(name) EXPORT_SYMBOL2(name)
 #define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
@@ -82,6 +89,7 @@
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
+  EXPORT_SYMBOL(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
@@ -44,6 +44,7 @@
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
@@ -54,6 +55,7 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
@@ -70,6 +72,11 @@
 .scl 2 SEPARATOR   \
 .type 32 SEPARATOR \
   .endef
+#define EXPORT_SYMBOL2(name)  \
+  .section .drectve,"yn" SEPARATOR\
+  .ascii "-export:", #name, "\0" SEPARATOR\
+  .text
+#define EXPORT_SYMBOL(name) EXPORT_SYMBOL2(name)
 #define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
@@ -82,6 +89,7 @@
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
+  EXPORT_SYMBOL(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


[PATCH] D51508: Export public functions implemented in assembly on Windows.

2018-08-31 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: src/assembly.h:76-78
+  .section .drectve,"yn" SEPARATOR\
+  .ascii "-export:", #name, "\0" SEPARATOR\
+  .text

cdavis5x wrote:
> rnk wrote:
> > Maybe .pushsection / .popsection is better than assuming you were in .text.
> I initially wanted to do that, but those directives aren't supported by COFF. 
> Neither, by the way, is `.previous`. Perhaps this needs to be fixed in LLVM.
Huh, I guess neither does gas. .text is fine then. I'll file a bug to implement 
those directives for COFF. They're pretty handy, especially for an object file 
format that uses comdat sections so frequently.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D51508



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


[PATCH] D51508: Export public functions implemented in assembly on Windows.

2018-08-31 Thread Charles Davis via Phabricator via cfe-commits
cdavis5x added inline comments.



Comment at: src/assembly.h:76-78
+  .section .drectve,"yn" SEPARATOR\
+  .ascii "-export:", #name, "\0" SEPARATOR\
+  .text

rnk wrote:
> Maybe .pushsection / .popsection is better than assuming you were in .text.
I initially wanted to do that, but those directives aren't supported by COFF. 
Neither, by the way, is `.previous`. Perhaps this needs to be fixed in LLVM.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D51508



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


[PATCH] D51508: Export public functions implemented in assembly on Windows.

2018-08-30 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: src/assembly.h:76-78
+  .section .drectve,"yn" SEPARATOR\
+  .ascii "-export:", #name, "\0" SEPARATOR\
+  .text

Maybe .pushsection / .popsection is better than assuming you were in .text.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D51508



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


[PATCH] D51508: Export public functions implemented in assembly on Windows.

2018-08-30 Thread Charles Davis via Phabricator via cfe-commits
cdavis5x created this revision.
cdavis5x added reviewers: mstorsjo, rnk.
Herald added subscribers: cfe-commits, christof.

By default, symbols aren't visible outside of the module that defines
them. To make them visible, they must be exported. The easiest way to do
that is to embed an `-export:symname` directive into the object file.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D51508

Files:
  src/assembly.h


Index: src/assembly.h
===
--- src/assembly.h
+++ src/assembly.h
@@ -44,6 +44,7 @@
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
@@ -54,6 +55,7 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
@@ -70,6 +72,11 @@
 .scl 2 SEPARATOR   
\
 .type 32 SEPARATOR 
\
   .endef
+#define EXPORT_SYMBOL2(name)  \
+  .section .drectve,"yn" SEPARATOR\
+  .ascii "-export:", #name, "\0" SEPARATOR\
+  .text
+#define EXPORT_SYMBOL(name) EXPORT_SYMBOL2(name)
 #define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
@@ -82,6 +89,7 @@
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
+  EXPORT_SYMBOL(name) SEPARATOR   \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
   SYMBOL_NAME(name):
 


Index: src/assembly.h
===
--- src/assembly.h
+++ src/assembly.h
@@ -44,6 +44,7 @@
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
@@ -54,6 +55,7 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define EXPORT_SYMBOL(name)
 #define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
@@ -70,6 +72,11 @@
 .scl 2 SEPARATOR   \
 .type 32 SEPARATOR \
   .endef
+#define EXPORT_SYMBOL2(name)  \
+  .section .drectve,"yn" SEPARATOR\
+  .ascii "-export:", #name, "\0" SEPARATOR\
+  .text
+#define EXPORT_SYMBOL(name) EXPORT_SYMBOL2(name)
 #define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
@@ -82,6 +89,7 @@
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
+  EXPORT_SYMBOL(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