aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-05-07 00:16:53 +0000
committerAlan Modra <amodra@gmail.com>2002-05-07 00:16:53 +0000
commitb491616acb5462a3694160ffef6413c160fed10a (patch)
tree2b9faccc50b1905a2a8a3d24e5e8e5c0b8f0ad0a /bfd/elflink.h
parent862eabf1fb427b15a156ce7fc2870dd9351c3509 (diff)
downloadgdb-b491616acb5462a3694160ffef6413c160fed10a.zip
gdb-b491616acb5462a3694160ffef6413c160fed10a.tar.gz
gdb-b491616acb5462a3694160ffef6413c160fed10a.tar.bz2
* elf-bfd.h (struct elf_backend_data): Add rela_normal.
* elfxx-target.h (elf_backend_rela_normal): Define. (elfNN_bed): Init rela_normal. * elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment for section symbols here if rela_normal. Simplify abs section test. * elf-m10200.c (mn10200_elf_relocate_section): If relocatable, return immediately. Remove code handling relocatable linking. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf-m10200.c (elf_backend_rela_normal): Define. * elf-m10300.c (elf_backend_rela_normal): Define. * elf32-fr30.c (elf_backend_rela_normal): Define. * elf32-i370.c (elf_backend_rela_normal): Define. * elf32-i860.c (elf_backend_rela_normal): Define. * elf32-m68k.c (elf_backend_rela_normal): Define. * elf32-mcore.c (elf_backend_rela_normal): Define. * elf32-openrisc.c (elf_backend_rela_normal): Define. * elf32-ppc.c (elf_backend_rela_normal): Define. * elf32-s390.c (elf_backend_rela_normal): Define. * elf32-xstormy16.c (elf_backend_rela_normal): Define. * elf64-ppc.c (elf_backend_rela_normal): Define. * elf64-s390.c (elf_backend_rela_normal): Define. * elf64-x86-64.c (elf_backend_rela_normal): Define. * elfxx-ia64.c (elf_backend_rela_normal): Define. * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL. * elf32-m32r.c (elf_backend_rela_normal): Likewise.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 37b2150..bfe6374 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -6754,6 +6754,12 @@ elf_link_input_bfd (finfo, input_bfd)
void (*reloc_emitter) PARAMS ((bfd *, asection *,
Elf_Internal_Shdr *,
Elf_Internal_Rela *));
+ boolean rela_normal;
+
+ input_rel_hdr = &elf_section_data (o)->rel_hdr;
+ rela_normal = (bed->rela_normal
+ && (input_rel_hdr->sh_entsize
+ == sizeof (Elf_External_Rela)));
/* Adjust the reloc addresses and symbol indices. */
@@ -6827,10 +6833,9 @@ elf_link_input_bfd (finfo, input_bfd)
processor specific section. If we have
discarded a section, the output_section will
be the absolute section. */
- if (sec != NULL
- && (bfd_is_abs_section (sec)
- || (sec->output_section != NULL
- && bfd_is_abs_section (sec->output_section))))
+ if (bfd_is_abs_section (sec)
+ || (sec != NULL
+ && bfd_is_abs_section (sec->output_section)))
r_symndx = 0;
else if (sec == NULL || sec->owner == NULL)
{
@@ -6842,6 +6847,11 @@ elf_link_input_bfd (finfo, input_bfd)
r_symndx = sec->output_section->target_index;
BFD_ASSERT (r_symndx != 0);
}
+
+ /* Adjust the addend according to where the
+ section winds up in the output section. */
+ if (rela_normal)
+ irela->r_addend += sec->output_offset;
}
else
{
@@ -6900,7 +6910,6 @@ elf_link_input_bfd (finfo, input_bfd)
else
reloc_emitter = elf_link_output_relocs;
- input_rel_hdr = &elf_section_data (o)->rel_hdr;
(*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs);
input_rel_hdr = elf_section_data (o)->rel_hdr2;