diff options
author | Richard Henderson <rth@redhat.com> | 1999-07-29 21:39:01 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 1999-07-29 21:39:01 +0000 |
commit | c9b3cbf33cce90603516003ad3eb8f27488331f1 (patch) | |
tree | 3d307000f2167e06f06b4bc6809bfd8df0b840cd /bfd | |
parent | b77ad1d4c9165935726e6d9a90bc42d5e2a876ed (diff) | |
download | gdb-c9b3cbf33cce90603516003ad3eb8f27488331f1.zip gdb-c9b3cbf33cce90603516003ad3eb8f27488331f1.tar.gz gdb-c9b3cbf33cce90603516003ad3eb8f27488331f1.tar.bz2 |
* elf32-mips.c (mips_info_to_howto_rel): Split out switch to ...
(mips_rtype_to_howto): ... new function.
(_bfd_mips_elf_relocate_section): Use it.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-mips.c | 39 |
2 files changed, 31 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cc75ae3..475c97c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +1999-07-29 Richard Henderson <rth@cygnus.com> + + * elf32-mips.c (mips_info_to_howto_rel): Split out switch to ... + (mips_rtype_to_howto): ... new function. + (_bfd_mips_elf_relocate_section): Use it. + 1999-07-28 Mark Mitchell <mark@codesourcery.com> * elf32-mips.c (_bfd_mips_elf_relocate_section): Fix typo. diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 35ebaa5..34a2a7e 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -98,6 +98,8 @@ static bfd_reloc_status_type mips32_64bit_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +static reloc_howto_type *mips_rtype_to_howto + PARAMS ((unsigned int)); static void mips_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); static void mips_info_to_howto_rela @@ -1890,35 +1892,44 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ -static void -mips_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf32_Internal_Rel *dst; +static reloc_howto_type * +mips_rtype_to_howto (r_type) + unsigned int r_type; { - unsigned int r_type; - - r_type = ELF32_R_TYPE (dst->r_info); switch (r_type) { case R_MIPS16_26: - cache_ptr->howto = &elf_mips16_jump_howto; + return &elf_mips16_jump_howto; break; case R_MIPS16_GPREL: - cache_ptr->howto = &elf_mips16_gprel_howto; + return &elf_mips16_gprel_howto; break; case R_MIPS_GNU_VTINHERIT: - cache_ptr->howto = &elf_mips_gnu_vtinherit_howto; + return &elf_mips_gnu_vtinherit_howto; break; case R_MIPS_GNU_VTENTRY: - cache_ptr->howto = &elf_mips_gnu_vtentry_howto; + return &elf_mips_gnu_vtentry_howto; break; default: BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); - cache_ptr->howto = &elf_mips_howto_table[r_type]; + return &elf_mips_howto_table[r_type]; break; } +} + +/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */ + +static void +mips_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd; + arelent *cache_ptr; + Elf32_Internal_Rel *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + cache_ptr->howto = mips_rtype_to_howto (r_type); /* The addend for a GPREL16 or LITERAL relocation comes from the GP value for the object file. We get the addend now, rather than @@ -6461,7 +6472,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, stored value is sign-extended to 64 bits. */ howto = elf_mips_howto_table + R_MIPS_32; else - howto = elf_mips_howto_table + r_type; + howto = mips_rtype_to_howto (r_type); if (!use_saved_addend_p) { |