Line 327... |
Line 327... |
|
|
inline File_read::View*
|
inline File_read::View*
|
File_read::find_view(off_t start, section_size_type size,
|
File_read::find_view(off_t start, section_size_type size,
|
unsigned int byteshift, File_read::View** vshifted) const
|
unsigned int byteshift, File_read::View** vshifted) const
|
{
|
{
|
|
gold_assert(start <= this->size_
|
|
&& (static_cast<unsigned long long>(size)
|
|
<= static_cast<unsigned long long>(this->size_ - start)));
|
|
|
if (vshifted != NULL)
|
if (vshifted != NULL)
|
*vshifted = NULL;
|
*vshifted = NULL;
|
|
|
// If we have the whole file mmapped, and the alignment is right,
|
// If we have the whole file mmapped, and the alignment is right,
|
// we can return it.
|
// we can return it.
|
Line 454... |
Line 458... |
File_read::View*
|
File_read::View*
|
File_read::make_view(off_t start, section_size_type size,
|
File_read::make_view(off_t start, section_size_type size,
|
unsigned int byteshift, bool cache)
|
unsigned int byteshift, bool cache)
|
{
|
{
|
gold_assert(size > 0);
|
gold_assert(size > 0);
|
|
gold_assert(start <= this->size_
|
// Check that start and end of the view are within the file.
|
&& (static_cast<unsigned long long>(size)
|
if (start > this->size_
|
<= static_cast<unsigned long long>(this->size_ - start)));
|
|| (static_cast<unsigned long long>(size)
|
|
> static_cast<unsigned long long>(this->size_ - start)))
|
|
gold_fatal(_("%s: attempt to map %lld bytes at offset %lld exceeds "
|
|
"size of file; the file may be corrupt"),
|
|
this->filename().c_str(),
|
|
static_cast<long long>(size),
|
|
static_cast<long long>(start));
|
|
|
|
off_t poff = File_read::page_offset(start);
|
off_t poff = File_read::page_offset(start);
|
|
|
section_size_type psize = File_read::pages(size + (start - poff));
|
section_size_type psize = File_read::pages(size + (start - poff));
|
|
|
Line 521... |
Line 518... |
|
|
File_read::View*
|
File_read::View*
|
File_read::find_or_make_view(off_t offset, off_t start,
|
File_read::find_or_make_view(off_t offset, off_t start,
|
section_size_type size, bool aligned, bool cache)
|
section_size_type size, bool aligned, bool cache)
|
{
|
{
|
|
// Check that start and end of the view are within the file.
|
|
if (start > this->size_
|
|
|| (static_cast<unsigned long long>(size)
|
|
> static_cast<unsigned long long>(this->size_ - start)))
|
|
gold_fatal(_("%s: attempt to map %lld bytes at offset %lld exceeds "
|
|
"size of file; the file may be corrupt"),
|
|
this->filename().c_str(),
|
|
static_cast<long long>(size),
|
|
static_cast<long long>(start));
|
|
|
unsigned int byteshift;
|
unsigned int byteshift;
|
if (offset == 0)
|
if (offset == 0)
|
byteshift = 0;
|
byteshift = 0;
|
else
|
else
|
{
|
{
|