summaryrefslogtreecommitdiffstats
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-06-02 13:01:04 +0000
committerMark Mitchell <mark@codesourcery.com>1999-06-02 13:01:04 +0000
commitbf572ba0b9deeeba341d197a3412a3c0b44d819f (patch)
treeca0102a08126c8ccfea30b798468cc30711e95a7 /bfd/elfcode.h
parent3fe702fddf7a4fc4eef46bcee1bcfada94e72627 (diff)
downloadppe42-binutils-bf572ba0b9deeeba341d197a3412a3c0b44d819f.tar.gz
ppe42-binutils-bf572ba0b9deeeba341d197a3412a3c0b44d819f.zip
* elf-bfd.h (elf_backend_data): Remove use_rela_p. Add
may_use_rel_p, may_use_rela_p, default_use_rela_p. (bfd_elf_section_data): Add use_rela_p. * elf.c (bfd_section_from_shdr): Set use_rela_p appropriately. (_bfd_elf_new_section_hook): Likewise. (elf_fake_sections): Use may_use_rela_p, etc., instead of use_rela_p. (_bfd_elf_copy_private_section_data): Copy use_rela_p. * elfcode.h (write_relocs): Determine whether or not use rela relocs based on the relocation section header. * elflink.c (_bfd_elf_create_dynamic_sections): Use default_use_rela_p instead of use_rela_p. * elfxx-target.h (elf_backend_may_use_relp): New macro. (elf_backend_may_use_rela_p): Likewise. (elf_backend_default_use_rela_p): Likewise. (elfNN_bed): Use them.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 22f6488628..0426da215e 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -729,7 +729,7 @@ write_relocs (abfd, sec, data)
Elf_External_Rela *outbound_relocas;
Elf_External_Rel *outbound_relocs;
unsigned int idx;
- int use_rela_p = get_elf_backend_data (abfd)->use_rela_p;
+ int use_rela_p;
asymbol *last_sym = 0;
int last_sym_idx = 0;
@@ -757,6 +757,16 @@ write_relocs (abfd, sec, data)
return;
}
+ /* Figure out whether the relocations are RELA or REL relocations. */
+ if (rela_hdr->sh_type == SHT_RELA)
+ use_rela_p = true;
+ else if (rela_hdr->sh_type == SHT_REL)
+ use_rela_p = false;
+ else
+ /* Every relocation section should be either an SHT_RELA or an
+ SHT_REL section. */
+ abort ();
+
/* orelocation has the data, reloc_count has the count... */
if (use_rela_p)
{
OpenPOWER on IntegriCloud