Check that we don't set the output section index twice.
authorIan Lance Taylor <iant@google.com>
Wed, 7 Nov 2007 18:29:34 +0000 (18:29 +0000)
committerIan Lance Taylor <iant@google.com>
Wed, 7 Nov 2007 18:29:34 +0000 (18:29 +0000)
gold/output.cc
gold/output.h

index acba77ce4595594ecf3dc7dc83bef192b45d682e..64aa4dc872bd2d5b99ebb4a69cbf5ff879c31a0d 100644 (file)
@@ -992,7 +992,7 @@ Output_section::Output_section(const char* name, elfcpp::Elf_Word type,
     info_(0),
     type_(type),
     flags_(flags),
-    out_shndx_(0),
+    out_shndx_(-1U),
     symtab_index_(0),
     dynsym_index_(0),
     input_sections_(),
index a615a71150eae6f5ff50776353418e8bb0345b42..b6c12456d01584154063a97ed9fe4d9c025e701d 100644 (file)
@@ -1183,12 +1183,18 @@ class Output_section : public Output_data
   // Return the section index in the output file.
   unsigned int
   do_out_shndx() const
-  { return this->out_shndx_; }
+  {
+    gold_assert(this->out_shndx_ != -1U);
+    return this->out_shndx_;
+  }
 
   // Set the output section index.
   void
   do_set_out_shndx(unsigned int shndx)
-  { this->out_shndx_ = shndx; }
+  {
+    gold_assert(this->out_shndx_ == -1U);
+    this->out_shndx_ = shndx;
+  }
 
   // Return the entsize field.
   uint64_t