[llvm] f1c5c84 - [sanitizers] Explainer about dyld and weak overrides on Darwin. (NFC)

Roy Sundahl via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 08:56:02 PDT 2023


Author: Roy Sundahl
Date: 2023-03-31T08:55:49-07:00
New Revision: f1c5c84ae1a87c6ea707ae3b3e524e9eeaf1d70a

URL: https://github.com/llvm/llvm-project/commit/f1c5c84ae1a87c6ea707ae3b3e524e9eeaf1d70a
DIFF: https://github.com/llvm/llvm-project/commit/f1c5c84ae1a87c6ea707ae3b3e524e9eeaf1d70a.diff

LOG: [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

Added: 
    

Modified: 
    llvm/docs/ReleaseNotes.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 4acb69f9327f..da0ede2b5ee8 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -238,6 +238,20 @@ Changes to LLDB
 
 Changes to Sanitizers
 ---------------------
+* For Darwin users that override weak symbols, note that the dynamic linker will
+  only consider symbols in other mach-o modules which themselves contain at
+  least one weak symbol. A consequence is that if your program or dylib contains
+  an intended override of a weak symbol, then it must contain at least one weak
+  symbol as well for the override to be effective. That weak symbol may be the
+  intended override itself, an otherwise usused weak symbol added solely to meet
+  the requirement, or an existing but unrelated weak symbol.
+
+    Examples:
+      __attribute__((weak)) const char * __asan_default_options(void) {...}
+
+      __attribute__((weak,unused)) unsigned __enableOverrides;
+      
+      __attribute__((weak)) bool unrelatedWeakFlag;
 
 Other Changes
 -------------


        


More information about the llvm-commits mailing list