PATCH COMMITTED: Fix gold problem with objects with no external symbols
Cary Coutant
ccoutant@google.com
Wed Jun 25 22:02:00 GMT 2008
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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mmap-zero.patch.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20080625/d2d91f26/attachment.txt>
More information about the Binutils
mailing list