[libunwind] r341232 - Export public functions implemented in assembly on Windows.

Charles Davis via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 31 11:11:49 PDT 2018


Author: cdavis
Date: Fri Aug 31 11:11:48 2018
New Revision: 341232

URL: http://llvm.org/viewvc/llvm-project?rev=341232&view=rev
Log:
Export public functions implemented in assembly on Windows.

Summary:
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.

Reviewers: mstorsjo, rnk

Subscribers: christof, cfe-commits

Differential Revision: https://reviews.llvm.org/D51508

Modified:
    libunwind/trunk/src/assembly.h

Modified: libunwind/trunk/src/assembly.h
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=341232&r1=341231&r2=341232&view=diff
==============================================================================
--- libunwind/trunk/src/assembly.h (original)
+++ libunwind/trunk/src/assembly.h Fri Aug 31 11:11:48 2018
@@ -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, at 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):
 




More information about the cfe-commits mailing list