* elf32-arm.c (elf32_arm_final_link): Process stub sections
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 26 Aug 2010 10:32:26 +0000 (10:32 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Thu, 26 Aug 2010 10:32:26 +0000 (10:32 +0000)
exactly once.

bfd/ChangeLog
bfd/elf32-arm.c

index a84338608850f6ba71630038b4c43f4f9551e56a..003f0920f32fad7138e4f9e40ef1ccbd70268cd8 100644 (file)
@@ -1,3 +1,8 @@
+2010-08-26  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * elf32-arm.c (elf32_arm_final_link): Process stub sections
+       exactly once.
+
 2010-08-25  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/11939
index f81831995a3303fa03d7dd983684daf68dfe518c..74fb85576390c58ff048d8f7c4ec621d7f6809b9 100644 (file)
@@ -9443,16 +9443,19 @@ elf32_arm_final_link (bfd *abfd, struct bfd_link_info *info)
   /* Process stub sections (eg BE8 encoding, ...).  */
   struct elf32_arm_link_hash_table *htab = elf32_arm_hash_table (info);
   int i;
-  for(i=0; i<htab->top_id; i++) {
-    sec = htab->stub_group[i].stub_sec;
-    if (sec) {
-      osec = sec->output_section;
-      elf32_arm_write_section (abfd, info, sec, sec->contents);
-      if (! bfd_set_section_contents (abfd, osec, sec->contents,
-                                     sec->output_offset, sec->size))
-       return FALSE;
+  for (i=0; i<htab->top_id; i++)
+    {
+      sec = htab->stub_group[i].stub_sec;
+      /* Only process it once, in its link_sec slot.  */
+      if (sec && i == htab->stub_group[i].link_sec->id)
+       {
+         osec = sec->output_section;
+         elf32_arm_write_section (abfd, info, sec, sec->contents);
+         if (! bfd_set_section_contents (abfd, osec, sec->contents,
+                                         sec->output_offset, sec->size))
+           return FALSE;
+       }
     }
-  }
 
   /* Write out any glue sections now that we have created all the
      stubs.  */