diff options
author | Alan Modra <amodra@gmail.com> | 2002-11-28 11:55:43 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-11-28 11:55:43 +0000 |
commit | 947216bf8f343c1440e85633b5bf2f2394f87bc4 (patch) | |
tree | 3da37461a51d911b0778e071fc9214f5e9ffc2fe /bfd/elf32-sh.c | |
parent | 1448fa32275a8686debba9323308841480c33fc7 (diff) | |
download | gdb-947216bf8f343c1440e85633b5bf2f2394f87bc4.zip gdb-947216bf8f343c1440e85633b5bf2f2394f87bc4.tar.gz gdb-947216bf8f343c1440e85633b5bf2f2394f87bc4.tar.bz2 |
include/elf/ChangeLog
* internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr,
elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr,
Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr,
elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr,
Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym,
Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note,
elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel,
elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela,
elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela,
elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn,
Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef,
elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed,
elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux,
elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef,
Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux,
Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux,
Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym,
Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete.
(Elf_Internal_Rel): Delete.
bfd/ChangeLog
* elf-bfd.h: Replace occurrences of Elf32_Internal_* and
Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel
with Elf_Internal_Rela.
* elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h,
elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c,
elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c,
elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c,
elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c,
elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto.
* elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr
throughout instead.
* elf.c (_bfd_elf_no_info_to_howto_rel): Delete.
* elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *.
Remove INLINE keyword.
(elf_swap_reloc_in): Likewise. Also clear r_addend.
(elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand
as a bfd_byte *.
(elf_write_relocs): Consolidate REL and RELA code.
(elf_slurp_reloc_table_from_section): Simplify REL code.
(NAME(_bfd_elf,size_info)): Populate reloc swap entries.
* elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define.
* elflink.h (elf_link_read_relocs_from_section): Consolidate REL and
RELA code.
(elf_link_adjust_relocs): Likewise. Don't malloc space for temp
reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL.
(elf_link_output_relocs): Likewise.
(elf_reloc_link_order): Likewise.
(elf_finish_pointer_linker_section): Likewise.
(struct elf_link_sort_rela): Remove union.
(elf_link_sort_cmp1): Update to suit.
(elf_link_sort_cmp2): Here too.
(elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory
over-allocation for int_rels_per_ext_rel != 1 case.
* elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls.
* elf32-i386.c: Likewise.
* elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out.
* elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c,
elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise.
* elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out.
* elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
elf64-sparc.c, elf64-x86-64.c: Likewise.
* elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out.
* elfxx-mips.c (sort_dynamic_relocs): Likewise for
bfd_elf32_swap_reloc_in.
* elf32-arm.h: Update elf32_arm_info_to_howto calls.
* elf32-mips.c: Likewise for mips_info_to_howto_rel.
(mips_elf64_swap_reloc_in): Zero r_addend.
(mips_elf64_be_swap_reloc_in): Likewise.
(mips_elf64_slurp_one_reloc_table): Simplify.
* elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries.
* elf64-hppa.c (hppa64_elf_size_info): Likewise.
* elf64-sparc.c (sparc64_elf_size_info): Likewise.
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r-- | bfd/elf32-sh.c | 91 |
1 files changed, 42 insertions, 49 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index c7c078c..a3b8cd7 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -4875,6 +4875,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, & ELF_LINK_HASH_DEF_REGULAR) == 0)))) { Elf_Internal_Rela outrel; + bfd_byte *loc; boolean skip, relocate; /* When generating a shared object, these relocations @@ -4948,11 +4949,9 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, } } - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (((Elf32_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); /* If this reloc is against an external symbol, we do not want to fiddle with the addend. Otherwise, we @@ -5106,6 +5105,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (info->shared) { Elf_Internal_Rela outrel; + bfd_byte *loc; if (srelgot == NULL) { @@ -5119,11 +5119,9 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, + off); outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE); outrel.r_addend = relocation; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (((Elf32_External_Rela *) - srelgot->contents) - + srelgot->reloc_count)); - ++srelgot->reloc_count; + loc = srelgot->contents; + loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); } #ifdef INCLUDE_SHMEDIA @@ -5273,6 +5271,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, unsigned short insn; int indx; Elf_Internal_Rela outrel; + bfd_byte *loc; if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_GD_32) { @@ -5378,12 +5377,10 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_addend = relocation - dtpoff_base (info); else outrel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (((Elf32_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); continue; } @@ -5406,7 +5403,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { Elf_Internal_Rela outrel; - Elf32_External_Rela *loc; + bfd_byte *loc; int dr_type, indx; if (srelgot == NULL) @@ -5426,8 +5423,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, else outrel.r_addend = 0; outrel.r_info = ELF32_R_INFO (indx, dr_type); - loc = (Elf32_External_Rela *) srelgot->contents; - loc += srelgot->reloc_count++; + loc = srelgot->contents; + loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); if (r_type == R_SH_TLS_GD_32) @@ -5445,9 +5442,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_offset += 4; outrel.r_addend = 0; srelgot->reloc_count++; - loc++; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - loc); + loc += sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); } } @@ -5578,7 +5574,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { Elf_Internal_Rela outrel; - Elf32_External_Rela *loc; + bfd_byte *loc; srelgot = htab->srelgot; if (srelgot == NULL) @@ -5588,8 +5584,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, + sgot->output_offset + off); outrel.r_addend = 0; outrel.r_info = ELF32_R_INFO (0, R_SH_TLS_DTPMOD32); - loc = (Elf32_External_Rela *) srelgot->contents; - loc += srelgot->reloc_count++; + loc = srelgot->contents; + loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); htab->tls_ldm_got.offset |= 1; } @@ -5604,6 +5600,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, { int indx; Elf_Internal_Rela outrel; + bfd_byte *loc; if (sreloc == NULL) { @@ -5634,12 +5631,10 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_addend = relocation - dtpoff_base (info); else outrel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (((Elf32_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); continue; } else @@ -5652,6 +5647,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, { int indx; Elf_Internal_Rela outrel; + bfd_byte *loc; if (sreloc == NULL) { @@ -5682,12 +5678,10 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_addend = relocation - dtpoff_base (info); else outrel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (((Elf32_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); continue; } } @@ -6877,6 +6871,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) bfd_vma plt_index; bfd_vma got_offset; Elf_Internal_Rela rel; + bfd_byte *loc; /* This symbol has an entry in the procedure linkage table. Set it up. */ @@ -6996,9 +6991,8 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) #ifdef GOT_BIAS rel.r_addend = GOT_BIAS; #endif - bfd_elf32_swap_reloca_out (output_bfd, &rel, - ((Elf32_External_Rela *) srel->contents - + plt_index)); + loc = srel->contents + plt_index * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { @@ -7015,6 +7009,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) asection *sgot; asection *srel; Elf_Internal_Rela rel; + bfd_byte *loc; /* This symbol has an entry in the global offset table. Set it up. */ @@ -7050,10 +7045,9 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) rel.r_addend = 0; } - bfd_elf32_swap_reloca_out (output_bfd, &rel, - ((Elf32_External_Rela *) srel->contents - + srel->reloc_count)); - ++srel->reloc_count; + loc = srel->contents; + loc += srel->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); } #ifdef INCLUDE_SHMEDIA @@ -7066,6 +7060,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) asection *sgot; asection *srel; Elf_Internal_Rela rel; + bfd_byte *loc; /* This symbol has a datalabel entry in the global offset table. Set it up. */ @@ -7102,10 +7097,9 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) rel.r_addend = 0; } - bfd_elf32_swap_reloca_out (output_bfd, &rel, - ((Elf32_External_Rela *) srel->contents - + srel->reloc_count)); - ++srel->reloc_count; + loc = srel->contents; + loc += srel->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); } } #endif @@ -7114,6 +7108,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) { asection *s; Elf_Internal_Rela rel; + bfd_byte *loc; /* This symbol needs a copy reloc. Set it up. */ @@ -7130,10 +7125,8 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) + h->root.u.def.section->output_offset); rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_COPY); rel.r_addend = 0; - bfd_elf32_swap_reloca_out (output_bfd, &rel, - ((Elf32_External_Rela *) s->contents - + s->reloc_count)); - ++s->reloc_count; + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); } /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ |