Rename __asan_gen_* symbols to ___asan_gen_*.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 18 Jul 2018 22:23:14 +0000 (22:23 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 18 Jul 2018 22:23:14 +0000 (22:23 +0000)
This prevents gold from printing a warning when trying to export
these symbols via the asan dynamic list after ThinLTO promotes them
from private symbols to external symbols with hidden visibility.

Differential Revision: https://reviews.llvm.org/D49498

llvm-svn: 337428

12 files changed:
compiler-rt/test/asan/TestCases/Darwin/asan_gen_prefixes.cc
compiler-rt/test/asan/TestCases/Posix/no_asan_gen_globals.c
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/test/DebugInfo/AArch64/asan-stack-vars.ll
llvm/test/DebugInfo/COFF/asan-module-without-functions.ll
llvm/test/DebugInfo/Generic/incorrect-variable-debugloc.ll
llvm/test/DebugInfo/X86/dbg_value_direct.ll
llvm/test/DebugInfo/X86/debug-loc-asan.ll
llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-profiling-globals.ll
llvm/test/Instrumentation/AddressSanitizer/global_metadata.ll
llvm/test/Instrumentation/AddressSanitizer/global_metadata_array.ll
llvm/test/Instrumentation/AddressSanitizer/instrument_global.ll

index 9f3a66a..fe33743 100644 (file)
@@ -1,4 +1,4 @@
-// Make sure __asan_gen_* strings have the correct prefixes on Darwin
+// Make sure ___asan_gen_* strings have the correct prefixes on Darwin
 // ("L" in __TEXT,__cstring, "l" in __TEXT,__const
 
 // RUN: %clang_asan %s -S -o %t.s
@@ -9,8 +9,8 @@
 int x, y, z;
 int main() { return 0; }
 // CHECK: .section{{.*}}__TEXT,__const
-// CHECK: l___asan_gen_
+// CHECK: l____asan_gen_
 // CHECK: .section{{.*}}__TEXT,__cstring,cstring_literals
-// CHECK: L___asan_gen_
-// CHECK: L___asan_gen_
-// CHECK: L___asan_gen_
+// CHECK: L____asan_gen_
+// CHECK: L____asan_gen_
+// CHECK: L____asan_gen_
index 3849ad3..994f827 100644 (file)
@@ -1,10 +1,10 @@
 // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
 // XFAIL: android
-// Make sure __asan_gen_* strings do not end up in the symbol table.
+// Make sure ___asan_gen_* strings do not end up in the symbol table.
 
 // RUN: %clang_asan %s -o %t.exe
 // RUN: nm %t.exe | FileCheck %s
 
 int x, y, z;
 int main() { return 0; }
-// CHECK-NOT: __asan_gen_
+// CHECK-NOT: ___asan_gen_
index b33cc5e..b3f6591 100644 (file)
@@ -153,7 +153,7 @@ static const char *const kAsanHandleNoReturnName = "__asan_handle_no_return";
 static const int kMaxAsanStackMallocSizeClass = 10;
 static const char *const kAsanStackMallocNameTemplate = "__asan_stack_malloc_";
 static const char *const kAsanStackFreeNameTemplate = "__asan_stack_free_";
-static const char *const kAsanGenPrefix = "__asan_gen_";
+static const char *const kAsanGenPrefix = "___asan_gen_";
 static const char *const kODRGenPrefix = "__odr_asan_gen_";
 static const char *const kSanCovGenPrefix = "__sancov_gen_";
 static const char *const kAsanSetShadowPrefix = "__asan_set_shadow_";
index e7733f4..5db4606 100644 (file)
@@ -73,7 +73,7 @@ target triple = "arm64-apple-ios"
 @llvm.compiler.used = appending global [12 x i8*] [i8* bitcast (%struct._class_t** @"OBJC_CLASSLIST_REFERENCES_$_" to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @OBJC_METH_VAR_NAME_, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_ to i8*), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @OBJC_METH_VAR_NAME_.1, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.2 to i8*), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_METH_VAR_NAME_.3, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.4 to i8*), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @OBJC_CLASS_NAME_, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @OBJC_METH_VAR_NAME_.5, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @OBJC_METH_VAR_TYPE_, i32 0, i32 0), i8* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_CLASS_METHODS_MyObject" to i8*), i8* bitcast ([1 x i8*]* @"OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata"
 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
 @__asan_shadow_memory_dynamic_address = external global i64
