* elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs,
[binutils-gdb.git] / gold / object.h
index 5c70a0c3fb232fccbd2d4fa1b84b7f3cc4d4833e..01c3c6fe2fbfe47a0f7bee08b87228fb5c46d6c0 100644 (file)
@@ -349,7 +349,7 @@ class Object
       this->input_file_->file().remove_object();
   }
 
-  // Return the name of the object as we would report it to the tuser.
+  // Return the name of the object as we would report it to the user.
   const std::string&
   name() const
   { return this->name_; }
@@ -1079,6 +1079,11 @@ class Relobj : public Object
                       unsigned int got_offset)
   { this->do_set_local_got_offset(symndx, got_type, got_offset); }
 
+  // Return whether the local symbol SYMNDX is a TLS symbol.
+  bool
+  local_is_tls(unsigned int symndx) const
+  { return this->do_local_is_tls(symndx); }
+
   // The number of local symbols in the input symbol table.
   virtual unsigned int
   local_symbol_count() const
@@ -1219,6 +1224,16 @@ class Relobj : public Object
   do_get_incremental_reloc_count(unsigned int symndx) const
   { return this->reloc_counts_[symndx]; }
 
+  // Return the word size of the object file.
+  int
+  elfsize() const
+  { return this->do_elfsize(); }
+
+  // Return TRUE if this is a big-endian object file.
+  bool
+  is_big_endian() const
+  { return this->do_is_big_endian(); }
+
  protected:
   // The output section to be used for each input section, indexed by
   // the input section number.  The output section is NULL if the
@@ -1259,6 +1274,10 @@ class Relobj : public Object
   do_set_local_got_offset(unsigned int symndx, unsigned int got_type,
                          unsigned int got_offset) = 0;
 
+  // Return whether local symbol SYMNDX is a TLS symbol.
+  virtual bool
+  do_local_is_tls(unsigned int symndx) const = 0;
+
   // Return the number of local symbols--implemented by child class.
   virtual unsigned int
   do_local_symbol_count() const = 0;
@@ -1377,6 +1396,16 @@ class Relobj : public Object
     return this->reloc_bases_[symndx] + counter;
   }
 
+  // Return the word size of the object file--
+  // implemented by child class.
+  virtual int
+  do_elfsize() const = 0;
+
+  // Return TRUE if this is a big-endian object file--
+  // implemented by child class.
+  virtual bool
+  do_is_big_endian() const = 0;
+
  private:
   // Mapping from input sections to output section.
   Output_sections output_sections_;
@@ -1954,6 +1983,16 @@ class Sized_relobj : public Relobj
       }
   }
 
+  // Return the word size of the object file.
+  virtual int
+  do_elfsize() const
+  { return size; }
+
+  // Return TRUE if this is a big-endian object file.
+  virtual bool
+  do_is_big_endian() const
+  { return big_endian; }
+
  private:
   // The GOT offsets of local symbols. This map also stores GOT offsets
   // for tp-relative offsets for TLS symbols.
@@ -2103,6 +2142,12 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
   void
   set_local_plt_offset(unsigned int symndx, unsigned int plt_offset);
 
+  // Adjust this local symbol value.  Return false if the symbol
+  // should be discarded from the output file.
+  bool
+  adjust_local_symbol(Symbol_value<size>* lv) const
+  { return this->do_adjust_local_symbol(lv); }
+
   // Return the name of the symbol that spans the given offset in the
   // specified section in this object.  This is used only for error
   // messages and is not particularly efficient.
@@ -2116,6 +2161,15 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
   Address
   map_to_kept_section(unsigned int shndx, bool* found) const;
 
+  // Find the section header with the given NAME.  If HDR is non-NULL
+  // then it is a section header returned from a previous call to this
+  // function and the next section header with the same name will be
+  // returned.
+  const unsigned char*
+  find_shdr(const unsigned char* pshdrs, const char* name,
+           const char* names, section_size_type names_size,
+           const unsigned char* hdr) const;
+
   // Compute final local symbol value.  R_SYM is the local symbol index.
   // LV_IN points to a local symbol value containing the input value.
   // LV_OUT points to a local symbol value storing the final output value,
@@ -2157,6 +2211,11 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
   unsigned int
   do_local_plt_offset(unsigned int symndx) const;
 
+  // Return whether local symbol SYMNDX is a TLS symbol.
+  bool
+  do_local_is_tls(unsigned int symndx) const
+  { return this->local_symbol(symndx)->is_tls_symbol(); }
+
   // Return the number of local symbols.
   unsigned int
   do_local_symbol_count() const
@@ -2347,12 +2406,23 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
 
   typedef std::vector<View_size> Views;
 
+  // Stash away info for a number of special sections.
+  // Return true if any of the sections found require local symbols to be read.
+  virtual bool
+  do_find_special_sections(Read_symbols_data* sd);
+
   // This may be overriden by a child class.
   virtual void
   do_relocate_sections(const Symbol_table* symtab, const Layout* layout,
                       const unsigned char* pshdrs, Output_file* of,
                       Views* pviews);
 
+  // Adjust this local symbol value.  Return false if the symbol
+  // should be discarded from the output file.
+  virtual bool
+  do_adjust_local_symbol(Symbol_value<size>*) const
+  { return true; }
+
   // Allow a child to set output local symbol count.
   void
   set_output_local_symbol_count(unsigned int value)
@@ -2485,27 +2555,6 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
                           const Read_relocs_data::Relocs_list::iterator&,
                           Relocatable_relocs*);
 
-  // Emit the relocs for --emit-relocs.
-  void
-  emit_relocs(const Relocate_info<size, big_endian>*, unsigned int,
-             unsigned int sh_type, const unsigned char* prelocs,
-             size_t reloc_count, Output_section*, Address output_offset,
-             unsigned char* view, Address address,
-             section_size_type view_size,
-             unsigned char* reloc_view, section_size_type reloc_view_size);
-
-  // Emit the relocs for --emit-relocs, templatized on the type of the
-  // relocation section.
-  template<int sh_type>
-  void
-  emit_relocs_reltype(const Relocate_info<size, big_endian>*, unsigned int,
-                     const unsigned char* prelocs, size_t reloc_count,
-                     Output_section*, Address output_offset,
-                     unsigned char* view, Address address,
-                     section_size_type view_size,
-                     unsigned char* reloc_view,
-                     section_size_type reloc_view_size);
-
   // Scan the input relocations for --incremental.
   void
   incremental_relocs_scan(const Read_relocs_data::Relocs_list::iterator&);