This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
The attached patch fixes a gold problem where it would occasionally abort after calling mmap() with a zero size. When reading the symbol table, gold usually reads only the external symbols, and creates a View of the file that maps only the external symbols. If an object file has no external symbols, it will ask for a zero-length View. The File_read class rounds the file offset down to a page boundary, adding the extra padding to the size, so this almost always calls mmap() with a positive size anyway. When we get really unlucky, however, the file offset is already at exactly a page boundary, and we call mmap() with a zero size. I've fixed Sized_relobj::do_read_symbols() to check for the condition and skip creating the View when there are no external symbols, and I've also fixed File_read::make_view() to assert that the size must be greater than zero in order to catch any similar cases more reliably. Approved by Ian offline. -cary 2008-06-25 Cary Coutant <ccoutant@google.com> * fileread.cc (File_read::make_view): Assert on zero-length view. * object.cc (Sized_relobj::do_read_symbols): Don't try to read symbol table when there are no symbols to read.
Attachment:
mmap-zero.patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |