[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
This commit is contained in:
Kostya Serebryany 2013-03-18 08:04:55 +00:00
parent 2bed8472d1
commit c4722a65a5
2 changed files with 5 additions and 4 deletions

View File

@ -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.
};

View File

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