[PATCH] D96572: [Clang][ASan] Introduce `-fsanitize-address-destructor-kind=` driver & frontend option.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 10:30:43 PST 2021


delcypher added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:1485
+def sanitize_address_destructor_kind_EQ : Joined<["-"], "fsanitize-address-destructor-kind=">,
+  MetaVarName<"<kind>">,
+  Flags<[CC1Option]>,
----------------
vitalybuka wrote:
> What is the difference between them and why it's need to be configured from outside?
Good questions. 

> What is the difference between them

I'll add some documentation to explain this. But the two different modes are introduced by https://reviews.llvm.org/D96571. Basically the default ("global") emits ASan module destructor calls via `llvm.global_dtors` which was the previous behaviour. The other mode "none" simply causes no ASan module destructors to be emitted. I plan to introduce another mode in a future patch.

> why it's need to be configured from outside?

At the bare minimum this option needs to be controllable by the driver so that we can do the next patch (https://reviews.llvm.org/D96573) where based on target details and other flags we set the ASan destructor kind. This means that the frontend needs to be able to consume to option too.

It is technically not necessary for this new option to be a driver option. However, I made it a driver option too to match the existing ASan clang frontend options which are also driver options (e.g. `-fsanitize-address-use-odr-indicator`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96572



More information about the llvm-commits mailing list