-@__asan_gen_ = private unnamed_addr constant [34 x i8] c"2 32 16 9 imageSize 64 8 6 object\00", align 1
+@___asan_gen_ = private unnamed_addr constant [34 x i8] c"2 32 16 9 imageSize 64 8 6 object\00", align 1
 
 ; Function Attrs: noinline sanitize_address ssp uwtable
 define internal i8* @"\01+[MyObject doWithSize:]"(i8* %self, i8* %_cmd, [2 x double] %imageSize.coerce) #0 !dbg !14 {
@@ -91,7 +91,7 @@ entry:
   store i64 1102416563, i64* %6, !dbg !35
   %7 = add i64 %1, 8, !dbg !35
   %8 = inttoptr i64 %7 to i64*, !dbg !35
-  store i64 ptrtoint ([34 x i8]* @__asan_gen_ to i64), i64* %8, !dbg !35
+  store i64 ptrtoint ([34 x i8]* @___asan_gen_ to i64), i64* %8, !dbg !35
   %9 = add i64 %1, 16, !dbg !35
   %10 = inttoptr i64 %9 to i64*, !dbg !35
   store i64 ptrtoint (i8* (i8*, i8*, [2 x double])* @"\01+[MyObject doWithSize:]" to i64), i64* %10, !dbg !35
index 6538f0c..9e3c25e 100644 (file)
@@ -15,9 +15,9 @@ target triple = "i686-pc-win32"
 
 @c = global { i8, [63 x i8] } { i8 42, [63 x i8] zeroinitializer }, align 32
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }]
-@__asan_gen_ = private constant [7 x i8] c"asan.c\00", align 1
-@__asan_gen_1 = private unnamed_addr constant [2 x i8] c"c\00", align 1
-@0 = internal global [1 x { i32, i32, i32, i32, i32, i32 }] [{ i32, i32, i32, i32, i32, i32 } { i32 ptrtoint ({ i8, [63 x i8] }* @c to i32), i32 1, i32 64, i32 ptrtoint ([2 x i8]* @__asan_gen_1 to i32), i32 ptrtoint ([7 x i8]* @__asan_gen_ to i32), i32 0 }]
+@___asan_gen_ = private constant [7 x i8] c"asan.c\00", align 1
+@___asan_gen_1 = private unnamed_addr constant [2 x i8] c"c\00", align 1
+@0 = internal global [1 x { i32, i32, i32, i32, i32, i32 }] [{ i32, i32, i32, i32, i32, i32 } { i32 ptrtoint ({ i8, [63 x i8] }* @c to i32), i32 1, i32 64, i32 ptrtoint ([2 x i8]* @___asan_gen_1 to i32), i32 ptrtoint ([7 x i8]* @___asan_gen_ to i32), i32 0 }]
 @llvm.global_dtors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_dtor }]
 
 define internal void @asan.module_ctor() {
index 5c5a1c1..c6143a5 100644 (file)
@@ -54,8 +54,8 @@
 
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }]
 @__asan_option_detect_stack_use_after_return = external global i32
-@__asan_gen_ = private unnamed_addr constant [11 x i8] c"1 32 8 1 A\00", align 1
-@__asan_gen_1 = private unnamed_addr constant [13 x i8] c"1 32 1 3 tmp\00", align 1
+@___asan_gen_ = private unnamed_addr constant [11 x i8] c"1 32 8 1 A\00", align 1
+@___asan_gen_1 = private unnamed_addr constant [13 x i8] c"1 32 1 3 tmp\00", align 1
 
 ; Function Attrs: noreturn sanitize_address
 define i32 @_Z3fn1v() #0 !dbg !22 {
