[llvm-commits] [ASan] set larger alignment for ASan mapping constants (issue 5844058)

Alexander Potapenko glider at google.com
Mon Mar 19 09:22:56 PDT 2012


How about adding a flag that enables emitting them?

On Mon, Mar 19, 2012 at 8:11 PM, Kostya Serebryany <kcc at google.com> wrote:
> I would just disable these two globals -- they are used only for experiments
> right now.
> Let me do the change.
>
> --kcc
>
>
> On Mon, Mar 19, 2012 at 3:00 AM, <samsonov at google.com> wrote:
>>
>> Reviewers: kcc,
>>
>>
>>
>> Please review this at http://codereview.appspot.com/5844058/
>>
>> Affected files:
>>   M     lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>
>>
>> Index: lib/Transforms/Instrumentation/AddressSanitizer.cpp
>> ===================================================================
>> --- lib/Transforms/Instrumentation/AddressSanitizer.cpp (revision 153031)
>> +++ lib/Transforms/Instrumentation/AddressSanitizer.cpp (working copy)
>> @@ -62,6 +62,7 @@
>>  static const char *kAsanHandleNoReturnName = "__asan_handle_no_return";
>>  static const char *kAsanMappingOffsetName = "__asan_mapping_offset";
>>  static const char *kAsanMappingScaleName = "__asan_mapping_scale";
>> +static const int   kAsanMappingConstantsAlignment = 1 << 5;
>>  static const char *kAsanStackMallocName = "__asan_stack_malloc";
>>  static const char *kAsanStackFreeName = "__asan_stack_free";
>>
>> @@ -584,10 +585,12 @@
>>        new GlobalVariable(M, IntptrTy, true,
>> GlobalValue::LinkOnceODRLinkage,
>>                       ConstantInt::get(IntptrTy, MappingOffset),
>>                       kAsanMappingOffsetName);
>> +  asan_mapping_offset->setAlignment(kAsanMappingConstantsAlignment);
>>    GlobalValue *asan_mapping_scale =
>>        new GlobalVariable(M, IntptrTy, true,
>> GlobalValue::LinkOnceODRLinkage,
>>                           ConstantInt::get(IntptrTy, MappingScale),
>>                           kAsanMappingScaleName);
>> +  asan_mapping_scale->setAlignment(kAsanMappingConstantsAlignment);
>>    // Read these globals, otherwise they may be optimized away.
>>    IRB.CreateLoad(asan_mapping_scale, true);
>>    IRB.CreateLoad(asan_mapping_offset, true);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexander Potapenko
Software Engineer
Google Moscow




More information about the llvm-commits mailing list