[PATCH] D146745: [sanitizers] Explainer about dyld and weak overrides on Darwin.

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 14:39:28 PDT 2023


yln added inline comments.


================
Comment at: llvm/docs/ReleaseNotes.rst:238-240
+  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.
----------------
What I meant above:
* Let's be **opinionated**: instead of listing all the possible options (and providing no guidance which one to pick), we should recommend one.
* Which one is the best?  I am making the argument that having a dummy symbol is the preferable option:
  * The symbol name doubles as a short explanation/documentation
  * It's confusing that the "overrider" is weak (it doesn't have to be, we just want to opt-in the executable); my mental model was "strong definitions overwrite weak ones", which is wrong, but I think other people might fall into this trap as well.  It confused Vitaly & Dmitry (two experts!) here: D146471
  * What happens if it's defined multiple times?  Not important (as long as it compiles); but it would be important for the override (i.e., if they diverge -> trouble)


These 2 points are separate, and I feel more strongly about "recommend single option".  Which ones do you agree/disagree with?


================
Comment at: llvm/docs/ReleaseNotes.rst:243-247
+      __attribute__((weak)) const char * __asan_default_options(void) {...}
+
+      __attribute__((weak,unused)) unsigned __enableOverrides;
+      
+      __attribute__((weak)) bool unrelatedWeakFlag;
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146745/new/

https://reviews.llvm.org/D146745



More information about the llvm-commits mailing list