@@ -78,7 +78,7 @@ entry:
   store i64 1102416563, i64* %9, !dbg !39
   %10 = add i64 %6, 8, !dbg !39
   %11 = inttoptr i64 %10 to i64*, !dbg !39
-  store i64 ptrtoint ([11 x i8]* @__asan_gen_ to i64), i64* %11, !dbg !39
+  store i64 ptrtoint ([11 x i8]* @___asan_gen_ to i64), i64* %11, !dbg !39
   %12 = add i64 %6, 16, !dbg !39
   %13 = inttoptr i64 %12 to i64*, !dbg !39
   store i64 ptrtoint (i32 ()* @_Z3fn1v to i64), i64* %13, !dbg !39
@@ -136,7 +136,7 @@ entry:
   store i64 1102416563, i64* %9, !dbg !48
   %10 = add i64 %6, 8, !dbg !48
   %11 = inttoptr i64 %10 to i64*, !dbg !48
-  store i64 ptrtoint ([13 x i8]* @__asan_gen_1 to i64), i64* %11, !dbg !48
+  store i64 ptrtoint ([13 x i8]* @___asan_gen_1 to i64), i64* %11, !dbg !48
   %12 = add i64 %6, 16, !dbg !48
   %13 = inttoptr i64 %12 to i64*, !dbg !48
   store i64 ptrtoint (void (%struct.C*)* @_ZN1C5m_fn3Ev to i64), i64* %13, !dbg !48
index f16f76f..e95fa7b 100644 (file)
@@ -20,7 +20,7 @@ target triple = "x86_64-unknown-linux-gnu"
 @__asan_mapping_offset = linkonce_odr constant i64 2147450880
 @__asan_mapping_scale = linkonce_odr constant i64 3
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }]
-@__asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 5 .addr \00", align 1
+@___asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 5 .addr \00", align 1
 
 ; Function Attrs: sanitize_address uwtable
 define void @_Z4funci(%struct.A* noalias sret %agg.result, i32) #0 "stack-protector-buffer-size"="1" !dbg !4 {
@@ -33,7 +33,7 @@ entry:
   store i64 1102416563, i64* %4
   %5 = add i64 %1, 8
   %6 = inttoptr i64 %5 to i64*
-  store i64 ptrtoint ([16 x i8]* @__asan_gen_ to i64), i64* %6
+  store i64 ptrtoint ([16 x i8]* @___asan_gen_ to i64), i64* %6
   %7 = add i64 %1, 16
   %8 = inttoptr i64 %7 to i64*
   store i64 ptrtoint (void (%struct.A*, i32)* @_Z4funci to i64), i64* %8
index a7d9512..3e54035 100644 (file)
@@ -48,7 +48,7 @@ target triple = "x86_64-unknown-linux-gnu"
 
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }]
 @__asan_option_detect_stack_use_after_return = external global i32
-@__asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 6 y.addr\00", align 1
+@___asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 6 y.addr\00", align 1
 
 ; Function Attrs: nounwind sanitize_address uwtable
 define i32 @_Z3bari(i32 %y) #0 !dbg !4 {
@@ -71,7 +71,7 @@ entry:
   store i64 1102416563, i64* %9
   %10 = add i64 %6, 8
   %11 = inttoptr i64 %10 to i64*
-  store i64 ptrtoint ([16 x i8]* @__asan_gen_ to i64), i64* %11
+  store i64 ptrtoint ([16 x i8]* @___asan_gen_ to i64), i64* %11
   %12 = add i64 %6, 16
   %13 = inttoptr i64 %12 to i64*
   store i64 ptrtoint (i32 (i32)* @_Z3bari to i64), i64* %13
index 82fb2f0..f20977f 100644 (file)
@@ -5,5 +5,5 @@
 @__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer
 
 ; CHECK-DAG: @asan.module_ctor
