Skip to content

Commit 6bc3cb2

Browse files
author
Roy Sundahl
committed
[sanitizers] Explainer about dyld and weak overrides on Darwin. (NFC)
Explain in the release notes that the Darwin dynamic linker (dyld) requires that at least one weak symbol be present in any mach-o file that defines an intended override of a sanitizer dylib weak reference. rdar://103453678 Reviewed By: thetruestblue Differential Revision: https://reviews.llvm.org/D146745 (cherry picked from commit f1c5c84)
1 parent 6b002b8 commit 6bc3cb2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

llvm/docs/ReleaseNotes.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,20 @@ Changes to LLDB
182182

183183
Changes to Sanitizers
184184
---------------------
185+
* For Darwin users that override weak symbols, note that the dynamic linker will
186+
only consider symbols in other mach-o modules which themselves contain at
187+
least one weak symbol. A consequence is that if your program or dylib contains
188+
an intended override of a weak symbol, then it must contain at least one weak
189+
symbol as well for the override to be effective. That weak symbol may be the
190+
intended override itself, an otherwise usused weak symbol added solely to meet
191+
the requirement, or an existing but unrelated weak symbol.
192+
193+
Examples:
194+
__attribute__((weak)) const char * __asan_default_options(void) {...}
195+
196+
__attribute__((weak,unused)) unsigned __enableOverrides;
197+
198+
__attribute__((weak)) bool unrelatedWeakFlag;
185199

186200

187201
Other Changes

0 commit comments

Comments
 (0)