aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-mips.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-07-01 23:20:08 +0000
committerMark Mitchell <mark@codesourcery.com>1999-07-01 23:20:08 +0000
commit23bc299bd87439c2bc1c2a7969b427b06831bfed (patch)
tree833448563442d4678dfc243fd94ac2a4b9567aa6 /bfd/elf32-mips.c
parentb1c5e0ee59631e37ca448958be4d3aa8dc34aec1 (diff)
downloadgdb-23bc299bd87439c2bc1c2a7969b427b06831bfed.zip
gdb-23bc299bd87439c2bc1c2a7969b427b06831bfed.tar.gz
gdb-23bc299bd87439c2bc1c2a7969b427b06831bfed.tar.bz2
* elf-bfd.h (bfd_elf_section_data): Add rel_count and rel_count2
fields. (_bfd_elf_init_reloc_shdr): New function. * elf.c (_bfd_elf_new_section_hook): Use bfd_zalloc, rather than bfd_alloc followed by memset. (_bfd_elf_init_reloc_shdr): New function, split out from ... (elf_fake_sections): Here. (assign_section_numbers): Assign section numbers for the second relocation section, if required. * elflink.h (elf_link_output_relocs): New function. (elf_link_size_reloc_section): Likewise. (elf_bfd_final_link): Use elf_link_size_reloc_section. (elf_link_input_bfd): Use elf_link_output_relocs. * elf32-mips.c (_bfd_mips_elf_fake_sections): Use _bfd_elf_init_reloc_shdr to initialize rel_hdr2.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r--bfd/elf32-mips.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 9585291..50d2f23 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -2788,6 +2788,23 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
hdr->sh_entsize = 8;
}
+ /* The generic elf_fake_sections will set up REL_HDR using the
+ default kind of relocations. But, we may actually need both
+ kinds of relocations, so we set up the second header here. */
+ if ((sec->flags & SEC_RELOC) != 0)
+ {
+ struct bfd_elf_section_data *esd;
+
+ esd = elf_section_data (sec);
+ BFD_ASSERT (esd->rel_hdr2 == NULL);
+ esd->rel_hdr2
+ = (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
+ if (!esd->rel_hdr2)
+ return false;
+ _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec,
+ !elf_section_data (sec)->use_rela_p);
+ }
+
return true;
}