aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2010-08-26 10:32:26 +0000
committerNathan Sidwell <nathan@codesourcery.com>2010-08-26 10:32:26 +0000
commitcdb21a0a5b4c8b3a437f515879767e24bf38e6e0 (patch)
treebe0cc173cb2f151cd33d61a2980bd9d73effd6bb /bfd/elf32-arm.c
parent8318bd91304e4c71e0b1ba2e684697f1f8ad3afc (diff)
downloadgdb-cdb21a0a5b4c8b3a437f515879767e24bf38e6e0.zip
gdb-cdb21a0a5b4c8b3a437f515879767e24bf38e6e0.tar.gz
gdb-cdb21a0a5b4c8b3a437f515879767e24bf38e6e0.tar.bz2
* elf32-arm.c (elf32_arm_final_link): Process stub sections
exactly once.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r--bfd/elf32-arm.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index f818319..74fb855 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -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. */