Allow target to adjust dynamic symbol value.
authorCary Coutant <ccoutant@google.com>
Mon, 10 Mar 2014 20:35:53 +0000 (13:35 -0700)
committerCary Coutant <ccoutant@google.com>
Mon, 10 Mar 2014 20:35:53 +0000 (13:35 -0700)
2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* symtab.cc (Symbol_table::sized_write_globals): Allow a target to
adjust dynamic symbol value.
* target.h (Target::adjust_dyn_symbol): New function.
(Target::do_adjust_dyn_symbol): New function.

gold/ChangeLog
gold/symtab.cc
gold/target.h

index c29eb1e2c97af9b0536998a00d578c92c2b69990..21e23d32b787b10160e9d2fa86d473cd84295a12 100644 (file)
@@ -1,3 +1,10 @@
+2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
+
+       * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
+       adjust dynamic symbol value.
+       * target.h (Target::adjust_dyn_symbol): New function.
+       (Target::do_adjust_dyn_symbol): New function.
+
 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
   
        * output.cc (Output_data_dynamic::Dynamic_entry::write):
index 87173b2ea6e98e44a35fabd1772da3a626bbd3d3..2a00d5628462de3f39050cf6a8e331728581420f 100644 (file)
@@ -3012,6 +3012,8 @@ Symbol_table::sized_write_globals(const Stringpool* sympool,
          unsigned char* pd = dynamic_view + (dynsym_index * sym_size);
          this->sized_write_symbol<size, big_endian>(sym, dynsym_value, shndx,
                                                     binding, dynpool, pd);
+          // Allow a target to adjust dynamic symbol value.
+          parameters->target().adjust_dyn_symbol(sym, pd);
        }
     }
 
index bd512501b8f24a49c3ee3bce820a0414e894221f..aaf4b1ccaabb1a01769c7de70c69ff875ad811bd 100644 (file)
@@ -475,6 +475,11 @@ class Target
   dynamic_tag_custom_value(elfcpp::DT tag) const
   { return this->do_dynamic_tag_custom_value(tag); }
 
+  // Adjust the value written to the dynamic symbol table.
+  void
+  adjust_dyn_symbol(const Symbol* sym, unsigned char* view) const
+  { this->do_adjust_dyn_symbol(sym, view); }
+
  protected:
   // This struct holds the constant information for a child class.  We
   // use a struct to avoid the overhead of virtual function calls for
@@ -763,6 +768,11 @@ class Target
   do_dynamic_tag_custom_value(elfcpp::DT) const
   { gold_unreachable(); }
 
+  // This may be overridden by the child class.
+  virtual void
+  do_adjust_dyn_symbol(const Symbol*, unsigned char*) const
+  { }
+
  private:
   // The implementations of the four do_make_elf_object virtual functions are
   // almost identical except for their sizes and endianness.  We use a template.