Commit e663b2bc authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

use weakref for cxxabi demangle

Summary: Since `[[gnu::weakref]]` can be used effectively in cases where `[[gnu::weak]]` cannot.

Reviewed By: Orvid

Differential Revision: D27672340

fbshipit-source-id: 4882f0176726aece411359c25411f0f4be7fc59f
parent 4a6e1bea
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <cstring> #include <cstring>
#include <folly/lang/CString.h> #include <folly/lang/CString.h>
#include <folly/portability/Config.h>
#if __has_include(<cxxabi.h>) #if __has_include(<cxxabi.h>)
#include <cxxabi.h> #include <cxxabi.h>
...@@ -39,22 +38,18 @@ ...@@ -39,22 +38,18 @@
// try to find cxxabi demangle // try to find cxxabi demangle
// //
// prefer using a weak symbol // prefer using a weakref
#if FOLLY_HAVE_WEAK_SYMBOLS #if __has_include(<cxxabi.h>)
namespace __cxxabiv1 { [[gnu::weakref("__cxa_demangle")]] static char* cxxabi_demangle(
extern "C" FOLLY_ATTR_WEAK char* __cxa_demangle(
char const*, char*, size_t*, int*); char const*, char*, size_t*, int*);
}
static auto const cxxabi_demangle = __cxxabiv1::__cxa_demangle;
#else // FOLLY_HAVE_WEAK_SYMBOLS #else // __has_include(<cxxabi.h>)
static constexpr auto cxxabi_demangle = static_cast<char* (*)(...)>(nullptr); static constexpr auto cxxabi_demangle = static_cast<char* (*)(...)>(nullptr);
#endif // FOLLY_HAVE_WEAK_SYMBOLS #endif // __has_include(<cxxabi.h>)
// try to find liberty demangle // try to find liberty demangle
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment