[PATCH] D54337: [ASan] Make AddressSanitizer a ModulePass

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 19 13:20:07 PST 2018


leonardchan added a comment.

In https://reviews.llvm.org/D54337#1300858, @philip.pfaffe wrote:

> > Sorry for the delayed response. So the main problem is that `AddressSantizer` needs to perform some initialization involving reading stuff from global metadata and getting some target specific information. More specifically, just these 6 things which are all initialized in `doInitialization`:
> > 
> >   GlobalsMD.init(M);
> >   C = &(M.getContext());
> >   LongSize = M.getDataLayout().getPointerSizeInBits();
> >   IntptrTy = Type::getIntNTy(*C, LongSize);
> >   TargetTriple = Triple(M.getTargetTriple());
> >   Mapping = getShadowMapping(TargetTriple, LongSize, CompileKernel);
> >    
>
> If asan doesn't modify the module for this ('this' meaning the Mapping and the GlobalsMD here), than this is an excellent candidate for an analysis.


When you say analysis, do you mean like the `TargetLibraryInfoWrapperPass` that AddressSanitizer is dependent on? Not sure what the difference between passes and analyses are, but if the purpose of `TargetLibraryInfoWrapperPass` is to just pass a `TargetLibraryInfo` to AddressSantizer, then it seems a new WrapperPass could similarly be made for this initialized data as a custom class made specifically for ASan.


Repository:
  rL LLVM

https://reviews.llvm.org/D54337





More information about the llvm-commits mailing list