2009-11-12 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / gold / symtab.h
index ef8e68032bd445e2a4968bfd2b7ab2524b3dad54..544712db9f5e890eb2d1e72a2f7934e00db3dce0 100644 (file)
 // Symbol_table
 //   The symbol table.
 
+#ifndef GOLD_SYMTAB_H
+#define GOLD_SYMTAB_H
+
 #include <string>
 #include <utility>
 #include <vector>
 
-#include "gc.h"
-#include "icf.h"
 #include "elfcpp.h"
 #include "parameters.h"
 #include "stringpool.h"
 #include "object.h"
 
-#ifndef GOLD_SYMTAB_H
-#define GOLD_SYMTAB_H
-
 namespace gold
 {
 
@@ -535,7 +533,7 @@ class Symbol
   // Return true if this symbol is a function that needs a PLT entry.
   // If the symbol is defined in a dynamic object or if it is subject
   // to pre-emption, we need to make a PLT entry. If we're doing a
-  // static link, we don't create PLT entries.
+  // static link or a -pie link, we don't create PLT entries.
   bool
   needs_plt_entry() const
   {
@@ -544,6 +542,7 @@ class Symbol
       return false;
 
     return (!parameters->doing_static_link()
+           && !parameters->options().pie()
             && this->type() == elfcpp::STT_FUNC
             && (this->is_from_dynobj()
                 || this->is_undefined()
@@ -726,6 +725,18 @@ class Symbol
   set_is_forced_local()
   { this->is_forced_local_ = true; }
 
+  // Return true if this may need a COPY relocation.
+  // References from an executable object to non-function symbols
+  // defined in a dynamic object may need a COPY relocation.
+  bool
+  may_need_copy_reloc() const
+  {
+    return (!parameters->options().shared()
+           && parameters->options().copyreloc()
+           && this->is_from_dynobj()
+           && this->type() != elfcpp::STT_FUNC);
+  }
+
  protected:
   // Instances of this class should always be created at a specific
   // size.
@@ -1365,6 +1376,26 @@ class Symbol_table
   finalize(off_t off, off_t dynoff, size_t dyn_global_index, size_t dyncount,
           Stringpool* pool, unsigned int *plocal_symcount);
 
+  // Status code of Symbol_table::compute_final_value.
+  enum Compute_final_value_status
+  {
+    // No error.
+    CFVS_OK,
+    // Unspported symbol section.
+    CFVS_UNSUPPORTED_SYMBOL_SECTION,
+    // No output section.
+    CFVS_NO_OUTPUT_SECTION
+  };
+
+  // Compute the final value of SYM and store status in location PSTATUS.
+  // During relaxation, this may be called multiple times for a symbol to 
+  // compute its would-be final value in each relaxation pass.
+
+  template<int size>
+  typename Sized_symbol<size>::Value_type
+  compute_final_value(const Sized_symbol<size>* sym,
+                     Compute_final_value_status* pstatus) const;
+
   // Write out the global symbols.
   void
   write_globals(const Stringpool*, const Stringpool*,
@@ -1457,6 +1488,11 @@ class Symbol_table
   static bool
   should_override(const Symbol*, unsigned int, Object*, bool*);
 
+  // Report a problem in symbol resolution.
+  static void
+  report_resolve_problem(bool is_error, const char* msg, const Symbol* to,
+                        Object* object);
+
   // Override a symbol.
   template<int size, bool big_endian>
   void
This page took 0.026121 seconds and 4 git commands to generate.