]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix "overflow in PLT unwind data" warning
authorAlan Modra <amodra@gmail.com>
Thu, 15 May 2014 09:07:43 +0000 (18:37 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 12 Jun 2014 15:29:04 +0000 (00:59 +0930)
When linking statically, it's possible to hit this warning with IFUNC
or very large executables, due to .glink being unused.

* powerpc.cc (do_plt_fde_location): Handle zero length .glink.
Compare FDE contents with DW_CFA_nop rather than 0.

gold/ChangeLog
gold/powerpc.cc

index bbd352777b58505d40079f151b9d83a8bf390644..aa856faac01d79abe523226d6bda77b01c62bd36 100644 (file)
@@ -1,6 +1,10 @@
 2014-06-12  Alan Modra  <amodra@gmail.com>
 
        Backport mainline patches
+       2014-05-15  Alan Modra  <amodra@gmail.com>
+       * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
+       Compare FDE contents with DW_CFA_nop rather than 0.
+
        2014-03-07  Alan Modra  <amodra@gmail.com>
        * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
        CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
index d10977eb11e0ba47abb5e0f88b476c791108351a..7728fb4fc6d2d8462e36924b94a8e8a849e3e434 100644 (file)
@@ -2851,7 +2851,21 @@ Target_powerpc<size, big_endian>::do_plt_fde_location(const Output_data* plt,
   if (plt == this->glink_)
     {
       // See Output_data_glink::do_write() for glink contents.
-      if (size == 64)
+      if (len == 0)
+       {
+         gold_assert(parameters->doing_static_link());
+         // Static linking may need stubs, to support ifunc and long
+         // branches.  We need to create an output section for
+         // .eh_frame early in the link process, to have a place to
+         // attach stub .eh_frame info.  We also need to have
+         // registered a CIE that matches the stub CIE.  Both of
+         // these requirements are satisfied by creating an FDE and
+         // CIE for .glink, even though static linking will leave
+         // .glink zero length.
+         // ??? Hopefully generating an FDE with a zero address range
+         // won't confuse anything that consumes .eh_frame info.
+       }
+      else if (size == 64)
        {
          // There is one word before __glink_PLTresolve
          address += 8;
@@ -2863,7 +2877,7 @@ Target_powerpc<size, big_endian>::do_plt_fde_location(const Output_data* plt,
          // The first covers the branch table, the second
          // __glink_PLTresolve at the end of glink.
          off_t resolve_size = this->glink_->pltresolve_size;
-         if (oview[9] == 0)
+         if (oview[9] == elfcpp::DW_CFA_nop)
            len -= resolve_size;
          else
            {