[PATCH] D55146: [asan] Reduce binary size by using unnamed private aliases

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 16:39:38 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348221: [asan] Reduce binary size by using unnamed private aliases (authored by vitalybuka, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55146?vs=176196&id=176514#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55146

Files:
  llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  llvm/trunk/test/Instrumentation/AddressSanitizer/local_alias.ll


Index: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -746,7 +746,7 @@
               ClRecover : Recover;
           this->CompileKernel = ClEnableKasan.getNumOccurrences() > 0 ?
               ClEnableKasan : CompileKernel;
-	}
+  }
 
   bool runOnModule(Module &M) override;
   StringRef getPassName() const override { return "AddressSanitizerModule"; }
@@ -2176,8 +2176,8 @@
     if (CanUsePrivateAliases && ClUsePrivateAliasForGlobals) {
       // Create local alias for NewGlobal to avoid crash on ODR between
       // instrumented and non-instrumented libraries.
-      auto *GA = GlobalAlias::create(GlobalValue::InternalLinkage,
-                                     NameForGlobal + M.getName(), NewGlobal);
+      auto *GA =
+          GlobalAlias::create(GlobalValue::PrivateLinkage, "", NewGlobal);
 
       // With local aliases, we need to provide another externally visible
       // symbol __odr_asan_XXX to detect ODR violation.
Index: llvm/trunk/test/Instrumentation/AddressSanitizer/local_alias.ll
===================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/local_alias.ll
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/local_alias.ll
@@ -7,7 +7,7 @@
 
 ; Check that we generate internal alias and odr indicator symbols for global to be protected.
 ; CHECK: @__odr_asan_gen_a = internal global i8 0, align 1
-; CHECK: @"a<stdin>" = internal alias { [2 x i32], [56 x i8] }, { [2 x i32], [56 x i8] }* @a
+; CHECK: @0 = private alias { [2 x i32], [56 x i8] }, { [2 x i32], [56 x i8] }* @a
 
 ; Function Attrs: nounwind sanitize_address uwtable
 define i32 @foo(i32 %M) #0 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55146.176514.patch
Type: text/x-patch
Size: 1879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/1c2d50c0/attachment.bin>


More information about the llvm-commits mailing list