PR ld/10047
[deliverable/binutils-gdb.git] / bfd / elf32-xtensa.c
index 3463efa8c3480d58d19765f3724facf46adb65f7..0315c2ff4f49b7a12052fadc03333e7e2cc42a9c 100644 (file)
@@ -1087,8 +1087,13 @@ elf_xtensa_check_relocs (bfd *abfd,
        {
          if (is_plt)
            {
-             h->plt.refcount += 1;
-             h->needs_plt = 1;
+             if (h->plt.refcount <= 0)
+               {
+                 h->needs_plt = 1;
+                 h->plt.refcount = 1;
+               }
+             else
+               h->plt.refcount += 1;
 
              /* Keep track of the total PLT relocation count even if we
                 don't yet know whether the dynamic sections will be
@@ -1102,7 +1107,12 @@ elf_xtensa_check_relocs (bfd *abfd,
                }
            }
          else if (is_got)
-           h->got.refcount += 1;
+           {
+             if (h->got.refcount <= 0)
+               h->got.refcount = 1;
+             else
+               h->got.refcount += 1;
+           }
 
          if (is_tlsfunc)
            eh->tlsfunc_refcount += 1;
@@ -5468,12 +5478,20 @@ text_action_add (text_action_list *l,
   for (m_p = &l->head; *m_p && (*m_p)->offset <= offset; m_p = &(*m_p)->next)
     {
       text_action *t = *m_p;
-      /* When the action is another fill at the same address,
-        just increase the size.  */
-      if (t->offset == offset && t->action == ta_fill && action == ta_fill)
+      
+      if (action == ta_fill) 
        {
-         t->removed_bytes += removed;
-         return;
+         /* When the action is another fill at the same address,
+            just increase the size.  */
+         if (t->offset == offset && t->action == ta_fill)
+           {
+             t->removed_bytes += removed;
+             return;
+           }
+         /* Fills need to happen before widens so that we don't
+            insert fill bytes into the instruction stream.  */
+         if (t->offset == offset && t->action == ta_widen_insn)
+           break;
        }
     }
 
@@ -9997,12 +10015,7 @@ relax_property_section (bfd *abfd,
          if (remove_this_rel)
            {
              offset_rel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
-             /* In case this is the last entry, move the relocation offset
-                to the previous entry, if there is one.  */
-             if (offset_rel->r_offset >= bytes_to_remove)
-               offset_rel->r_offset -= bytes_to_remove;
-             else
-               offset_rel->r_offset = 0;
+             offset_rel->r_offset = 0;
            }
 
          if (bytes_to_remove != 0)
This page took 0.024372 seconds and 4 git commands to generate.