Quick fix data/bss detection in TSan.

The old way breaks when a module's bss is adjacent to the [heap] vm area.
Both ways are not very reliable, though.

llvm-svn: 164772
This commit is contained in:
Evgeniy Stepanov 2012-09-27 13:20:40 +00:00
parent 9aabaa39d6
commit f7f616ba66
1 changed files with 4 additions and 1 deletions

View File

@ -153,7 +153,10 @@ static void InitDataSeg() {
while (proc_maps.Next(&start, &end, &offset, name, ARRAY_SIZE(name))) {
DPrintf("%p-%p %p %s\n", start, end, offset, name);
bool is_data = offset != 0 && name[0] != 0;
bool is_bss = offset == 0 && name[0] == 0 && prev_is_data;
// BSS may get merged with [heap] in /proc/self/maps. This is not very
// reliable.
bool is_bss = offset == 0 &&
(name[0] == 0 || internal_strcmp(name, "[heap]") == 0) && prev_is_data;
if (g_data_start == 0 && is_data)
g_data_start = start;
if (is_bss)