[PATCH] D142505: [ASan] Introduce a flag -asan-constructor-kind to control the generation of the Asan module constructor.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 14:28:51 PST 2023


vitalybuka added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:355
+    cl::desc("Sets the ASan constructor kind"),
+    cl::values(clEnumValN(AsanCtorKind::None, "none", "No destructors"),
+               clEnumValN(AsanCtorKind::Global, "global",
----------------
why it's about destructors?


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:2481
+    assert(AsanCtorFunction || ConstructorKind == AsanCtorKind::None);
+    IRBuilder<> IRB = AsanCtorFunction ? IRBuilder<>(AsanCtorFunction->getEntryBlock().getTerminator()) : IRBuilder<>(*C);
     InstrumentGlobals(IRB, M, &CtorComdat);
----------------
Can you do something like this?

What is the point of instrumenting globals without constructors?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142505



More information about the llvm-commits mailing list