Skip to content

Commit 783de73

Browse files
committed
fix link error in PE/COFF
1 parent 3eb0164 commit 783de73

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

libcxx/include/__configuration/abi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
// so disable it.
9898
# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
9999
# endif
100+
// The PE/COFF format reports a linking error when encountering multiple symbol definitions where at least one is a
101+
// strong symbol. So we can't inlining a function without ABI breakchange.
102+
# if defined(_LIBCPP_OBJECT_FORMAT_COFF)
103+
# define _LIBCPP_DISABLE_INLINE_OPTIMIZE_BECAUSE_MULTIPLY_SYMBOLS_ERROR
104+
# endif
100105
// Feature macros for disabling pre ABI v1 features. All of these options
101106
// are deprecated.
102107
# if defined(__FreeBSD__)

libcxx/include/__memory/align.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,18 @@ __align_impl(size_t __align, size_t __sz, void*& __ptr, size_t& __space) {
3636
}
3737

3838
#ifndef _LIBCPP_EXPORT_ALIGN_SYMBOL
39+
# ifdef _LIBCPP_DISABLE_INLINE_OPTIMIZE_BECAUSE_MULTIPLY_SYMBOLS_ERROR
40+
41+
_LIBCPP_EXPORTED_FROM_ABI void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
42+
43+
# else
3944

4045
inline _LIBCPP_HIDE_FROM_ABI void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space) {
4146
return __align_impl(__align, __sz, __ptr, __space);
4247
}
4348

49+
# endif // _LIBCPP_DISABLE_INLINE_OPTIMIZE_BECAUSE_MULTIPLY_SYMBOLS_ERROR
50+
4451
#endif // _LIBCPP_EXPORT_ALIGN_SYMBOL
4552

4653
_LIBCPP_END_NAMESPACE_STD

libcxx/src/memory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ __sp_mut& __get_sp_mut(const void* p) {
140140
_LIBCPP_EXPORTED_FROM_ABI void* align(size_t alignment, size_t size, void*& ptr, size_t& space) {
141141
return __align_impl(alignment, size, ptr, space);
142142
}
143+
143144
#endif // _LIBCPP_EXPORT_ALIGN_SYMBOL
144145

145146
_LIBCPP_END_NAMESPACE_STD

0 commit comments

Comments
 (0)