From 7f3dd14a90f243f471dab01cfcbcf2bb9c4c950e Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 18 Jul 2018 22:23:14 +0000 Subject: [PATCH] Rename __asan_gen_* symbols to ___asan_gen_*. 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 --- lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 +- test/DebugInfo/AArch64/asan-stack-vars.ll | 4 ++-- test/DebugInfo/COFF/asan-module-without-functions.ll | 6 +++--- test/DebugInfo/Generic/incorrect-variable-debugloc.ll | 8 ++++---- test/DebugInfo/X86/dbg_value_direct.ll | 4 ++-- test/DebugInfo/X86/debug-loc-asan.ll | 4 ++-- .../do-not-instrument-profiling-globals.ll | 4 ++-- test/Instrumentation/AddressSanitizer/global_metadata.ll | 6 +++--- .../AddressSanitizer/global_metadata_array.ll | 6 +++--- .../Instrumentation/AddressSanitizer/instrument_global.ll | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index b33cc5e7c2e..b3f65919455 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -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_"; diff --git a/test/DebugInfo/AArch64/asan-stack-vars.ll b/test/DebugInfo/AArch64/asan-stack-vars.ll index e7733f4b86d..5db46065476 100644 --- a/test/DebugInfo/AArch64/asan-stack-vars.ll +++ b/test/DebugInfo/AArch64/asan-stack-vars.ll @@ -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 diff --git a/test/DebugInfo/COFF/asan-module-without-functions.ll b/test/DebugInfo/COFF/asan-module-without-functions.ll index 6538f0cd6d4..9e3c25e80a8 100644 --- a/test/DebugInfo/COFF/asan-module-without-functions.ll +++ b/test/DebugInfo/COFF/asan-module-without-functions.ll @@ -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() { diff --git a/test/DebugInfo/Generic/incorrect-variable-debugloc.ll b/test/DebugInfo/Generic/incorrect-variable-debugloc.ll index 5c5a1c1c175..c6143a53649 100644 --- a/test/DebugInfo/Generic/incorrect-variable-debugloc.ll +++ b/test/DebugInfo/Generic/incorrect-variable-debugloc.ll @@ -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 diff --git a/test/DebugInfo/X86/dbg_value_direct.ll b/test/DebugInfo/X86/dbg_value_direct.ll index f16f76f1f62..e95fa7b28a4 100644 --- a/test/DebugInfo/X86/dbg_value_direct.ll +++ b/test/DebugInfo/X86/dbg_value_direct.ll @@ -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 diff --git a/test/DebugInfo/X86/debug-loc-asan.ll b/test/DebugInfo/X86/debug-loc-asan.ll index a7d95128aa1..3e54035b7d7 100644 --- a/test/DebugInfo/X86/debug-loc-asan.ll +++ b/test/DebugInfo/X86/debug-loc-asan.ll @@ -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 diff --git a/test/Instrumentation/AddressSanitizer/do-not-instrument-profiling-globals.ll b/test/Instrumentation/AddressSanitizer/do-not-instrument-profiling-globals.ll index 82fb2f0d2f7..f20977fc988 100644 --- a/test/Instrumentation/AddressSanitizer/do-not-instrument-profiling-globals.ll +++ b/test/Instrumentation/AddressSanitizer/do-not-instrument-profiling-globals.ll @@ -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 diff --git a/test/Instrumentation/AddressSanitizer/global_metadata.ll b/test/Instrumentation/AddressSanitizer/global_metadata.ll index da301acd1e4..ec3d4b680f9 100644 --- a/test/Instrumentation/AddressSanitizer/global_metadata.ll +++ b/test/Instrumentation/AddressSanitizer/global_metadata.ll @@ -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 diff --git a/test/Instrumentation/AddressSanitizer/global_metadata_array.ll b/test/Instrumentation/AddressSanitizer/global_metadata_array.ll index bf16e9ca0ac..76f73778f0f 100644 --- a/test/Instrumentation/AddressSanitizer/global_metadata_array.ll +++ b/test/Instrumentation/AddressSanitizer/global_metadata_array.ll @@ -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) diff --git a/test/Instrumentation/AddressSanitizer/instrument_global.ll b/test/Instrumentation/AddressSanitizer/instrument_global.ll index 5ca5dd68328..5631572d93d 100644 --- a/test/Instrumentation/AddressSanitizer/instrument_global.ll +++ b/test/Instrumentation/AddressSanitizer/instrument_global.ll @@ -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"\00", align 1 +; CHECK: @___asan_gen_ = private constant [8 x i8] c"\00", align 1 ; CHECK: llvm.global_ctors ; CHECK: llvm.global_dtors