Skip to content

Commit 0614e11

Browse files
committed
[libc++] Make __start___lcxx_override/__stop___lcxx_override weak
After llvm#69498, when `_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE` functions are absent (possibly after ld --gc-sections), there will no output section `__lcxx_override`. The linker will report an error like ``` ld: error: undefined symbol: __start___lcxx_override >>> referenced by overridable_function.h:108 (libcxx/src/include/overridable_function.h:108) ``` Fix this by making the references weak.
1 parent 3135984 commit 0614e11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libcxx/src/include/overridable_function.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ _LIBCPP_END_NAMESPACE_STD
9595
// variables with those names corresponding to the start and the end of the section.
9696
//
9797
// See https://stackoverflow.com/questions/16552710/how-do-you-get-the-start-and-end-addresses-of-a-custom-elf-section
98-
extern char __start___lcxx_override;
99-
extern char __stop___lcxx_override;
98+
_LIBCPP_WEAK extern char __start___lcxx_override;
99+
_LIBCPP_WEAK extern char __stop___lcxx_override;
100100

101101
_LIBCPP_BEGIN_NAMESPACE_STD
102102
template <class _Ret, class... _Args>

0 commit comments

Comments
 (0)