daily update
[deliverable/binutils-gdb.git] / gold / target.h
index 673153ff9368deb2bd6998ed3d778af4fe7ae4ca..85af8d37c6706201f8a557cc5ac5ba3d57a2f3a9 100644 (file)
@@ -1,6 +1,6 @@
 // target.h -- target support for gold   -*- C++ -*-
 
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -53,8 +53,10 @@ class Symbol;
 template<int size>
 class Sized_symbol;
 class Symbol_table;
+class Output_data;
 class Output_section;
 class Input_objects;
+class Task;
 
 // The abstract class for target specific handling.
 
@@ -71,6 +73,27 @@ class Target
   can_check_for_function_pointers() const
   { return false; }
 
+  // This function is used in ICF (icf.cc).  This is set to true by
+  // the target if a relocation to a merged section can be processed
+  // to retrieve the contents of the merged section.
+  virtual bool
+  can_icf_inline_merge_sections () const
+  { return false; }
+
+  // Whether a section called SECTION_NAME may have function pointers to
+  // sections not eligible for safe ICF folding.
+  virtual bool
+  section_may_have_icf_unsafe_pointers(const char* section_name) const
+  {
+    // We recognize sections for normal vtables, construction vtables and
+    // EH frames.
+    return (!is_prefix_of(".rodata._ZTV", section_name)
+           && !is_prefix_of(".data.rel.ro._ZTV", section_name)
+           && !is_prefix_of(".rodata._ZTC", section_name)
+           && !is_prefix_of(".data.rel.ro._ZTC", section_name)
+           && !is_prefix_of(".eh_frame", section_name));
+  }
+
   // Return the bit size that this target implements.  This should
   // return 32 or 64.
   int
@@ -247,6 +270,26 @@ class Target
   reloc_addend(void* arg, unsigned int type, uint64_t addend) const
   { return this->do_reloc_addend(arg, type, addend); }
 
+  // Return the PLT section to use for a global symbol.  This is used
+  // for STT_GNU_IFUNC symbols.
+  Output_data*
+  plt_section_for_global(const Symbol* sym) const
+  { return this->do_plt_section_for_global(sym); }
+
+  // Return the PLT section to use for a local symbol.  This is used
+  // for STT_GNU_IFUNC symbols.
+  Output_data*
+  plt_section_for_local(const Relobj* object, unsigned int symndx) const
+  { return this->do_plt_section_for_local(object, symndx); }
+
+  // Return true if a reference to SYM from a reloc of type R_TYPE
+  // means that the current function may call an object compiled
+  // without -fsplit-stack.  SYM is known to be defined in an object
+  // compiled without -fsplit-stack.
+  bool
+  is_call_to_non_split(const Symbol* sym, unsigned int r_type) const
+  { return this->do_is_call_to_non_split(sym, r_type); }
+
   // A function starts at OFFSET in section SHNDX in OBJECT.  That
   // function was compiled with -fsplit-stack, but it refers to a
   // function which was compiled without -fsplit-stack.  VIEW is a
@@ -290,13 +333,13 @@ class Target
   // Perform a relaxation pass.  Return true if layout may be changed.
   bool
   relax(int pass, const Input_objects* input_objects, Symbol_table* symtab,
-       Layout* layout)
+       Layout* layout, const Task* task)
   {
     // Run the dummy relaxation pass twice if relaxation debugging is enabled.
     if (is_debugging_enabled(DEBUG_RELAXATION))
       return pass < 2;
 
-    return this->do_relax(pass, input_objects, symtab, layout);
+    return this->do_relax(pass, input_objects, symtab, layout, task);
   } 
 
   // Return the target-specific name of attributes section.  This is
@@ -424,7 +467,7 @@ class Target
   do_adjust_elf_header(unsigned char*, int) const
   { }
 
-  // Virtual function which may be overriden by the child class.
+  // Virtual function which may be overridden by the child class.
   virtual bool
   do_is_local_label_name(const char*) const;
 
@@ -434,12 +477,28 @@ class Target
   do_reloc_symbol_index(void*, unsigned int) const
   { gold_unreachable(); }
 
-  // Virtual function that must be overidden by a target which uses
+  // Virtual function that must be overridden by a target which uses
   // target specific relocations.
   virtual uint64_t
   do_reloc_addend(void*, unsigned int, uint64_t) const
   { gold_unreachable(); }
 
+  // Virtual functions that must be overridden by a target that uses
+  // STT_GNU_IFUNC symbols.
+  virtual Output_data*
+  do_plt_section_for_global(const Symbol*) const
+  { gold_unreachable(); }
+
+  virtual Output_data*
+  do_plt_section_for_local(const Relobj*, unsigned int) const
+  { gold_unreachable(); }
+
+  // Virtual function which may be overridden by the child class.  The
+  // default implementation is that any function not defined by the
+  // ABI is a call to a non-split function.
+  virtual bool
+  do_is_call_to_non_split(const Symbol* sym, unsigned int) const;
+
   // Virtual function which may be overridden by the child class.
   virtual void
   do_calls_non_split(Relobj* object, unsigned int, section_offset_type,
@@ -447,7 +506,7 @@ class Target
                     std::string*, std::string*) const;
 
   // make_elf_object hooks.  There are four versions of these for
-  // different address sizes and endianities.
+  // different address sizes and endianness.
 
   // Set processor specific flags.
   void
@@ -458,46 +517,46 @@ class Target
   }
   
 #ifdef HAVE_TARGET_32_LITTLE
