[PATCH] D51508: Export public functions implemented in assembly on Windows.
Charles Davis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 30 14:38:28 PDT 2018
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, 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):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51508.163414.patch
Type: text/x-patch
Size: 1335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180830/06156f47/attachment.bin>
More information about the cfe-commits
mailing list