From c4722a65a55a98bd8f4d49d2d7b4ac0411b01055 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Mon, 18 Mar 2013 08:04:55 +0000 Subject: [PATCH] [asan] while generating the description of a global variable, emit the module name in a separate field, thus not duplicating this information if every description. This decreases the binary size (observed up to 3%). https://code.google.com/p/address-sanitizer/issues/detail?id=168 . This changes the asan API version. compiler-rt part, llvm-part will follow llvm-svn: 177253 --- compiler-rt/lib/asan/asan_interface_internal.h | 5 +++-- compiler-rt/lib/asan/asan_report.cc | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/asan/asan_interface_internal.h b/compiler-rt/lib/asan/asan_interface_internal.h index 48220e714218..8288d0cb236c 100644 --- a/compiler-rt/lib/asan/asan_interface_internal.h +++ b/compiler-rt/lib/asan/asan_interface_internal.h @@ -25,8 +25,8 @@ extern "C" { // Everytime the asan ABI changes we also change the version number in this // name. Objects build with incompatible asan ABI version // will not link with run-time. - void __asan_init_v1() SANITIZER_INTERFACE_ATTRIBUTE; - #define __asan_init __asan_init_v1 + void __asan_init_v2() SANITIZER_INTERFACE_ATTRIBUTE; + #define __asan_init __asan_init_v2 // This structure describes an instrumented global variable. struct __asan_global { @@ -34,6 +34,7 @@ extern "C" { uptr size; // The original size of the global. uptr size_with_redzone; // The size with the redzone. const char *name; // Name as a C string. + const char *module_name; // Module name as a C string. uptr has_dynamic_init; // Non-zero if the global has dynamic initializer. }; diff --git a/compiler-rt/lib/asan/asan_report.cc b/compiler-rt/lib/asan/asan_report.cc index 8fa42f714005..6359b26865e7 100644 --- a/compiler-rt/lib/asan/asan_report.cc +++ b/compiler-rt/lib/asan/asan_report.cc @@ -208,8 +208,8 @@ bool DescribeAddressRelativeToGlobal(uptr addr, uptr size, // Can it happen? Printf("%p is located %zd bytes inside", (void*)addr, addr - g.beg); } - Printf(" of global variable '%s' (0x%zx) of size %zu\n", - g.name, g.beg, g.size); + Printf(" of global variable '%s' from '%s' (0x%zx) of size %zu\n", + g.name, g.module_name, g.beg, g.size); Printf("%s", d.EndLocation()); PrintGlobalNameIfASCII(g); return true;