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:
> delcypher wrote:
> > delcypher wrote:
> > > 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`).
> > @vitalybuka To expand on my answer a little more. 
> > `-fsanitize-address-destructor-kind=` is needed because we need to able to 
> > control how ASan's module are emitted and unfortunately the information 
> > required to make the decision on which kind to emit **is not available at 
> > the level of LLVM IR**. The information we need to be able to make the 
> > decision is only available in the Clang driver. This is why this patch 
> > wires everything up so that the driver can change how ASan module 
> > destructors are emitted.
> > @vitalybuka To expand on my answer a little more. 
> > `-fsanitize-address-destructor-kind=` is needed because we need to able to 
> > control how ASan's module are emitted and unfortunately the information 
> > required to make the decision on which kind to emit **is not available at 
> > the level of LLVM IR**. The information we need to be able to make the 
> > decision is only available in the Clang driver. This is why this patch 
> > wires everything up so that the driver can change how ASan module 
> > destructors are emitted.
> 
> I didn't check all patches yet, but we have -fsanitize=kernel-address and I 
> noticed that your patches mentioned kernel. Could be possible just use 
> -fsanitize=kernel-address and let ASan decide how to handle dtors for this 
> platform?
@vitalybuka Unfortunately using `-fsanitize=kernel-address` isn't a viable 
option. In a future patch I'll be adding another destructor kind where the 
decision to use it is **also unfortunately not known at the LLVM IR level** and 
is instead only known by Clang driver.

If you really don't want `-fsanitize-address-destructor-kind=` exposed as 
driver option (i.e. exposed to our users) we could make it a frontend (cc1) 
only option. However, that doesn't really seem to match the existing sanitizer 
frontend options which all seem to be driver options as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96572

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to