-; CHECK-NOT: @__asan_gen{{.*}}__llvm_gcov_ctr
-; CHECK-NOT: @__asan_gen{{.*}}__profc_test
+; CHECK-NOT: @___asan_gen{{.*}}__llvm_gcov_ctr
+; CHECK-NOT: @___asan_gen{{.*}}__profc_test
index da301ac..ec3d4b6 100644 (file)
@@ -18,9 +18,9 @@ target triple = "x86_64-unknown-linux-gnu"
 ; CHECK: @.str = internal unnamed_addr constant { [14 x i8], [50 x i8] } { [14 x i8] c"Hello, world!\00", [50 x i8] zeroinitializer }, comdat($".str${{[01-9a-f]+}}"), align 32
 
 ; Check emitted location descriptions:
-; CHECK: [[VARNAME:@__asan_gen_.[0-9]+]] = private unnamed_addr constant [7 x i8] c"global\00", align 1
-; CHECK: [[FILENAME:@__asan_gen_.[0-9]+]] = private unnamed_addr constant [22 x i8] c"/tmp/asan-globals.cpp\00", align 1
-; CHECK: [[LOCDESCR:@__asan_gen_.[0-9]+]] = private unnamed_addr constant { [22 x i8]*, i32, i32 } { [22 x i8]* [[FILENAME]], i32 5, i32 5 }
+; CHECK: [[VARNAME:@___asan_gen_.[0-9]+]] = private unnamed_addr constant [7 x i8] c"global\00", align 1
+; CHECK: [[FILENAME:@___asan_gen_.[0-9]+]] = private unnamed_addr constant [22 x i8] c"/tmp/asan-globals.cpp\00", align 1
+; CHECK: [[LOCDESCR:@___asan_gen_.[0-9]+]] = private unnamed_addr constant { [22 x i8]*, i32, i32 } { [22 x i8]* [[FILENAME]], i32 5, i32 5 }
 ; CHECK: @__asan_global_global = {{.*}}i64 ptrtoint ({ i32, [60 x i8] }* @global to i64){{.*}} section "asan_globals"{{.*}}, !associated
 ; CHECK: @__asan_global_.str = {{.*}}i64 ptrtoint ({ [14 x i8], [50 x i8] }* @.str to i64){{.*}} section "asan_globals"{{.*}}, !associated
 
index bf16e9c..76f7377 100644 (file)
@@ -18,9 +18,9 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 ; CHECK: @.str = internal unnamed_addr constant { [14 x i8], [50 x i8] } { [14 x i8] c"Hello, world!\00", [50 x i8] zeroinitializer }{{.*}}, align 32
 
 ; Check emitted location descriptions:
-; CHECK: [[VARNAME:@__asan_gen_.[0-9]+]] = private unnamed_addr constant [7 x i8] c"global\00", align 1
-; CHECK: [[FILENAME:@__asan_gen_.[0-9]+]] = private unnamed_addr constant [22 x i8] c"/tmp/asan-globals.cpp\00", align 1
-; CHECK: [[LOCDESCR:@__asan_gen_.[0-9]+]] = private unnamed_addr constant { [22 x i8]*, i32, i32 } { [22 x i8]* [[FILENAME]], i32 5, i32 5 }
+; CHECK: [[VARNAME:@___asan_gen_.[0-9]+]] = private unnamed_addr constant [7 x i8] c"global\00", align 1
+; CHECK: [[FILENAME:@___asan_gen_.[0-9]+]] = private unnamed_addr constant [22 x i8] c"/tmp/asan-globals.cpp\00", align 1
+; CHECK: [[LOCDESCR:@___asan_gen_.[0-9]+]] = private unnamed_addr constant { [22 x i8]*, i32, i32 } { [22 x i8]* [[FILENAME]], i32 5, i32 5 }
 
 ; Check that location descriptors and global names were passed into __asan_register_globals:
 ; CHECK: i64 ptrtoint ([7 x i8]* [[VARNAME]] to i64)
index 5ca5dd6..5631572 100644 (file)
@@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gnu"
 ; If a global is present, __asan_[un]register_globals should be called from
 ; module ctor/dtor
 
-; CHECK: @__asan_gen_ = private constant [8 x i8] c"<stdin>\00", align 1
+; CHECK: @___asan_gen_ = private constant [8 x i8] c"<stdin>\00", align 1
 ; CHECK: llvm.global_ctors
 ; CHECK: llvm.global_dtors