PR 6992
authorIan Lance Taylor <ian@airs.com>
Sat, 28 Feb 2009 17:53:16 +0000 (17:53 +0000)
committerIan Lance Taylor <ian@airs.com>
Sat, 28 Feb 2009 17:53:16 +0000 (17:53 +0000)
* symtab.cc (Symbol_table::sized_write_section_symbol): In a
relocatable link set the value of the section symbol to zero.
* object.cc (Sized_relobj::do_finalize_local_symbols): In a
relocatable link don't include the section address in the local
symbol value.

gold/ChangeLog
gold/object.cc
gold/symtab.cc

index 3f9d219fb070c5d3eb87696c78624a882622146a..de4597ec872bc10d593ff99717e61b767f0cbf0d 100644 (file)
@@ -1,3 +1,12 @@
+2009-02-28  Ian Lance Taylor  <iant@google.com>
+
+       PR 6992
+       * symtab.cc (Symbol_table::sized_write_section_symbol): In a
+       relocatable link set the value of the section symbol to zero.
+       * object.cc (Sized_relobj::do_finalize_local_symbols): In a
+       relocatable link don't include the section address in the local
+       symbol value.
+
 2009-02-27  Ian Lance Taylor  <iant@google.com>
 
        PR 6811
index 0f618c1ce3e5b36084ff356486595e5f34803337..c70fdce6061e0e33dcb3151726be46ec8e130e37 100644 (file)
@@ -1509,6 +1509,7 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
   const unsigned int loccount = this->local_symbol_count_;
   this->local_symbol_offset_ = off;
 
+  const bool relocatable = parameters->options().relocatable();
   const Output_sections& out_sections(this->output_sections());
   const std::vector<Address>& out_offsets(this->section_offsets_);
   unsigned int shnum = this->shnum();
@@ -1589,7 +1590,7 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
                                + out_offsets[shndx]
                                + lv.input_value());
          else
-           lv.set_output_value(os->address()
+           lv.set_output_value((relocatable ? 0 : os->address())
                                + out_offsets[shndx]
                                + lv.input_value());
        }
index 46bed6892116eb57ebf0dfe6fb6c6ae130fa7c87..d9bb37935daac5cb9c5e0e636c2b6ee846da9e36 100644 (file)
@@ -2693,7 +2693,10 @@ Symbol_table::sized_write_section_symbol(const Output_section* os,
 
   elfcpp::Sym_write<size, big_endian> osym(pov);
   osym.put_st_name(0);
-  osym.put_st_value(os->address());
+  if (parameters->options().relocatable())
+    osym.put_st_value(0);
+  else
+    osym.put_st_value(os->address());
   osym.put_st_size(0);
   osym.put_st_info(elfcpp::elf_st_info(elfcpp::STB_LOCAL,
                                       elfcpp::STT_SECTION));
This page took 0.031728 seconds and 4 git commands to generate.