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

samsonov at google.com samsonov at google.com
Mon Mar 19 03:00:31 PDT 2012


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);





More information about the llvm-commits mailing list