-  // Virtual functions which may be overriden by the child class.
+  // Virtual functions which may be overridden by the child class.
   virtual Object*
   do_make_elf_object(const std::string&, Input_file*, off_t,
                     const elfcpp::Ehdr<32, false>&);
 #endif
 
 #ifdef HAVE_TARGET_32_BIG
-  // Virtual functions which may be overriden by the child class.
+  // Virtual functions which may be overridden by the child class.
   virtual Object*
   do_make_elf_object(const std::string&, Input_file*, off_t,
                     const elfcpp::Ehdr<32, true>&);
 #endif
 
 #ifdef HAVE_TARGET_64_LITTLE
-  // Virtual functions which may be overriden by the child class.
+  // Virtual functions which may be overridden by the child class.
   virtual Object*
   do_make_elf_object(const std::string&, Input_file*, off_t,
                     const elfcpp::Ehdr<64, false>& ehdr);
 #endif
 
 #ifdef HAVE_TARGET_64_BIG
-  // Virtual functions which may be overriden by the child class.
+  // Virtual functions which may be overridden by the child class.
   virtual Object*
   do_make_elf_object(const std::string& name, Input_file* input_file,
                     off_t offset, const elfcpp::Ehdr<64, true>& ehdr);
 #endif
 
-  // Virtual functions which may be overriden by the child class.
+  // Virtual functions which may be overridden by the child class.
   virtual Output_section*
   do_make_output_section(const char* name, elfcpp::Elf_Word type,
                         elfcpp::Elf_Xword flags);
 
-  // Virtual function which may be overriden by the child class.
+  // Virtual function which may be overridden by the child class.
   virtual bool
   do_may_relax() const
   { return parameters->options().relax(); }
 
-  // Virtual function which may be overriden by the child class.
+  // Virtual function which may be overridden by the child class.
   virtual bool
-  do_relax(int, const Input_objects*, Symbol_table*, Layout*)
+  do_relax(int, const Input_objects*, Symbol_table*, Layout*, const Task*)
   { return false; }
 
   // A function for targets to call.  Return whether BYTES/LEN matches
@@ -512,7 +571,7 @@ class Target
   set_view_to_nop(unsigned char* view, section_size_type view_size,
                  section_offset_type offset, size_t len) const;
 
-  // This must be overriden by the child class if it has target-specific
+  // This must be overridden by the child class if it has target-specific
   // attributes subsection in the attribute section. 
   virtual int
   do_attribute_arg_type(int) const
@@ -530,7 +589,7 @@ class Target
 
  private:
   // The implementations of the four do_make_elf_object virtual functions are
-  // almost identical except for their sizes and endianity.  We use a template.
+  // almost identical except for their sizes and endianness.  We use a template.
   // for their implementations.
   template<int size, bool big_endian>
   inline Object*
@@ -673,6 +732,68 @@ class Sized_target : public Target
                           section_size_type view_size,
                           unsigned char* reloc_view,
                           section_size_type reloc_view_size) = 0;
+  // Perform target-specific processing in a relocatable link.  This is
+  // only used if we use the relocation strategy RELOC_SPECIAL.
+  // RELINFO points to a Relocation_info structure. SH_TYPE is the relocation
+  // section type. PRELOC_IN points to the original relocation.  RELNUM is
+  // the index number of the relocation in the relocation section.
+  // OUTPUT_SECTION is the output section to which the relocation is applied.
+  // OFFSET_IN_OUTPUT_SECTION is the offset of the relocation input section
+  // within the output section.  VIEW points to the output view of the
+  // output section.  VIEW_ADDRESS is output address of the view.  VIEW_SIZE
+  // is the size of the output view and PRELOC_OUT points to the new
+  // relocation in the output object.
+  //
+  // A target only needs to override this if the generic code in
+  // target-reloc.h cannot handle some relocation types.
+
+  virtual void
+  relocate_special_relocatable(const Relocate_info<size, big_endian>*
+                               /*relinfo */,
+                              unsigned int /* sh_type */,
+                              const unsigned char* /* preloc_in */,
+                              size_t /* relnum */,
+                              Output_section* /* output_section */,
+                              off_t /* offset_in_output_section */,
+                              unsigned char* /* view */,
+                              typename elfcpp::Elf_types<size>::Elf_Addr
+                                /* view_address */,
+                              section_size_type /* view_size */,
+                              unsigned char* /* preloc_out*/)
+  { gold_unreachable(); }
+  // Return the number of entries in the GOT.  This is only used for
+  // laying out the incremental link info sections.  A target needs
+  // to implement this to support incremental linking.
+
+  virtual unsigned int
+  got_entry_count() const
+  { gold_unreachable(); }
+
+  // Return the number of entries in the PLT.  This is only used for
+  // laying out the incremental link info sections.  A target needs
+  // to implement this to support incremental linking.
+
+  virtual unsigned int
+  plt_entry_count() const
+  { gold_unreachable(); }
+
+  // Return the offset of the first non-reserved PLT entry.  This is
+  // only used for laying out the incremental link info sections.
+  // A target needs to implement this to support incremental linking.
+
+  virtual unsigned int
+  first_plt_entry_offset() const
+  { gold_unreachable(); }
+
+  // Return the size of each PLT entry.  This is only used for
+  // laying out the incremental link info sections.  A target needs
+  // to implement this to support incremental linking.
+
+  virtual unsigned int
+  plt_entry_size() const
+  { gold_unreachable(); }
 
  protected:
   Sized_target(const Target::Target_info* pti)
This page took 0.026452 seconds and 4 git commands to generate.