Skip to content

Commit f1c5c84

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
1 parent ca3313d commit f1c5c84

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
@@ -238,6 +238,20 @@ Changes to LLDB
238238

239239
Changes to Sanitizers
240240
---------------------
241+
* For Darwin users that override weak symbols, note that the dynamic linker will
242+
only consider symbols in other mach-o modules which themselves contain at
243+
least one weak symbol. A consequence is that if your program or dylib contains
244+
an intended override of a weak symbol, then it must contain at least one weak
245+
symbol as well for the override to be effective. That weak symbol may be the
246+
intended override itself, an otherwise usused weak symbol added solely to meet
247+
the requirement, or an existing but unrelated weak symbol.
248+
249+
Examples:
250+
__attribute__((weak)) const char * __asan_default_options(void) {...}
251+
252+
__attribute__((weak,unused)) unsigned __enableOverrides;
253+
254+
__attribute__((weak)) bool unrelatedWeakFlag;
241255

242256
Other Changes
243257
-------------

0 commit comments

Comments
 (0)