Eliminate literal line numbers in ending-run.exp
[deliverable/binutils-gdb.git] / gold / dwarf_reader.cc
index a628c546408bdb144c7dcc47b138adcc7bca1d00..30aea10f5c7591d1fb9ac73a8409f4252d6bea3e 100644 (file)
@@ -1,6 +1,6 @@
 // dwarf_reader.cc -- parse dwarf2/3 debug information
 
-// Copyright 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2007-2014 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -505,13 +505,11 @@ Dwarf_pubnames_table::read_section(Relobj* object, const unsigned char* symtab,
       if (strcmp(section_name_suffix, name) == 0)
         {
           shndx = i;
-          this->output_section_offset_ = object->output_section_offset(i);
           break;
         }
       else if (strcmp(section_name_suffix, gnu_name) == 0)
         {
           shndx = i;
-          this->output_section_offset_ = object->output_section_offset(i);
           this->is_gnu_style_ = true;
           break;
         }
@@ -560,11 +558,6 @@ Dwarf_pubnames_table::read_header(off_t offset)
   // Make sure we have actually read the section.
   gold_assert(this->buffer_ != NULL);
 
-  // Correct the offset.  For incremental update links, we have a
-  // relocated offset that is relative to the output section, but
-  // here we need an offset relative to the input section.
-  offset -= this->output_section_offset_;
-
   if (offset < 0 || offset + 14 >= this->buffer_end_ - this->buffer_)
     return false;
 
@@ -587,6 +580,12 @@ Dwarf_pubnames_table::read_header(off_t offset)
     }
   this->end_of_table_ = pinfo + unit_length;
 
+  // If unit_length is too big, maybe we should reject the whole table,
+  // but in cases we know about, it seems OK to assume that the table
+  // is valid through the actual end of the section.
+  if (this->end_of_table_ > this->buffer_end_)
+    this->end_of_table_ = this->buffer_end_;
+
   // Check the version.
   unsigned int version = this->dwinfo_->read_from_pointer<16>(pinfo);
   pinfo += 2;
This page took 0.030609 seconds and 4 git commands to generate.