Skip to content

Commit c2f4b04

Browse files
committed
Use static symbols
1 parent ab62cfd commit c2f4b04

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libcxx/src/include/overridable_function.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ _LIBCPP_END_NAMESPACE_STD
6767

6868
# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
6969
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
70-
extern "C" type symbol##_impl__ arglist; \
70+
static type symbol##_impl__ arglist __asm__(_LIBCPP_TOSTRING(symbol##_impl__)); \
7171
__asm__(".globl _" _LIBCPP_TOSTRING(symbol)); \
7272
__asm__(".set _" _LIBCPP_TOSTRING(symbol) ", _" _LIBCPP_TOSTRING(symbol##_impl__)); \
7373
extern __typeof(symbol##_impl__) name __attribute__((weak_import)); \
@@ -77,7 +77,7 @@ _LIBCPP_END_NAMESPACE_STD
7777
return static_cast<type(*) arglist>(name) != symbol##_impl__; \
7878
} \
7979
_LIBCPP_END_NAMESPACE_STD \
80-
type symbol##_impl__ arglist
80+
static type symbol##_impl__ arglist
8181

8282
#elif defined(_LIBCPP_OBJECT_FORMAT_ELF)
8383

@@ -90,15 +90,15 @@ _LIBCPP_END_NAMESPACE_STD
9090

9191
# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
9292
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
93-
extern "C" type symbol##_impl__ arglist; \
93+
static type symbol##_impl__ arglist __asm__(_LIBCPP_TOSTRING(symbol##_impl__)); \
9494
[[gnu::weak, gnu::alias(_LIBCPP_TOSTRING(symbol##_impl__))]] type name arglist; \
9595
_LIBCPP_BEGIN_NAMESPACE_STD \
9696
template <> \
9797
constexpr bool __is_function_overridden<static_cast<type(*) arglist>(name)>() { \
9898
return static_cast<type(*) arglist>(name) != symbol##_impl__; \
9999
} \
100100
_LIBCPP_END_NAMESPACE_STD \
101-
type symbol##_impl__ arglist
101+
static type symbol##_impl__ arglist
102102

103103
#else
104104

0 commit comments

Comments
 (0)