fagensden / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

macho_reader.cc lacks support for S_THREAD_LOCAL_ZEROFILL #641

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Consider this trivial program:

int main(int argc, const char * argv[]) {
    static __thread int var = 0;
    return var;
}

When I compile it and run dump_syms against it, I get the following error:
    the section '__thread_bss' in segment '__DATA' claims its contents lie outside the segment's contents

I debugged through dump_syms to discover that the problematic segment has 
section.flags == 0x12, which is S_THREAD_LOCAL_ZEROFILL. I see that 
macho_reader.cc WalkSegmentSections has support for S_ZEROFILL but not 
S_THREAD_LOCAL_ZEROFILL.

If I make the following obvious change, it solves the problem for me:

Before:
    if ((section.flags & SECTION_TYPE) == S_ZEROFILL) {
After:
    if ((section.flags & SECTION_TYPE) == S_ZEROFILL ||
        (section.flags & SECTION_TYPE) == S_THREAD_LOCAL_ZEROFILL) {

Environment: MacOS X 10.9.5, Xcode 6.1, Breakpad SVN rev 1419

Original issue reported on code.google.com by cjdo...@gmail.com on 26 Feb 2015 at 8:44