[PATCH] D40483: [libunwind] Support building libunwind as a DLL

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 00:21:34 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL319300: Support building libunwind as a DLL (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D40483?vs=124347&id=124700#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40483

Files:
  libunwind/trunk/CMakeLists.txt
  libunwind/trunk/src/config.h


Index: libunwind/trunk/src/config.h
===================================================================
--- libunwind/trunk/src/config.h
+++ libunwind/trunk/src/config.h
@@ -50,9 +50,13 @@
   #define _LIBUNWIND_EXPORT
   #define _LIBUNWIND_HIDDEN
 #else
-  // FIXME: these macros are not correct for COFF targets
-  #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
-  #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
+  #if !defined(__ELF__) && !defined(__MACH__)
+    #define _LIBUNWIND_EXPORT __declspec(dllexport)
+    #define _LIBUNWIND_HIDDEN
+  #else
+    #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
+    #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
+  #endif
 #endif
 
 #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
Index: libunwind/trunk/CMakeLists.txt
===================================================================
--- libunwind/trunk/CMakeLists.txt
+++ libunwind/trunk/CMakeLists.txt
@@ -308,6 +308,11 @@
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
 
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBUNWIND_ENABLE_STATIC AND NOT LIBUNWIND_ENABLE_SHARED)
+  add_definitions(-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
+endif()
+
 #===============================================================================
 # Setup Source Code
 #===============================================================================


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40483.124700.patch
Type: text/x-patch
Size: 1474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171129/5583ceee/attachment.bin>


More information about the llvm-commits mailing list