Skip to content

Commit 82c9331

Browse files
committed
Use correct attributes for functions
1 parent 7b6b05c commit 82c9331

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

libcxx/include/__config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,14 @@ typedef __char32_t char32_t;
804804
# define _LIBCPP_WEAK __attribute__((__weak__))
805805
# endif
806806

807+
# ifndef _LIBCPP_WEAK_IMPORT
808+
# define _LIBCPP_WEAK_IMPORT __attribute__((weak_import))
809+
# endif
810+
811+
# ifndef _LIBCPP_ALIAS
812+
# define _LIBCPP_ALIAS(x) __attribute__((alias(x)))
813+
# endif
814+
807815
// Thread API
808816
// clang-format off
809817
# if _LIBCPP_HAS_THREADS && \

libcxx/src/include/overridable_function.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
#include <__config>
1414
#include <cstdint>
1515

16-
#if __has_feature(ptrauth_calls)
17-
# include <ptrauth.h>
18-
#endif
19-
2016
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2117
# pragma GCC system_header
2218
#endif
@@ -66,14 +62,14 @@ _LIBCPP_END_NAMESPACE_STD
6662

6763
# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
6864
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
69-
[[clang::weak_import]] extern type symbol arglist __asm__("_" _LIBCPP_TOSTRING(symbol)); \
65+
_LIBCPP_WEAK_IMPORT extern type symbol arglist __asm__("_" _LIBCPP_TOSTRING(symbol)); \
7066
_LIBCPP_BEGIN_NAMESPACE_STD \
7167
template <> \
7268
inline bool __is_function_overridden<static_cast<type(*) arglist>(name)>() { \
7369
return static_cast<type(*) arglist>(name) != symbol; \
7470
} \
7571
_LIBCPP_END_NAMESPACE_STD \
76-
type name arglist
72+
_LIBCPP_WEAK type name arglist
7773

7874
#elif defined(_LIBCPP_OBJECT_FORMAT_ELF)
7975

@@ -86,15 +82,14 @@ _LIBCPP_END_NAMESPACE_STD
8682

8783
# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
8884
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
89-
[[gnu::weak]] type name arglist; \
90-
[[gnu::alias(_LIBCPP_TOSTRING(symbol))]] static type symbol arglist __asm__(".L." _LIBCPP_TOSTRING(symbol)); \
85+
_LIBCPP_ALIAS(_LIBCPP_TOSTRING(symbol)) static type symbol arglist __asm__(".L." _LIBCPP_TOSTRING(symbol)); \
9186
_LIBCPP_BEGIN_NAMESPACE_STD \
9287
template <> \
9388
inline bool __is_function_overridden<static_cast<type(*) arglist>(name)>() { \
9489
return static_cast<type(*) arglist>(name) != symbol; \
9590
} \
9691
_LIBCPP_END_NAMESPACE_STD \
97-
type name arglist
92+
_LIBCPP_WEAK type name arglist
9893

9994
#else
10095

0 commit comments

Comments
 (0)