[GOLD] Don't assert in powerpc stub_table
authorAlan Modra <amodra@gmail.com>
Thu, 8 Dec 2016 05:38:29 +0000 (16:08 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 8 Dec 2016 11:48:47 +0000 (22:18 +1030)
A branch in a non-exec section that needs a stub can lead to this
assertion.

* powerpc.cc (Powerpc_relobj::stub_table): Return NULL rather
then asserting.

gold/ChangeLog
gold/powerpc.cc

index 8b999092946deecaa26cb7c4f8c2f341bf4a4fc4..38fd9eab54861531ca038c088a60297e6f6e820e 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-08  Alan Modra  <amodra@gmail.com>
+
+       * powerpc.cc (Powerpc_relobj::stub_table): Return NULL rather
+       then asserting.
+
 2016-12-08  Alan Modra  <amodra@gmail.com>
 
        * options.h (--stub-group-multi): Fix typo.
index 068f5ca602addb1382f708deda3a9ed431685638..87cb8bc9fab31df02b6ffedea4cbf8e364bab6ca 100644 (file)
@@ -292,8 +292,8 @@ public:
          = static_cast<Target_powerpc<size, big_endian>*>(
              parameters->sized_target<size, big_endian>());
        unsigned int indx = this->stub_table_index_[shndx];
-       gold_assert(indx < target->stub_tables().size());
-       return target->stub_tables()[indx];
+       if (indx < target->stub_tables().size())
+         return target->stub_tables()[indx];
       }
     return NULL;
   }