summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2017-11-29 08:21:12 +0000
committerMartin Storsjo <martin@martin.st>2017-11-29 08:21:12 +0000
commitde940230960c9b465efab2feb06639240bbfa6ef (patch)
tree47a7e2839eccf6255821a6d5ec4b0ceaede8049e
parent592ba3b501a46b5027dd8616010f03742b6911b6 (diff)
Support building libunwind as a DLL
Differential Revision: https://reviews.llvm.org/D40483 git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@319300 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt5
-rw-r--r--src/config.h10
2 files changed, 12 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dda2799..f8ede54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -308,6 +308,11 @@ if (MSVC)
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
#===============================================================================
diff --git a/src/config.h b/src/config.h
index 6706e5a..07ca26b 100644
--- a/src/config.h
+++ b/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__)