[PATCH] D24945: [libc++abi] Default to DLL annotations on Windows

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 20:53:06 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL282470: [libc++abi] Default to DLL annotations on Windows (authored by smeenai).

Changed prior to commit:
  https://reviews.llvm.org/D24945?vs=72598&id=72599#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24945

Files:
  libcxxabi/trunk/CMakeLists.txt
  libcxxabi/trunk/include/__cxxabi_config.h

Index: libcxxabi/trunk/include/__cxxabi_config.h
===================================================================
--- libcxxabi/trunk/include/__cxxabi_config.h
+++ libcxxabi/trunk/include/__cxxabi_config.h
@@ -21,8 +21,13 @@
 #define __has_attribute(_attribute_) 0
 #endif
 
-#if defined(_LIBCXXABI_DLL)
- #if defined(cxxabi_EXPORTS)
+#if defined(_WIN32)
+ #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
+ #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
   #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
Index: libcxxabi/trunk/CMakeLists.txt
===================================================================
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -249,6 +249,15 @@
   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
 endif()
 
+# Let the library headers know they are currently being used to build the
+# library.
+add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
+
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
+  add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+endif()
+
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG -Werror=return-type)
 
 # Get warning flags
@@ -333,7 +342,6 @@
   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
 endif()
 
-# This is the _ONLY_ place where add_definitions is called.
 if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24945.72599.patch
Type: text/x-patch
Size: 1630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160927/78bb4f9e/attachment-0001.bin>


More information about the cfe-commits mailing list