summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/config-ix.cmake1
-rw-r--r--include/__cxxabi_config.h3
-rw-r--r--src/cxa_default_handlers.cpp5
-rw-r--r--src/cxa_handlers.cpp4
5 files changed, 12 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37cc560..85aa893 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -250,6 +250,8 @@ append_if(LIBCXXABI_CXX_FLAGS LIBCXXABI_HAS_EHSC_FLAG -EHsc)
append_if(LIBCXXABI_C_FLAGS LIBCXXABI_HAS_FUNWIND_TABLES -funwind-tables)
+append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden)
+
# Assert
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if (LIBCXXABI_ENABLE_ASSERTIONS)
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 1d40b2a..e9e4372 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -8,6 +8,7 @@ check_cxx_compiler_flag(-fPIC LIBCXXABI_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBCXXABI_HAS_NO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBCXXABI_HAS_NO_RTTI_FLAG)
check_cxx_compiler_flag(-fstrict-aliasing LIBCXXABI_HAS_FSTRICT_ALIASING_FLAG)
+check_cxx_compiler_flag(-fvisibility=hidden LIBCXXABI_HAS_FVISIBILITY_HIDDEN_FLAG)
check_cxx_compiler_flag(-nodefaultlibs LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
check_cxx_compiler_flag(-nostdinc++ LIBCXXABI_HAS_NOSTDINCXX_FLAG)
check_cxx_compiler_flag(-Wall LIBCXXABI_HAS_WALL_FLAG)
diff --git a/include/__cxxabi_config.h b/include/__cxxabi_config.h
index 68e325f..61555f1 100644
--- a/include/__cxxabi_config.h
+++ b/include/__cxxabi_config.h
@@ -24,15 +24,18 @@
#if defined(_LIBCXXABI_DLL)
#if defined(cxxabi_EXPORTS)
#define _LIBCXXABI_HIDDEN
+ #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
#define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
#define _LIBCXXABI_TYPE_VIS __declspec(dllexport)
#else
#define _LIBCXXABI_HIDDEN
+ #define _LIBCXXABI_DATA_VIS __declspec(dllimport)
#define _LIBCXXABI_FUNC_VIS __declspec(dllimport)
#define _LIBCXXABI_TYPE_VIS __declspec(dllimport)
#endif
#else
#define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
+ #define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
#define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default")))
#if __has_attribute(__type_visibility__)
#define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default")))
diff --git a/src/cxa_default_handlers.cpp b/src/cxa_default_handlers.cpp
index d34341a..09350e7 100644
--- a/src/cxa_default_handlers.cpp
+++ b/src/cxa_default_handlers.cpp
@@ -88,7 +88,10 @@ static void default_unexpected_handler()
//
// Global variables that hold the pointers to the current handler
//
-std::terminate_handler __cxa_terminate_handler = default_terminate_handler;
+_LIBCXXABI_DATA_VIS
+std::terminate_handler __cxa_terminate_handler = default_terminate_handler;
+
+_LIBCXXABI_DATA_VIS
std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler;
// In the future these will become:
diff --git a/src/cxa_handlers.cpp b/src/cxa_handlers.cpp
index 9c1c302..c231b5a 100644
--- a/src/cxa_handlers.cpp
+++ b/src/cxa_handlers.cpp
@@ -102,9 +102,9 @@ terminate() _NOEXCEPT
__terminate(get_terminate());
}
-extern "C" new_handler __cxa_new_handler = 0;
-// In the future these will become:
+// In the future this will become:
// std::atomic<std::new_handler> __cxa_new_handler(0);
+extern "C" _LIBCXXABI_DATA_VIS new_handler __cxa_new_handler = 0;
new_handler
set_new_handler(new_handler handler) _NOEXCEPT