[llvm-commits] AddressSanitizer, first patch

Kostya Serebryany kcc at google.com
Thu Sep 8 17:57:34 PDT 2011


>
>
>
> A couple review comments:
>
> AddressSanitizer::appendToGlobalCtors is messy at best;


Agree (the code is stolen from some other part of LLVM and fixed to actually
work).

is there
> really no better way to get the asan init function to run when it
> needs to?
>

I see no other way other than to append to llvm.global_ctors.
Given that I didn't find whether LLVM guaranties the particular order of
CTOR execution, I have to call them twice, at the beginning and at the end
of llvm.global_ctors
Suggestions?


>
> Please get rid of blockHasException and the dependent code; the
> eh_exception intrinsic is going away very soon, and you shouldn't run
> into similar issues with the new exception handling framework.
>

Done.



>
> +  GlobalValue *asan_mapping_offset =
> +      new GlobalVariable(M, IntPtrTy, true,
> GlobalValue::LinkOnceODRLinkage,
> +                     ConstantInt::get(IntPtrTy, 1ULL << MappingOffsetLog),
> +                     "__asan_mapping_offset");
> +  GlobalValue *asan_mapping_scale =
> +      new GlobalVariable(M, IntPtrTy, true,
> GlobalValue::LinkOnceODRLinkage,
> +                         ConstantInt::get(IntPtrTy, MappingScale),
> +                         "__asan_mapping_scale");
>
> If you use WeakLinkage for these, you won't need the fake loads.
>

Surprisingly these globals *were* optimized away at -O3, at least at some
point.
Dropped the fake loads for now.


>
> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110908/36962aab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: issue4867059_15008.diff
Type: text/x-patch
Size: 23668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110908/36962aab/attachment.bin>


More information about the llvm-commits mailing list