diff options
author | Alan Modra <amodra@gmail.com> | 2007-03-26 12:23:03 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2007-03-26 12:23:03 +0000 |
commit | 157090f728a99fff42b3d3cc576b0c2a953e9916 (patch) | |
tree | bbe325982898fb7e055a3e6669e196a715c5a59b | |
parent | b64703980e50cc8548ad810f992936168d942387 (diff) | |
download | binutils-gdb-157090f728a99fff42b3d3cc576b0c2a953e9916.tar.gz |
* aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define.
* aout-arm.c (MY_bfd_reloc_name_lookup): Define.
(MY (bfd_reloc_name_lookup)): New function.
* aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function.
* aout-target.h (NAME (aout, reloc_name_lookup)): Declare.
(MY_bfd_reloc_name_lookup): Define.
* aout-tic30.c (tic30_aout_reloc_name_lookup): New function.
(MY_bfd_reloc_name_lookup): Define.
* aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare.
(NAME (aout, reloc_name_lookup)): New function.
* bout.c (b_out_bfd_reloc_name_lookup): New function.
* coff-alpha.c (alpha_bfd_reloc_name_lookup): New function.
(_bfd_ecoff_bfd_reloc_name_lookup): Define.
* coff-arm.c (coff_arm_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-i386.c (coff_bfd_reloc_name_lookup): Define.
(coff_i386_reloc_name_lookup): New function.
* coff-i860.c (coff_i860_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-i960.c (coff_i960_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-m68k.c (m68k_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-maxq.c (maxq_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-mcore.c (mcore_coff_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-mips.c (mips_bfd_reloc_name_lookup): New function.
(_bfd_ecoff_bfd_reloc_name_lookup): Define.
* coff-ppc.c (ppc_coff_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-rs6000.c (coff_bfd_reloc_name_lookup): Define.
(_bfd_xcoff_reloc_name_lookup): New function.
(rs6000coff_vec, pmac_xcoff_vec): Init new field.
* coff-sh.c (coff_bfd_reloc_name_lookup): Define.
(sh_coff_reloc_name_lookup): New function.
* coff-sparc.c (coff_sparc_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-tic30.c (coff_bfd_reloc_name_lookup): Define.
(tic30_coff_reloc_name_lookup): New function.
* coff-tic4x.c (coff_bfd_reloc_name_lookup): Define.
(tic4x_coff_reloc_name_lookup): New function.
* coff-tic54x.c (coff_bfd_reloc_name_lookup): Define.
(tic54x_coff_reloc_name_lookup): New function.
* coff-x86_64.c (coff_bfd_reloc_name_lookup): Define.
(coff_amd64_reloc_name_lookup): New function.
* coff-z80.c (coff_z80_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff-z8k.c (coff_z8k_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define.
(xcoff64_reloc_name_lookup): New function.
(rs6000coff64_vec, aix5coff64_vec): Init new field.
* coffcode.h (coff_bfd_reloc_name_lookup): Define.
* elf-hppa.h (elf_hppa_reloc_name_lookup): New function.
* elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-arm.c (elf32_arm_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-cris.c (cris_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-crx.c (elf_crx_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-fr30.c (fr30_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-frv.c (frv_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-h8300.c (elf32_h8_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-i370.c (i370_elf_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-i386.c (elf_i386_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-i860.c (elf32_i860_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-i960.c (elf32_i960_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-ip2k.c (ip2k_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-iq2000.c (iq2000_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-m32c.c (m32c_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-m68k.c (reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-mcore.c (mcore_elf_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-mep.c (mep_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function.
(mips_vxworks_bfd_reloc_name_lookup): Likewise.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-mt.c (mt_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-openrisc.c (openrisc_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elf32-pj.c (pj_elf_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-ppc.c (ppc_elf_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-s390.c (elf_s390_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-score.c (elf32_score_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-sh.c (sh_elf_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-spu.c (spu_elf_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-v850.c (v850_elf_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-vax.c (reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-xc16x.c (xc16x_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function.
(bfd_elf32_bfd_reloc_name_lookup): Define.
* elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function.
(bfd_elf64_bfd_reloc_name_lookup): Define.
* elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define.
* elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define.
* elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function.
* elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function.
* elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function.
(bfd_elf64_bfd_reloc_name_lookup): Define.
* elf64-s390.c (elf_s390_reloc_name_lookup): New function.
(bfd_elf64_bfd_reloc_name_lookup): Define.
* elf64-sh64.c (sh_elf64_reloc_name_lookup): New function.
(bfd_elf64_bfd_reloc_name_lookup): Define.
* elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define.
* elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function.
(bfd_elf64_bfd_reloc_name_lookup): Define.
* elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function.
* elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function.
(bfd_elfNN_bfd_reloc_name_lookup): Define.
* elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function.
* elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare.
* i386msdos.c (msdos_bfd_reloc_name_lookup): Define.
* i386os9k.c (aout_32_bfd_reloc_name_lookup): Define.
* ieee.c (ieee_bfd_reloc_name_lookup): Define.
* libaout.h (NAME (aout, reloc_name_lookup)): Declare.
* libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare.
* mipsbsd.c (MY_bfd_reloc_name_lookup): Define.
(MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup).
(MY(reloc_name_lookup)): New function.
* nlm-target.h (nlm_bfd_reloc_name_lookup): Define.
* oasys.c (oasys_bfd_reloc_name_lookup): Define.
* pdp11.c (NAME (aout, reloc_name_lookup)): New function.
* pe-mips.c (coff_mips_reloc_name_lookup): New function.
(coff_bfd_reloc_name_lookup): Define.
* reloc.c (bfd_reloc_name_lookup): New function.
* riscix.c (riscix_reloc_name_lookup): New function.
(MY_bfd_reloc_name_lookup): Define.
* som.c (som_bfd_reloc_name_lookup): New function.
* targets.c (struct bfd_target): Add reloc_name_lookup.
(BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup.
* versados.c (versados_bfd_reloc_name_lookup): Define.
* vms.c (vms_bfd_reloc_name_lookup): New function.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
110 files changed, 1915 insertions, 85 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f0fdafe7a17..1301c1082c3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,186 @@ +2007-03-26 Alan Modra <amodra@bigpond.net.au> + + * aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define. + * aout-arm.c (MY_bfd_reloc_name_lookup): Define. + (MY (bfd_reloc_name_lookup)): New function. + * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function. + * aout-target.h (NAME (aout, reloc_name_lookup)): Declare. + (MY_bfd_reloc_name_lookup): Define. + * aout-tic30.c (tic30_aout_reloc_name_lookup): New function. + (MY_bfd_reloc_name_lookup): Define. + * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare. + (NAME (aout, reloc_name_lookup)): New function. + * bout.c (b_out_bfd_reloc_name_lookup): New function. + * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function. + (_bfd_ecoff_bfd_reloc_name_lookup): Define. + * coff-arm.c (coff_arm_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-i386.c (coff_bfd_reloc_name_lookup): Define. + (coff_i386_reloc_name_lookup): New function. + * coff-i860.c (coff_i860_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-i960.c (coff_i960_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-m68k.c (m68k_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-maxq.c (maxq_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-mcore.c (mcore_coff_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-mips.c (mips_bfd_reloc_name_lookup): New function. + (_bfd_ecoff_bfd_reloc_name_lookup): Define. + * coff-ppc.c (ppc_coff_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define. + (_bfd_xcoff_reloc_name_lookup): New function. + (rs6000coff_vec, pmac_xcoff_vec): Init new field. + * coff-sh.c (coff_bfd_reloc_name_lookup): Define. + (sh_coff_reloc_name_lookup): New function. + * coff-sparc.c (coff_sparc_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-tic30.c (coff_bfd_reloc_name_lookup): Define. + (tic30_coff_reloc_name_lookup): New function. + * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define. + (tic4x_coff_reloc_name_lookup): New function. + * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define. + (tic54x_coff_reloc_name_lookup): New function. + * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define. + (coff_amd64_reloc_name_lookup): New function. + * coff-z80.c (coff_z80_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff-z8k.c (coff_z8k_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define. + (xcoff64_reloc_name_lookup): New function. + (rs6000coff64_vec, aix5coff64_vec): Init new field. + * coffcode.h (coff_bfd_reloc_name_lookup): Define. + * elf-hppa.h (elf_hppa_reloc_name_lookup): New function. + * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-arm.c (elf32_arm_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-cris.c (cris_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-crx.c (elf_crx_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-fr30.c (fr30_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-frv.c (frv_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i370.c (i370_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i386.c (elf_i386_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i860.c (elf32_i860_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-i960.c (elf32_i960_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-ip2k.c (ip2k_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-iq2000.c (iq2000_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-m32c.c (m32c_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-m68k.c (reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-mep.c (mep_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. + (mips_vxworks_bfd_reloc_name_lookup): Likewise. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-mt.c (mt_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-openrisc.c (openrisc_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elf32-pj.c (pj_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-s390.c (elf_s390_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-score.c (elf32_score_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-sh.c (sh_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-spu.c (spu_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-v850.c (v850_elf_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-vax.c (reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-xc16x.c (xc16x_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function. + (bfd_elf32_bfd_reloc_name_lookup): Define. + * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function. + * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function. + * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-s390.c (elf_s390_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define. + * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function. + (bfd_elf64_bfd_reloc_name_lookup): Define. + * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. + * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function. + (bfd_elfNN_bfd_reloc_name_lookup): Define. + * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function. + * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare. + * i386msdos.c (msdos_bfd_reloc_name_lookup): Define. + * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define. + * ieee.c (ieee_bfd_reloc_name_lookup): Define. + * libaout.h (NAME (aout, reloc_name_lookup)): Declare. + * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare. + * mipsbsd.c (MY_bfd_reloc_name_lookup): Define. + (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup). + (MY(reloc_name_lookup)): New function. + * nlm-target.h (nlm_bfd_reloc_name_lookup): Define. + * oasys.c (oasys_bfd_reloc_name_lookup): Define. + * pdp11.c (NAME (aout, reloc_name_lookup)): New function. + * pe-mips.c (coff_mips_reloc_name_lookup): New function. + (coff_bfd_reloc_name_lookup): Define. + * reloc.c (bfd_reloc_name_lookup): New function. + * riscix.c (riscix_reloc_name_lookup): New function. + (MY_bfd_reloc_name_lookup): Define. + * som.c (som_bfd_reloc_name_lookup): New function. + * targets.c (struct bfd_target): Add reloc_name_lookup. + (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup. + * versados.c (versados_bfd_reloc_name_lookup): Define. + * vms.c (vms_bfd_reloc_name_lookup): New function. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + 2007-03-26 Thiemo Seufer <ths@mips.com> * elfxx-mips.c (mips_elf_next_relocation): Don't signal an error if no diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index b9f4a89e9f1..24327880aa4 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -1,6 +1,6 @@ /* BFD back-end for a.out.adobe binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006 + 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. Based on bout.c. @@ -450,6 +450,7 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, #define aout_32_bfd_make_debug_symbol ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) #define aout_32_bfd_reloc_type_lookup ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) +#define aout_32_bfd_reloc_name_lookup ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr) #define aout_32_close_and_cleanup aout_32_bfd_free_cached_info #define aout_32_set_arch_mach aout_adobe_set_arch_mach #define aout_32_set_section_contents aout_adobe_set_section_contents diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c index d8834a4f331..d459a806d49 100644 --- a/bfd/aout-arm.c +++ b/bfd/aout-arm.c @@ -1,6 +1,6 @@ /* BFD back-end for raw ARM a.out binaries. - Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, + 2007 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -50,6 +50,7 @@ #define N_MAGIC(x) ((x).a_info & ~07200) #define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup +#define MY_bfd_reloc_name_lookup aoutarm_bfd_reloc_name_lookup #include "libaout.h" #include "aout/aout64.h" @@ -317,6 +318,22 @@ MY (bfd_reloc_type_lookup) (bfd *abfd, } } +static reloc_howto_type * +MY (bfd_reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (MY (howto_table)) / sizeof (MY (howto_table)[0]); + i++) + if (MY (howto_table)[i].name != NULL + && strcasecmp (MY (howto_table)[i].name, r_name) == 0) + return &MY (howto_table)[i]; + + return NULL; +} + #define MY_swap_std_reloc_in MY (swap_std_reloc_in) #define MY_swap_std_reloc_out MY (swap_std_reloc_out) #define MY_get_section_contents _bfd_generic_get_section_contents diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c index 86cdcd57cf6..46eac5c1ccd 100644 --- a/bfd/aout-ns32k.c +++ b/bfd/aout-ns32k.c @@ -1,6 +1,6 @@ /* BFD back-end for ns32k a.out-ish binaries. Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002, 2003, 2005 Free Software Foundation, Inc. + 2002, 2003, 2005, 2007 Free Software Foundation, Inc. Contributed by Ian Dall (idall@eleceng.adelaide.edu.au). This file is part of BFD, the Binary File Descriptor library. @@ -28,8 +28,9 @@ the tokens. */ #define MYNS(OP) CONCAT2 (ns32kaout_,OP) -reloc_howto_type * MYNS (bfd_reloc_type_lookup) (bfd * abfd, bfd_reloc_code_real_type); -bfd_boolean MYNS (write_object_contents) (bfd *abfd); +reloc_howto_type * MYNS (bfd_reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); +reloc_howto_type * MYNS (bfd_reloc_name_lookup) (bfd *, const char *); +bfd_boolean MYNS (write_object_contents) (bfd *); /* Avoid multiple definitions from aoutx if supporting standard a.out format(s) as well as this one. */ @@ -246,6 +247,22 @@ MY (bfd_reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code) #undef ENTRY } +reloc_howto_type * +MY (bfd_reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (MY (howto_table)) / sizeof (MY (howto_table)[0]); + i++) + if (MY (howto_table)[i].name != NULL + && strcasecmp (MY (howto_table)[i].name, r_name) == 0) + return &MY (howto_table)[i]; + + return NULL; +} + static void MY_swap_std_reloc_in (bfd *abfd, struct reloc_std_external *bytes, diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 5a30eda7414..3e5fa910170 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -1,6 +1,6 @@ /* Define a target vector and some small routines for a variant of a.out. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -29,6 +29,7 @@ #endif extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); +extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *); /* Set parameters about this a.out file that are machine-dependent. This routine is called from some_aout_object_p just before it returns. */ @@ -494,6 +495,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) #ifndef MY_bfd_reloc_type_lookup #define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup) #endif +#ifndef MY_bfd_reloc_name_lookup +#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup) +#endif #ifndef MY_bfd_make_debug_symbol #define MY_bfd_make_debug_symbol 0 #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 0feb99decb1..2fc20bc1f1b 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C30 a.out binaries. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) @@ -271,6 +271,23 @@ tic30_aout_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } static reloc_howto_type * +tic30_aout_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (tic30_aout_howto_table) + / sizeof (tic30_aout_howto_table[0])); + i++) + if (tic30_aout_howto_table[i].name != NULL + && strcasecmp (tic30_aout_howto_table[i].name, r_name) == 0) + return &tic30_aout_howto_table[i]; + + return NULL; +} + +static reloc_howto_type * tic30_aout_reloc_howto (bfd *abfd, struct reloc_std_external *relocs, int *r_index, @@ -936,6 +953,9 @@ tic30_aout_set_arch_mach (bfd *abfd, #ifndef MY_bfd_reloc_type_lookup #define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup #endif +#ifndef MY_bfd_reloc_name_lookup +#define MY_bfd_reloc_name_lookup tic30_aout_reloc_name_lookup +#endif #ifndef MY_bfd_make_debug_symbol #define MY_bfd_make_debug_symbol 0 #endif diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 066f23ffd4c..6110f328a35 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -129,8 +129,6 @@ DESCRIPTION #include "aout/stab_gnu.h" #include "aout/ar.h" -reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); - /* SUBSECTION Relocations @@ -319,6 +317,31 @@ NAME (aout, reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code) } } +reloc_howto_type * +NAME (aout, reloc_name_lookup) (bfd *abfd, const char *r_name) +{ + unsigned int i, size; + reloc_howto_type *howto_table; + + if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE) + { + howto_table = howto_table_ext; + size = sizeof (howto_table_ext) / sizeof (howto_table_ext[0]); + } + else + { + howto_table = howto_table_std; + size = sizeof (howto_table_std) / sizeof (howto_table_std[0]); + } + + for (i = 0; i < size; i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + /* SUBSECTION Internal entry points diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index ca5810cbede..ac782a19046 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -4352,6 +4352,8 @@ BFD_RELOC_XTENSA_ASM_EXPAND. */ typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type *bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); +reloc_howto_type *bfd_reloc_name_lookup + (bfd *abfd, const char *reloc_name); const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); @@ -5198,7 +5200,8 @@ typedef struct bfd_target #define BFD_JUMP_TABLE_RELOCS(NAME) \ NAME##_get_reloc_upper_bound, \ NAME##_canonicalize_reloc, \ - NAME##_bfd_reloc_type_lookup + NAME##_bfd_reloc_type_lookup, \ + NAME##_bfd_reloc_name_lookup long (*_get_reloc_upper_bound) (bfd *, sec_ptr); long (*_bfd_canonicalize_reloc) @@ -5206,6 +5209,8 @@ typedef struct bfd_target /* See documentation on reloc types. */ reloc_howto_type * (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); + reloc_howto_type * + (*reloc_name_lookup) (bfd *, const char *); /* Routines used when writing an object file. */ diff --git a/bfd/bout.c b/bfd/bout.c index 15baadfe50c..2e449d5f65f 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 960 b.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -635,7 +635,8 @@ callj_callback (bfd *abfd, } static reloc_howto_type * -b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) +b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { switch (code) { @@ -651,6 +652,20 @@ b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_typ } } +static reloc_howto_type * +b_out_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + if (strcasecmp (howto_reloc_callj.name, r_name) == 0) + return &howto_reloc_callj; + if (strcasecmp (howto_reloc_abs32.name, r_name) == 0) + return &howto_reloc_abs32; + if (strcasecmp (howto_reloc_pcrel24.name, r_name) == 0) + return &howto_reloc_pcrel24; + + return NULL; +} + /* Allocate enough room for all the reloc entries, plus pointers to them all. */ static bfd_boolean diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index d9b890502d3..94007abf8fc 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1,6 +1,6 @@ /* BFD back-end for ALPHA Extended-Coff files. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and Ian Lance Taylor <ian@cygnus.com>. @@ -1244,6 +1244,22 @@ alpha_bfd_reloc_type_lookup (abfd, code) return &alpha_howto_table[alpha_type]; } + +static reloc_howto_type * +alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (alpha_howto_table) / sizeof (alpha_howto_table[0]); + i++) + if (alpha_howto_table[i].name != NULL + && strcasecmp (alpha_howto_table[i].name, r_name) == 0) + return &alpha_howto_table[i]; + + return NULL; +} /* A helper routine for alpha_relocate_section which converts an external reloc when generating relocatable output. Returns the @@ -2361,6 +2377,8 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data = /* Looking up a reloc type is Alpha specific. */ #define _bfd_ecoff_bfd_reloc_type_lookup alpha_bfd_reloc_type_lookup +#define _bfd_ecoff_bfd_reloc_name_lookup \ + alpha_bfd_reloc_name_lookup /* So is getting relocated section contents. */ #define _bfd_ecoff_bfd_get_relocated_section_contents \ diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 598489488c9..fb46b8d6651 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -1,6 +1,6 @@ /* BFD back-end for ARM COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -853,6 +853,23 @@ coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code) } } +static reloc_howto_type * +coff_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (aoutarm_std_reloc_howto) + / sizeof (aoutarm_std_reloc_howto[0])); + i++) + if (aoutarm_std_reloc_howto[i].name != NULL + && strcasecmp (aoutarm_std_reloc_howto[i].name, r_name) == 0) + return &aoutarm_std_reloc_howto[i]; + + return NULL; +} + #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 #define COFF_PAGE_SIZE 0x1000 @@ -2112,6 +2129,7 @@ bfd_arm_process_before_allocation (bfd * abfd, #endif /* ! defined (COFF_IMAGE_WITH_PE) */ #define coff_bfd_reloc_type_lookup coff_arm_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_arm_reloc_name_lookup #define coff_relocate_section coff_arm_relocate_section #define coff_bfd_is_local_label_name coff_arm_is_local_label_name #define coff_adjust_symndx coff_arm_adjust_symndx diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c index 0d71cd00065..a3b5116a3c1 100644 --- a/bfd/coff-i386.c +++ b/bfd/coff-i386.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 386 COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -546,6 +546,7 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp) } #define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_i386_reloc_name_lookup static reloc_howto_type * coff_i386_reloc_type_lookup (abfd, code) @@ -578,6 +579,20 @@ coff_i386_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +coff_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + #define coff_rtype_to_howto coff_i386_rtype_to_howto #ifdef TARGET_UNDERSCORE diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c index 723e823f1c7..9aa6d045981 100644 --- a/bfd/coff-i860.c +++ b/bfd/coff-i860.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel i860 COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Created mostly by substituting "860" for "386" in coff-i386.c Harry Dolan <dolan@ssd.intel.com>, October 1995 @@ -555,6 +555,20 @@ coff_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +coff_i860_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + /* This is called from coff_slurp_reloc_table for each relocation entry. This special handling is due to the `PAIR' relocation which has a different meaning for the `r_symndx' field. */ @@ -620,6 +634,7 @@ i860_reloc_processing (arelent *cache_ptr, struct internal_reloc *dst, #define coff_rtype_to_howto coff_i860_rtype_to_howto #define coff_bfd_reloc_type_lookup coff_i860_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_i860_reloc_name_lookup #define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \ i860_reloc_processing (relent, reloc, symbols, abfd, section) diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c index 741e15d41ea..5bf028c5c4a 100644 --- a/bfd/coff-i960.c +++ b/bfd/coff-i960.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 960 COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -296,6 +296,20 @@ coff_i960_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +coff_i960_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + if (strcasecmp (howto_optcall.name, r_name) == 0) + return &howto_optcall; + if (strcasecmp (howto_rellong.name, r_name) == 0) + return &howto_rellong; + if (strcasecmp (howto_iprmed.name, r_name) == 0) + return &howto_iprmed; + + return NULL; +} + /* The real code is in coffcode.h */ #define RTYPE2HOWTO(cache_ptr, dst) \ @@ -613,6 +627,7 @@ coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) #define coff_adjust_symndx coff_i960_adjust_symndx #define coff_bfd_reloc_type_lookup coff_i960_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_i960_reloc_name_lookup #include "coffcode.h" diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c index d389a4ff1e0..a499bd18fae 100644 --- a/bfd/coff-m68k.c +++ b/bfd/coff-m68k.c @@ -1,6 +1,6 @@ /* BFD back-end for Motorola 68000 COFF binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, - 2000, 2001, 2002, 2003, 2005 + 2000, 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -91,6 +91,7 @@ m68k_coff_is_local_label_name (abfd, name) #define m68k_rtype2howto _bfd_m68kcoff_rtype2howto #define m68k_howto2rtype _bfd_m68kcoff_howto2rtype #define m68k_reloc_type_lookup _bfd_m68kcoff_reloc_type_lookup +#define m68k_reloc_name_lookup _bfd_m68kcoff_reloc_name_lookup #endif #ifdef ONLY_DECLARE_RELOCS @@ -123,6 +124,8 @@ extern void m68k_rtype2howto PARAMS ((arelent *internal, int relocentry)); extern int m68k_howto2rtype PARAMS ((reloc_howto_type *)); extern reloc_howto_type *m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +extern reloc_howto_type *m68k_reloc_name_lookup + PARAMS ((bfd *, const char *)); #else #ifdef STATIC_RELOCS @@ -132,6 +135,7 @@ extern reloc_howto_type *m68k_reloc_type_lookup #endif STAT_REL reloc_howto_type * m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +STAT_REL reloc_howto_type * m68k_reloc_name_lookup PARAMS ((bfd *, const char *)); STAT_REL int m68k_howto2rtype PARAMS ((reloc_howto_type *)); STAT_REL void m68k_rtype2howto PARAMS ((arelent *, int)); @@ -198,6 +202,22 @@ m68k_reloc_type_lookup (abfd, code) /*NOTREACHED*/ } +STAT_REL reloc_howto_type * +m68k_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (m68kcoff_howto_table) / sizeof (m68kcoff_howto_table[0]); + i++) + if (m68kcoff_howto_table[i].name != NULL + && strcasecmp (m68kcoff_howto_table[i].name, r_name) == 0) + return &m68kcoff_howto_table[i]; + + return NULL; +} + #endif /* not ONLY_DECLARE_RELOCS */ #define RTYPE2HOWTO(internal, relocentry) \ @@ -207,6 +227,7 @@ m68k_reloc_type_lookup (abfd, code) external.r_type = m68k_howto2rtype (internal) #define coff_bfd_reloc_type_lookup m68k_reloc_type_lookup +#define coff_bfd_reloc_name_lookup m68k_reloc_name_lookup #ifndef COFF_COMMON_ADDEND #ifndef coff_rtype_to_howto diff --git a/bfd/coff-maxq.c b/bfd/coff-maxq.c index 58f929765ed..54b47c897fb 100644 --- a/bfd/coff-maxq.c +++ b/bfd/coff-maxq.c @@ -1,5 +1,5 @@ /* BFD back-end for MAXQ COFF binaries. - Copyright 2004 Free Software Foundation, Inc. + Copyright 2004, 2007 Free Software Foundation, Inc. Contributed by Vineet Sharma (vineets@noida.hcltech.com) Inderpreet S. (inderpreetb@noida.hcltech.com) @@ -407,7 +407,21 @@ maxq_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +maxq_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + #define coff_bfd_reloc_type_lookup maxq_reloc_type_lookup +#define coff_bfd_reloc_name_lookup maxq_reloc_name_lookup /* Perform any necessary magic to the addend in a reloc entry. */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index 08935fd6297..cf6f82da7e0 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -1,5 +1,5 @@ /* BFD back-end for Motorola MCore COFF/PE - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -283,9 +283,25 @@ mcore_coff_reloc_type_lookup (abfd, code) } /*NOTREACHED*/ } - #undef HOW2MAP +static reloc_howto_type * +mcore_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (mcore_coff_howto_table) + / sizeof (mcore_coff_howto_table[0])); + i++) + if (mcore_coff_howto_table[i].name != NULL + && strcasecmp (mcore_coff_howto_table[i].name, r_name) == 0) + return &mcore_coff_howto_table[i]; + + return NULL; +} + #define RTYPE2HOWTO(cache_ptr, dst) \ (cache_ptr)->howto = mcore_coff_howto_table + (dst)->r_type; @@ -538,6 +554,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, /* We use the special COFF backend linker, with our own special touch. */ #define coff_bfd_reloc_type_lookup mcore_coff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup mcore_coff_reloc_name_lookup #define coff_relocate_section coff_mcore_relocate_section #define coff_rtype_to_howto coff_mcore_rtype_to_howto diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 34b072c4138..e6e66c2d49b 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS Extended-Coff files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -769,6 +769,22 @@ mips_bfd_reloc_type_lookup (abfd, code) return &mips_howto_table[mips_type]; } + +static reloc_howto_type * +mips_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mips_howto_table) / sizeof (mips_howto_table[0]); + i++) + if (mips_howto_table[i].name != NULL + && strcasecmp (mips_howto_table[i].name, r_name) == 0) + return &mips_howto_table[i]; + + return NULL; +} /* A helper routine for mips_relocate_section which handles the REFHI relocations. The REFHI relocation must be followed by a REFLO @@ -1375,6 +1391,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = /* Looking up a reloc type is MIPS specific. */ #define _bfd_ecoff_bfd_reloc_type_lookup mips_bfd_reloc_type_lookup +#define _bfd_ecoff_bfd_reloc_name_lookup mips_bfd_reloc_name_lookup /* Getting relocated section contents is generic. */ #define _bfd_ecoff_bfd_get_relocated_section_contents \ diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 0ef37852345..611c9e051a6 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -1,6 +1,6 @@ /* BFD back-end for PowerPC Microsoft Portable Executable files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Original version pieced together by Kim Knuttila (krk@cygnus.com) @@ -1961,8 +1961,23 @@ ppc_coff_reloc_type_lookup (abfd, code) return NULL; } } - #undef HOW2MAP + +static reloc_howto_type * +ppc_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]); + i++) + if (ppc_coff_howto_table[i].name != NULL + && strcasecmp (ppc_coff_howto_table[i].name, r_name) == 0) + return &ppc_coff_howto_table[i]; + + return NULL; +} /* Tailor coffcode.h -- macro heaven. */ @@ -1971,6 +1986,7 @@ ppc_coff_reloc_type_lookup (abfd, code) /* We use the special COFF backend linker, with our own special touch. */ #define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup ppc_coff_reloc_name_lookup #define coff_rtype_to_howto coff_ppc_rtype_to_howto #define coff_relocate_section coff_ppc_relocate_section #define coff_bfd_final_link ppc_bfd_coff_final_link diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 1f0458e8ec8..975bc6755a5 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -98,6 +98,7 @@ void xcoff_rtype2howto #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup _bfd_xcoff_reloc_name_lookup #ifdef AIX_CORE extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd)); @@ -1051,6 +1052,21 @@ _bfd_xcoff_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +_bfd_xcoff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (xcoff_howto_table) / sizeof (xcoff_howto_table[0]); + i++) + if (xcoff_howto_table[i].name != NULL + && strcasecmp (xcoff_howto_table[i].name, r_name) == 0) + return &xcoff_howto_table[i]; + + return NULL; +} /* XCOFF archive support. The original version of this code was by Damon A. Permezel. It was enhanced to permit cross support, and @@ -4178,6 +4194,7 @@ const bfd_target rs6000coff_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, _bfd_xcoff_reloc_type_lookup, + _bfd_xcoff_reloc_name_lookup, /* Write */ coff_set_arch_mach, @@ -4428,6 +4445,7 @@ const bfd_target pmac_xcoff_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, _bfd_xcoff_reloc_type_lookup, + _bfd_xcoff_reloc_name_lookup, /* Write */ coff_set_arch_mach, diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index bc03d5fa552..8671260b4fd 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -1,6 +1,6 @@ /* BFD back-end for Renesas Super-H COFF binaries. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. @@ -494,6 +494,7 @@ static const struct shcoff_reloc_map sh_reloc_map[] = /* Given a BFD reloc code, return the howto structure for the corresponding SH PE reloc. */ #define coff_bfd_reloc_type_lookup sh_coff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup sh_coff_reloc_name_lookup static reloc_howto_type * sh_coff_reloc_type_lookup (abfd, code) @@ -510,6 +511,20 @@ sh_coff_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +sh_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (sh_coff_howtos) / sizeof (sh_coff_howtos[0]); i++) + if (sh_coff_howtos[i].name != NULL + && strcasecmp (sh_coff_howtos[i].name, r_name) == 0) + return &sh_coff_howtos[i]; + + return NULL; +} + /* This macro is used in coffcode.h to get the howto corresponding to an internal reloc. */ diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c index 0236f525e66..476e78bc9c4 100644 --- a/bfd/coff-sparc.c +++ b/bfd/coff-sparc.c @@ -1,6 +1,6 @@ /* BFD back-end for Sparc COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, - 2002, 2003, 2005 Free Software Foundation, Inc. + 2002, 2003, 2005, 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -158,6 +158,24 @@ coff_sparc_reloc_type_lookup (abfd, code) } #define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup +static reloc_howto_type * +coff_sparc_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (coff_sparc_howto_table) + / sizeof (coff_sparc_howto_table[0])); + i++) + if (coff_sparc_howto_table[i].name != NULL + && strcasecmp (coff_sparc_howto_table[i].name, r_name) == 0) + return &coff_sparc_howto_table[i]; + + return NULL; +} +#define coff_bfd_reloc_name_lookup coff_sparc_reloc_name_lookup + static void rtype2howto (cache_ptr, dst) arelent *cache_ptr; diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c index b1ff5dbdfbf..b98c728cd6e 100644 --- a/bfd/coff-tic30.c +++ b/bfd/coff-tic30.c @@ -1,5 +1,6 @@ /* BFD back-end for TMS320C30 coff binaries. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2007 + Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) This file is part of BFD, the Binary File Descriptor library. @@ -52,6 +53,7 @@ reloc_howto_type tic30_coff_howto_table[] = #ifndef coff_bfd_reloc_type_lookup #define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup tic30_coff_reloc_name_lookup /* For the case statement use the code values used in tc_gen_reloc to map to the howto table entries that match those in both the aout @@ -80,6 +82,23 @@ tic30_coff_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +tic30_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (tic30_coff_howto_table) + / sizeof (tic30_coff_howto_table[0])); + i++) + if (tic30_coff_howto_table[i].name != NULL + && strcasecmp (tic30_coff_howto_table[i].name, r_name) == 0) + return &tic30_coff_howto_table[i]; + + return NULL; +} + #endif /* Turn a howto into a reloc number. */ diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c index 1e95411e9e6..25bed8dd7bc 100644 --- a/bfd/coff-tic4x.c +++ b/bfd/coff-tic4x.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C4X coff binaries. - Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005 + Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, 2007 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) @@ -117,6 +117,8 @@ reloc_howto_type tic4x_howto_table[] = #undef coff_bfd_reloc_type_lookup #define coff_bfd_reloc_type_lookup tic4x_coff_reloc_type_lookup +#undef coff_bfd_reloc_name_lookup +#define coff_bfd_reloc_name_lookup tic4x_coff_reloc_name_lookup /* For the case statement use the code values used tc_gen_reloc (defined in bfd/reloc.c) to map to the howto table entries. */ @@ -150,6 +152,21 @@ tic4x_coff_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +tic4x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (tic4x_howto_table) / sizeof (tic4x_howto_table[0]); + i++) + if (tic4x_howto_table[i].name != NULL + && strcasecmp (tic4x_howto_table[i].name, r_name) == 0) + return &tic4x_howto_table[i]; + + return NULL; +} /* Code to turn a r_type into a howto ptr, uses the above howto table. Called after some initial checking by the tic4x_rtype_to_howto fn diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index f16fe899671..f651a10618a 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C54X coff binaries. - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) @@ -229,6 +229,7 @@ reloc_howto_type tic54x_howto_table[] = }; #define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup tic54x_coff_reloc_name_lookup /* For the case statement use the code values used tc_gen_reloc (defined in bfd/reloc.c) to map to the howto table entries. */ @@ -259,6 +260,22 @@ tic54x_coff_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +tic54x_coff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (tic54x_howto_table) / sizeof (tic54x_howto_table[0]); + i++) + if (tic54x_howto_table[i].name != NULL + && strcasecmp (tic54x_howto_table[i].name, r_name) == 0) + return &tic54x_howto_table[i]; + + return NULL; +} + /* Code to turn a r_type into a howto ptr, uses the above howto table. Called after some initial checking by the tic54x_rtype_to_howto fn below. */ diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c index 772e1ebf7c3..75ddbe5bf02 100644 --- a/bfd/coff-x86_64.c +++ b/bfd/coff-x86_64.c @@ -1,5 +1,5 @@ /* BFD back-end for AMD 64 COFF files. - Copyright 2006 Free Software Foundation, Inc. + Copyright 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -634,6 +634,7 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, } #define coff_bfd_reloc_type_lookup coff_amd64_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_amd64_reloc_name_lookup static reloc_howto_type * coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) @@ -674,6 +675,20 @@ coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_ty } } +static reloc_howto_type * +coff_amd64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + #define coff_rtype_to_howto coff_amd64_rtype_to_howto #ifdef TARGET_UNDERSCORE diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c index 512c2b8677e..39d467fe9a0 100644 --- a/bfd/coff-z80.c +++ b/bfd/coff-z80.c @@ -1,5 +1,5 @@ /* BFD back-end for Zilog Z80 COFF binaries. - Copyright 2005 Free Software Foundation, Inc. + Copyright 2005, 2007 Free Software Foundation, Inc. Contributed by Arnold Metselaar <arnold_m@operamail.com> This file is part of BFD, the Binary File Descriptor library. @@ -123,6 +123,26 @@ coff_z80_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +coff_z80_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + if (strcasecmp (r_imm8.name, r_name) == 0) + return &r_imm8; + if (strcasecmp (r_imm16.name, r_name) == 0) + return &r_imm16; + if (strcasecmp (r_imm24.name, r_name) == 0) + return &r_imm24; + if (strcasecmp (r_imm32.name, r_name) == 0) + return &r_imm32; + if (strcasecmp (r_jr.name, r_name) == 0) + return &r_jr; + if (strcasecmp (r_off8.name, r_name) == 0) + return &r_off8; + + return NULL; +} + /* Perform any necessary magic to the addend in a reloc entry. */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ @@ -248,6 +268,7 @@ extra_case (bfd *in_abfd, #define coff_reloc16_extra_cases extra_case #define coff_bfd_reloc_type_lookup coff_z80_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_z80_reloc_name_lookup #include "coffcode.h" diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index 8fc2f169239..3fb37d95753 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -1,6 +1,6 @@ /* BFD back-end for Zilog Z800n COFF binaries. Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, - 2004, 2005 Free Software Foundation, Inc. + 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. @@ -135,6 +135,30 @@ coff_z8k_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +coff_z8k_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + if (strcasecmp (r_imm8.name, r_name) == 0) + return &r_imm8; + if (strcasecmp (r_da.name, r_name) == 0) + return &r_da; + if (strcasecmp (r_imm32.name, r_name) == 0) + return &r_imm32; + if (strcasecmp (r_jr.name, r_name) == 0) + return &r_jr; + if (strcasecmp (r_rel16.name, r_name) == 0) + return &r_rel16; + if (strcasecmp (r_disp7.name, r_name) == 0) + return &r_disp7; + if (strcasecmp (r_callr.name, r_name) == 0) + return &r_callr; + if (strcasecmp (r_imm4l.name, r_name) == 0) + return &r_imm4l; + + return NULL; +} + /* Perform any necessary magic to the addend in a reloc entry. */ #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ @@ -345,6 +369,7 @@ extra_case (bfd *in_abfd, #define coff_reloc16_extra_cases extra_case #define coff_bfd_reloc_type_lookup coff_z8k_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_z8k_reloc_name_lookup #include "coffcode.h" diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 0ac7d70e383..ce8f1661754 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -237,6 +237,7 @@ bfd_boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION]) #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup +#define coff_bfd_reloc_name_lookup xcoff64_reloc_name_lookup #ifdef AIX_CORE extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd)); @@ -1843,6 +1844,22 @@ xcoff64_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +xcoff64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (xcoff64_howto_table) / sizeof (xcoff64_howto_table[0]); + i++) + if (xcoff64_howto_table[i].name != NULL + && strcasecmp (xcoff64_howto_table[i].name, r_name) == 0) + return &xcoff64_howto_table[i]; + + return NULL; +} + /* Read in the armap of an XCOFF archive. */ static bfd_boolean @@ -2725,6 +2742,7 @@ const bfd_target rs6000coff64_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, xcoff64_reloc_type_lookup, + xcoff64_reloc_name_lookup, /* Write */ coff_set_arch_mach, @@ -2976,6 +2994,7 @@ const bfd_target aix5coff64_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, xcoff64_reloc_type_lookup, + xcoff64_reloc_name_lookup, /* Write */ coff_set_arch_mach, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index bc5c72e61f4..d86247e246a 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1,6 +1,6 @@ /* Support for the generic parts of most COFF variants, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -5333,6 +5333,9 @@ static const bfd_coff_backend_data ticoff1_swap_table = #ifndef coff_bfd_reloc_type_lookup #define coff_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup #endif +#ifndef coff_bfd_reloc_name_lookup +#define coff_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup +#endif #ifndef coff_bfd_get_relocated_section_contents #define coff_bfd_get_relocated_section_contents \ diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 271b5781940..e676e27fef3 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1017,6 +1017,22 @@ elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +elf_hppa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_hppa_howto_table) / sizeof (elf_hppa_howto_table[0]); + i++) + if (elf_hppa_howto_table[i].name != NULL + && strcasecmp (elf_hppa_howto_table[i].name, r_name) == 0) + return &elf_hppa_howto_table[i]; + + return NULL; +} + /* Return TRUE if SYM represents a local label symbol. */ static bfd_boolean diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index e81db55da27..d2611dd7bcd 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -207,6 +207,23 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_mn10200_howto_table) + / sizeof (elf_mn10200_howto_table[0])); + i++) + if (elf_mn10200_howto_table[i].name != NULL + && strcasecmp (elf_mn10200_howto_table[i].name, r_name) == 0) + return &elf_mn10200_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an MN10200 ELF reloc. */ static void diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 014ec04f61f..d65ea98bf58 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -637,6 +637,23 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_mn10300_howto_table) + / sizeof (elf_mn10300_howto_table[0])); + i++) + if (elf_mn10300_howto_table[i].name != NULL + && strcasecmp (elf_mn10300_howto_table[i].name, r_name) == 0) + return &elf_mn10300_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an MN10300 ELF reloc. */ static void diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index a6011bdb32d..c9c50cf61bd 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -1,5 +1,5 @@ /* ARC-specific support for 32-bit ELF - Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005 + Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005, 2007 Free Software Foundation, Inc. Contributed by Doug Evans (dje@cygnus.com). @@ -147,6 +147,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_arc_howto_table) / sizeof (elf_arc_howto_table[0]); + i++) + if (elf_arc_howto_table[i].name != NULL + && strcasecmp (elf_arc_howto_table[i].name, r_name) == 0) + return &elf_arc_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an ARC ELF reloc. */ static void diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index be109232235..e8be0d5d927 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -1787,6 +1787,31 @@ elf32_arm_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +elf32_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf32_arm_howto_table_1) + / sizeof (elf32_arm_howto_table_1[0])); + i++) + if (elf32_arm_howto_table_1[i].name != NULL + && strcasecmp (elf32_arm_howto_table_1[i].name, r_name) == 0) + return &elf32_arm_howto_table_1[i]; + + for (i = 0; + i < (sizeof (elf32_arm_howto_table_2) + / sizeof (elf32_arm_howto_table_2[0])); + i++) + if (elf32_arm_howto_table_2[i].name != NULL + && strcasecmp (elf32_arm_howto_table_2[i].name, r_name) == 0) + return &elf32_arm_howto_table_2[i]; + + return NULL; +} + /* Support for core dump NOTE sections */ static bfd_boolean elf32_arm_nabi_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) @@ -10579,6 +10604,7 @@ const struct elf_size_info elf32_arm_size_info = { #define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data #define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf32_arm_reloc_name_lookup #define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line #define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info #define bfd_elf32_new_section_hook elf32_arm_new_section_hook diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index 33d52269fd8..0f070b47756 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -688,6 +688,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_avr_howto_table) / sizeof (elf_avr_howto_table[0]); + i++) + if (elf_avr_howto_table[i].name != NULL + && strcasecmp (elf_avr_howto_table[i].name, r_name) == 0) + return &elf_avr_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an AVR ELF reloc. */ static void diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 72604cf44d6..3c74615767a 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1057,8 +1057,8 @@ bfin_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, else cache_ptr->howto = (reloc_howto_type *) NULL; - } + /* Given a BFD reloc type, return the howto. */ static reloc_howto_type * bfin_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, @@ -1078,8 +1078,33 @@ bfin_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN]; return (reloc_howto_type *) NULL; +} +static reloc_howto_type * +bfin_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (bfin_howto_table) + / sizeof (bfin_howto_table[0])); + i++) + if (bfin_howto_table[i].name != NULL + && strcasecmp (bfin_howto_table[i].name, r_name) == 0) + return &bfin_howto_table[i]; + + for (i = 0; + i < (sizeof (bfin_gnuext_howto_table) + / sizeof (bfin_gnuext_howto_table[0])); + i++) + if (bfin_gnuext_howto_table[i].name != NULL + && strcasecmp (bfin_gnuext_howto_table[i].name, r_name) == 0) + return &bfin_gnuext_howto_table[i]; + + return NULL; } + /* Given a bfin relocation type, return the howto. */ static reloc_howto_type * bfin_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, @@ -1092,7 +1117,6 @@ bfin_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return &bfin_gnuext_howto_table [r_type - BFIN_GNUEXT_RELOC_MIN]; return (reloc_howto_type *) NULL; - } /* Return TRUE if the name is a local label. @@ -5475,6 +5499,8 @@ error_return: #define elf_symbol_leading_char '_' #define bfd_elf32_bfd_reloc_type_lookup bfin_bfd_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + bfin_bfd_reloc_name_lookup #define elf_info_to_howto bfin_info_to_howto #define elf_info_to_howto_rel 0 #define elf_backend_object_p elf32_bfin_object_p diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c index eb85bd3f3d0..50b45dc338a 100644 --- a/bfd/elf32-cr16c.c +++ b/bfd/elf32-cr16c.c @@ -150,6 +150,20 @@ elf_cr16c_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return 0; } +static reloc_howto_type * +elf_cr16c_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + return NULL; +} + static void elf_cr16c_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr ATTRIBUTE_UNUSED, @@ -943,6 +957,7 @@ elf32_cr16c_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED #define elf_symbol_leading_char '_' #define bfd_elf32_bfd_reloc_type_lookup elf_cr16c_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf_cr16c_reloc_name_lookup #define elf_info_to_howto elf_cr16c_info_to_howto #define elf_info_to_howto_rel elf_cr16c_info_to_howto_rel #define elf_backend_relocate_section elf32_cr16c_relocate_section diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index cc0b24fd2f7..8b8063dcd02 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -457,6 +457,21 @@ cris_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +cris_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (cris_elf_howto_table) / sizeof (cris_elf_howto_table[0]); + i++) + if (cris_elf_howto_table[i].name != NULL + && strcasecmp (cris_elf_howto_table[i].name, r_name) == 0) + return &cris_elf_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an CRIS ELF reloc. */ static void @@ -3405,6 +3420,7 @@ elf_cris_reloc_type_class (rela) cris_elf_copy_private_bfd_data #define bfd_elf32_bfd_reloc_type_lookup cris_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup cris_reloc_name_lookup #define bfd_elf32_bfd_link_hash_table_create \ elf_cris_link_hash_table_create diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c index 438c1c26682..709fdab60bb 100644 --- a/bfd/elf32-crx.c +++ b/bfd/elf32-crx.c @@ -399,6 +399,22 @@ elf_crx_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return 0; } +static reloc_howto_type * +elf_crx_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (crx_elf_howto_table) / sizeof (crx_elf_howto_table[0]); + i++) + if (crx_elf_howto_table[i].name != NULL + && strcasecmp (crx_elf_howto_table[i].name, r_name) == 0) + return &crx_elf_howto_table[i]; + + return NULL; +} + /* Retrieve a howto ptr using an internal relocation entry. */ static void @@ -1311,6 +1327,8 @@ elf32_crx_relax_section (bfd *abfd, asection *sec, #define elf_symbol_leading_char '_' #define bfd_elf32_bfd_reloc_type_lookup elf_crx_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + elf_crx_reloc_name_lookup #define elf_info_to_howto elf_crx_info_to_howto #define elf_info_to_howto_rel 0 #define elf_backend_relocate_section elf32_crx_relocate_section diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 26ae8ceefb7..2966f28edbb 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -203,6 +203,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_d10v_howto_table) / sizeof (elf_d10v_howto_table[0]); + i++) + if (elf_d10v_howto_table[i].name != NULL + && strcasecmp (elf_d10v_howto_table[i].name, r_name) == 0) + return &elf_d10v_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an D10V ELF reloc. */ static void diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c index c96937d5da0..5a6eafa6d3a 100644 --- a/bfd/elf32-d30v.c +++ b/bfd/elf32-d30v.c @@ -1,5 +1,5 @@ /* D30V-specific support for 32-bit ELF - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Martin Hunt (hunt@cygnus.com). @@ -491,6 +491,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_d30v_howto_table) / sizeof (elf_d30v_howto_table[0]); + i++) + if (elf_d30v_howto_table[i].name != NULL + && strcasecmp (elf_d30v_howto_table[i].name, r_name) == 0) + return &elf_d30v_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an D30V ELF reloc (type REL). */ static void diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index b1f6257641c..fcbef1c2f2c 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -1,5 +1,6 @@ /* DLX specific support for 32-bit ELF - Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005, 2007 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -27,6 +28,7 @@ #define USE_REL 1 #define bfd_elf32_bfd_reloc_type_lookup elf32_dlx_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf32_dlx_reloc_name_lookup #define elf_info_to_howto elf32_dlx_info_to_howto #define elf_info_to_howto_rel elf32_dlx_info_to_howto_rel #define elf_backend_check_relocs elf32_dlx_check_relocs @@ -506,6 +508,31 @@ elf32_dlx_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } static reloc_howto_type * +elf32_dlx_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (dlx_elf_howto_table) / sizeof (dlx_elf_howto_table[0]); + i++) + if (dlx_elf_howto_table[i].name != NULL + && strcasecmp (dlx_elf_howto_table[i].name, r_name) == 0) + return &dlx_elf_howto_table[i]; + + if (strcasecmp (elf_dlx_gnu_rel16_s2.name, r_name) == 0) + return &elf_dlx_gnu_rel16_s2; + if (strcasecmp (elf_dlx_gnu_rel26_s2.name, r_name) == 0) + return &elf_dlx_gnu_rel26_s2; + if (strcasecmp (elf_dlx_reloc_16_hi.name, r_name) == 0) + return &elf_dlx_reloc_16_hi; + if (strcasecmp (elf_dlx_reloc_16_lo.name, r_name) == 0) + return &elf_dlx_reloc_16_lo; + + return NULL; +} + +static reloc_howto_type * dlx_rtype_to_howto (unsigned int r_type) { switch (r_type) diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index d23527f7e20..6a4243703d4 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -366,6 +366,21 @@ fr30_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +fr30_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (fr30_elf_howto_table) / sizeof (fr30_elf_howto_table[0]); + i++) + if (fr30_elf_howto_table[i].name != NULL + && strcasecmp (fr30_elf_howto_table[i].name, r_name) == 0) + return &fr30_elf_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an FR30 ELF reloc. */ static void @@ -727,5 +742,6 @@ fr30_elf_check_relocs (abfd, info, sec, relocs) #define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup fr30_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup fr30_reloc_name_lookup #include "elf32-target.h" diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 56d546af925..6d0d7e48338 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -2590,6 +2590,26 @@ frv_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +frv_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf32_frv_howto_table) / sizeof (elf32_frv_howto_table[0]); + i++) + if (elf32_frv_howto_table[i].name != NULL + && strcasecmp (elf32_frv_howto_table[i].name, r_name) == 0) + return &elf32_frv_howto_table[i]; + + if (strcasecmp (elf32_frv_vtinherit_howto.name, r_name) == 0) + return &elf32_frv_vtinherit_howto; + if (strcasecmp (elf32_frv_vtentry_howto.name, r_name) == 0) + return &elf32_frv_vtentry_howto; + + return NULL; +} + /* Set the howto pointer for an FRV ELF reloc. */ static void @@ -6866,6 +6886,7 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) #define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup frv_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup frv_reloc_name_lookup #define bfd_elf32_bfd_set_private_flags frv_elf_set_private_flags #define bfd_elf32_bfd_copy_private_bfd_data frv_elf_copy_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data frv_elf_merge_private_bfd_data diff --git a/bfd/elf32-gen.c b/bfd/elf32-gen.c index 23c74767799..ed60f9c9a20 100644 --- a/bfd/elf32-gen.c +++ b/bfd/elf32-gen.c @@ -94,6 +94,7 @@ elf32_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info) #define ELF_MACHINE_CODE EM_NONE #define ELF_MAXPAGESIZE 0x1 #define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define bfd_elf32_bfd_link_add_symbols elf32_generic_link_add_symbols #define elf_info_to_howto elf_generic_info_to_howto #define elf_info_to_howto_rel elf_generic_info_to_howto_rel diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 0990e04c815..134781ddab0 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -251,6 +251,22 @@ elf32_h8_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +elf32_h8_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (h8_elf_howto_table) / sizeof (h8_elf_howto_table[0]); + i++) + if (h8_elf_howto_table[i].name != NULL + && strcasecmp (h8_elf_howto_table[i].name, r_name) == 0) + return &h8_elf_howto_table[i]; + + return NULL; +} + static void elf32_h8_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, Elf_Internal_Rela *elf_reloc) @@ -1502,6 +1518,7 @@ elf32_h8_get_relocated_section_contents (bfd *output_bfd, #define ELF_MACHINE_CODE EM_H8_300 #define ELF_MAXPAGESIZE 0x1 #define bfd_elf32_bfd_reloc_type_lookup elf32_h8_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf32_h8_reloc_name_lookup #define elf_info_to_howto elf32_h8_info_to_howto #define elf_info_to_howto_rel elf32_h8_info_to_howto_rel diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 13c26966488..5a7c6d38936 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -4615,6 +4615,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) /* Misc BFD support code. */ #define bfd_elf32_bfd_is_local_label_name elf_hppa_is_local_label_name #define bfd_elf32_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf_hppa_reloc_name_lookup #define elf_info_to_howto elf_hppa_info_to_howto #define elf_info_to_howto_rel elf_hppa_info_to_howto_rel diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 69393d97fc9..7e1d242ea74 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1,6 +1,6 @@ /* i370-specific support for 32-bit ELF Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, - 2005, 2006 Free Software Foundation, Inc. + 2005, 2006, 2007 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Hacked by Linas Vepstas for i370 linas@linas.org @@ -267,6 +267,22 @@ i370_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return i370_elf_howto_table[ (int)i370_reloc ]; }; +static reloc_howto_type * +i370_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (i370_elf_howto_raw) / sizeof (i370_elf_howto_raw[0]); + i++) + if (i370_elf_howto_raw[i].name != NULL + && strcasecmp (i370_elf_howto_raw[i].name, r_name) == 0) + return &i370_elf_howto_raw[i]; + + return NULL; +} + /* The name of the dynamic interpreter. This is put in the .interp section. */ @@ -1434,6 +1450,7 @@ i370_elf_relocate_section (bfd *output_bfd, #define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup i370_elf_reloc_name_lookup #define bfd_elf32_bfd_set_private_flags i370_elf_set_private_flags #define bfd_elf32_bfd_merge_private_bfd_data i370_elf_merge_private_bfd_data #define elf_backend_relocate_section i370_elf_relocate_section diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index a277f7af639..59ffa630f05 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -330,6 +330,20 @@ elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return 0; } +static reloc_howto_type * +elf_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + return NULL; +} + static void elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, @@ -3818,6 +3832,7 @@ elf_i386_hash_symbol (struct elf_link_hash_entry *h) #define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf_i386_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol #define elf_backend_check_relocs elf_i386_check_relocs diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c index 9e2a1a355f1..a4d0672fcd8 100644 --- a/bfd/elf32-i860.c +++ b/bfd/elf32-i860.c @@ -886,6 +886,23 @@ elf32_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return lookup_howto (rtype); } +static reloc_howto_type * +elf32_i860_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf32_i860_howto_table) + / sizeof (elf32_i860_howto_table[0])); + i++) + if (elf32_i860_howto_table[i].name != NULL + && strcasecmp (elf32_i860_howto_table[i].name, r_name) == 0) + return &elf32_i860_howto_table[i]; + + return NULL; +} + /* Given a ELF reloc, return the matching HOWTO structure. */ static void elf32_i860_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, @@ -1252,6 +1269,7 @@ elf32_i860_is_local_label_name (bfd *abfd, const char *name) #define elf_info_to_howto elf32_i860_info_to_howto_rela #define elf_backend_relocate_section elf32_i860_relocate_section #define bfd_elf32_bfd_reloc_type_lookup elf32_i860_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf32_i860_reloc_name_lookup #define bfd_elf32_bfd_is_local_label_name elf32_i860_is_local_label_name #include "elf32-target.h" diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c index f458320655b..30b229b3812 100644 --- a/bfd/elf32-i960.c +++ b/bfd/elf32-i960.c @@ -1,5 +1,6 @@ /* Intel 960 specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -27,6 +28,8 @@ #define USE_REL 1 #define bfd_elf32_bfd_reloc_type_lookup elf32_i960_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + elf32_i960_reloc_name_lookup #define elf_info_to_howto elf32_i960_info_to_howto #define elf_info_to_howto_rel elf32_i960_info_to_howto_rel @@ -142,6 +145,20 @@ elf32_i960_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return elf_howto_table + elf32_i960_bfd_to_reloc_type (code); } +static reloc_howto_type * +elf32_i960_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + return NULL; +} + #define TARGET_LITTLE_SYM bfd_elf32_i960_vec #define TARGET_LITTLE_NAME "elf32-i960" #define ELF_ARCH bfd_arch_i960 diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index d3f6ca79765..236ef16a324 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -223,6 +223,21 @@ ip2k_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +ip2k_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ip2k_elf_howto_table) / sizeof (ip2k_elf_howto_table[0]); + i++) + if (ip2k_elf_howto_table[i].name != NULL + && strcasecmp (ip2k_elf_howto_table[i].name, r_name) == 0) + return &ip2k_elf_howto_table[i]; + + return NULL; +} + static void ip2k_get_mem (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *addr, @@ -1529,6 +1544,7 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, #define elf_symbol_leading_char '_' #define bfd_elf32_bfd_reloc_type_lookup ip2k_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup ip2k_reloc_name_lookup #define bfd_elf32_bfd_relax_section ip2k_elf_relax_section #include "elf32-target.h" diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index 1ca96a02ba0..e059a72720f 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -350,6 +350,26 @@ iq2000_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +iq2000_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (iq2000_elf_howto_table) + / sizeof (iq2000_elf_howto_table[0])); + i++) + if (iq2000_elf_howto_table[i].name != NULL + && strcasecmp (iq2000_elf_howto_table[i].name, r_name) == 0) + return &iq2000_elf_howto_table[i]; + + if (strcasecmp (iq2000_elf_vtinherit_howto.name, r_name) == 0) + return &iq2000_elf_vtinherit_howto; + if (strcasecmp (iq2000_elf_vtentry_howto.name, r_name) == 0) + return &iq2000_elf_vtentry_howto; + + return NULL; +} /* Perform a single relocation. By default we use the standard BFD routines. */ @@ -864,6 +884,7 @@ iq2000_elf_object_p (bfd *abfd) #define elf_backend_can_gc_sections 1 #define bfd_elf32_bfd_reloc_type_lookup iq2000_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup iq2000_reloc_name_lookup #define bfd_elf32_bfd_set_private_flags iq2000_elf_set_private_flags #define bfd_elf32_bfd_copy_private_bfd_data iq2000_elf_copy_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data iq2000_elf_merge_private_bfd_data diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index b0014927dad..64b2103f51c 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -272,6 +272,21 @@ m32c_reloc_type_lookup return NULL; } +static reloc_howto_type * +m32c_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (m32c_elf_howto_table) / sizeof (m32c_elf_howto_table[0]); + i++) + if (m32c_elf_howto_table[i].name != NULL + && strcasecmp (m32c_elf_howto_table[i].name, r_name) == 0) + return &m32c_elf_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an M32C ELF reloc. */ static void @@ -2003,6 +2018,7 @@ m32c_elf_relax_delete_bytes #define elf_backend_can_gc_sections 1 #define bfd_elf32_bfd_reloc_type_lookup m32c_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup m32c_reloc_name_lookup #define bfd_elf32_bfd_relax_section m32c_elf_relax_section #define bfd_elf32_bfd_set_private_flags m32c_elf_set_private_flags #define bfd_elf32_bfd_merge_private_bfd_data m32c_elf_merge_private_bfd_data diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 915405dbf1c..c0794dc1279 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1254,6 +1254,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (m32r_elf_howto_table) / sizeof (m32r_elf_howto_table[0]); + i++) + if (m32r_elf_howto_table[i].name != NULL + && strcasecmp (m32r_elf_howto_table[i].name, r_name) == 0) + return &m32r_elf_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an M32R ELF reloc. */ static void diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 116aa92e1cc..fdb4e1ca8df 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1,5 +1,5 @@ /* Motorola 68HC11-specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) @@ -358,6 +358,23 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_m68hc11_howto_table) + / sizeof (elf_m68hc11_howto_table[0])); + i++) + if (elf_m68hc11_howto_table[i].name != NULL + && strcasecmp (elf_m68hc11_howto_table[i].name, r_name) == 0) + return &elf_m68hc11_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an M68HC11 ELF reloc. */ static void diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c index 310baae383b..46bdb9b0c56 100644 --- a/bfd/elf32-m68hc12.c +++ b/bfd/elf32-m68hc12.c @@ -1,5 +1,5 @@ /* Motorola 68HC12-specific support for 32-bit ELF - Copyright 1999, 2000, 2002, 2003, 2004, 2005, 2006 + Copyright 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) @@ -407,6 +407,23 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_m68hc11_howto_table) + / sizeof (elf_m68hc11_howto_table[0])); + i++) + if (elf_m68hc11_howto_table[i].name != NULL + && strcasecmp (elf_m68hc11_howto_table[i].name, r_name) == 0) + return &elf_m68hc11_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an M68HC11 ELF reloc. */ static void diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 580e4b5a30f..948a9960f05 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -174,7 +174,21 @@ reloc_type_lookup (abfd, code) return 0; } +static reloc_howto_type * +reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + #define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup reloc_name_lookup #define ELF_ARCH bfd_arch_m68k /* Functions for the m68k ELF linker. */ diff --git a/bfd/elf32-m88k.c b/bfd/elf32-m88k.c index 1554c23884c..aaf3600e86f 100644 --- a/bfd/elf32-m88k.c +++ b/bfd/elf32-m88k.c @@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #define ELF_MACHINE_CODE EM_88K #define ELF_MAXPAGESIZE 1 /* FIXME: This number is wrong, It should be the page size in bytes. */ #define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define elf_info_to_howto _bfd_elf_no_info_to_howto #include "elf32-target.h" diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 4c961bb7b9e..dac911f92c3 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -317,6 +317,22 @@ mcore_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return mcore_elf_howto_table [(int) mcore_reloc]; }; +static reloc_howto_type * +mcore_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mcore_elf_howto_raw) / sizeof (mcore_elf_howto_raw[0]); + i++) + if (mcore_elf_howto_raw[i].name != NULL + && strcasecmp (mcore_elf_howto_raw[i].name, r_name) == 0) + return &mcore_elf_howto_raw[i]; + + return NULL; +} + /* Set the howto pointer for a RCE ELF reloc. */ static void @@ -651,6 +667,7 @@ static const struct bfd_elf_special_section mcore_elf_special_sections[]= #define bfd_elf32_bfd_merge_private_bfd_data mcore_elf_merge_private_bfd_data #define bfd_elf32_bfd_set_private_flags mcore_elf_set_private_flags #define bfd_elf32_bfd_reloc_type_lookup mcore_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup mcore_elf_reloc_name_lookup #define elf_backend_relocate_section mcore_elf_relocate_section #define elf_backend_gc_mark_hook mcore_elf_gc_mark_hook #define elf_backend_gc_sweep_hook mcore_elf_gc_sweep_hook diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c index aec3f66bac7..100a38b7a90 100644 --- a/bfd/elf32-mep.c +++ b/bfd/elf32-mep.c @@ -168,6 +168,20 @@ mep_reloc_type_lookup #undef MAP +static reloc_howto_type * +mep_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mep_elf_howto_table) / sizeof (mep_elf_howto_table[0]); + i++) + if (mep_elf_howto_table[i].name != NULL + && strcasecmp (mep_elf_howto_table[i].name, r_name) == 0) + return &mep_elf_howto_table[i]; + + return NULL; +} /* Perform a single relocation. */ @@ -929,6 +943,7 @@ mep_elf_fake_sections (bfd * abfd ATTRIBUTE_UNUSED, #define elf_backend_can_gc_sections 1 #define bfd_elf32_bfd_reloc_type_lookup mep_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup mep_reloc_name_lookup #define bfd_elf32_bfd_set_private_flags mep_elf_set_private_flags #define bfd_elf32_bfd_copy_private_bfd_data mep_elf_copy_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data mep_elf_merge_private_bfd_data diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index ddad2da36ea..1f682791755 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. @@ -1274,6 +1274,40 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) } } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_mips_howto_table_rel) + / sizeof (elf_mips_howto_table_rel[0])); + i++) + if (elf_mips_howto_table_rel[i].name != NULL + && strcasecmp (elf_mips_howto_table_rel[i].name, r_name) == 0) + return &elf_mips_howto_table_rel[i]; + + for (i = 0; + i < (sizeof (elf_mips16_howto_table_rel) + / sizeof (elf_mips16_howto_table_rel[0])); + i++) + if (elf_mips16_howto_table_rel[i].name != NULL + && strcasecmp (elf_mips16_howto_table_rel[i].name, r_name) == 0) + return &elf_mips16_howto_table_rel[i]; + + if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0) + return &elf_mips_gnu_pcrel32; + if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) + return &elf_mips_gnu_rel16_s2; + if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) + return &elf_mips_gnu_vtinherit_howto; + if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) + return &elf_mips_gnu_vtentry_howto; + + return NULL; +} + /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * @@ -1664,6 +1698,17 @@ mips_vxworks_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) } } +static reloc_howto_type * +mips_vxworks_bfd_reloc_name_lookup (bfd *abfd, const char *r_name) +{ + if (strcasecmp (mips_vxworks_copy_howto_rela.name, r_name) == 0) + return &mips_vxworks_copy_howto_rela; + if (strcasecmp (mips_vxworks_jump_slot_howto_rela.name, r_name) == 0) + return &mips_vxworks_jump_slot_howto_rela; + + return bfd_elf32_bfd_reloc_name_lookup (abfd, r_name); +} + /* Implement elf_backend_mips_rtype_to_lookup for VxWorks. */ static reloc_howto_type * @@ -1730,6 +1775,9 @@ mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) #undef bfd_elf32_bfd_reloc_type_lookup #define bfd_elf32_bfd_reloc_type_lookup \ mips_vxworks_bfd_reloc_type_lookup +#undef bfd_elf32_bfd_reloc_name_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + mips_vxworks_bfd_reloc_name_lookup #undef elf_backend_mips_rtype_to_howto #define elf_backend_mips_rtype_to_howto \ mips_vxworks_rtype_to_howto diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index c8124e78629..6e28b73f5b5 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -200,6 +200,23 @@ bfd_elf32_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_msp430_howto_table) + / sizeof (elf_msp430_howto_table[0])); + i++) + if (elf_msp430_howto_table[i].name != NULL + && strcasecmp (elf_msp430_howto_table[i].name, r_name) == 0) + return &elf_msp430_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an MSP430 ELF reloc. */ static void diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c index 0b2bb26bf45..fa1ee484aa4 100644 --- a/bfd/elf32-mt.c +++ b/bfd/elf32-mt.c @@ -187,6 +187,22 @@ mt_reloc_type_lookup return NULL; } +static reloc_howto_type * +mt_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mt_elf_howto_table) / sizeof (mt_elf_howto_table[0]); + i++) + if (mt_elf_howto_table[i].name != NULL + && strcasecmp (mt_elf_howto_table[i].name, r_name) == 0) + return &mt_elf_howto_table[i]; + + return NULL; +} + bfd_reloc_status_type mt_elf_relocate_hi16 (bfd * input_bfd, @@ -592,6 +608,7 @@ mt_elf_print_private_bfd_data (bfd * abfd, void * ptr) #define elf_backend_relocate_section mt_elf_relocate_section #define bfd_elf32_bfd_reloc_type_lookup mt_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup mt_reloc_name_lookup #define elf_backend_check_relocs mt_elf_check_relocs #define elf_backend_object_p mt_elf_object_p diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c index d6b40497633..bd491cc8040 100644 --- a/bfd/elf32-openrisc.c +++ b/bfd/elf32-openrisc.c @@ -192,9 +192,9 @@ static const struct openrisc_reloc_map openrisc_reloc_map[] = { BFD_RELOC_32, R_OPENRISC_32 }, { BFD_RELOC_16, R_OPENRISC_16 }, { BFD_RELOC_8, R_OPENRISC_8 }, - { BFD_RELOC_OPENRISC_REL_26,R_OPENRISC_INSN_REL_26 }, - { BFD_RELOC_OPENRISC_ABS_26,R_OPENRISC_INSN_ABS_26 }, - { BFD_RELOC_HI16, R_OPENRISC_HI_16_IN_INSN }, + { BFD_RELOC_OPENRISC_REL_26, R_OPENRISC_INSN_REL_26 }, + { BFD_RELOC_OPENRISC_ABS_26, R_OPENRISC_INSN_ABS_26 }, + { BFD_RELOC_HI16, R_OPENRISC_HI_16_IN_INSN }, { BFD_RELOC_LO16, R_OPENRISC_LO_16_IN_INSN }, { BFD_RELOC_VTABLE_INHERIT, R_OPENRISC_GNU_VTINHERIT }, { BFD_RELOC_VTABLE_ENTRY, R_OPENRISC_GNU_VTENTRY } @@ -214,6 +214,23 @@ openrisc_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +openrisc_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (openrisc_elf_howto_table) + / sizeof (openrisc_elf_howto_table[0])); + i++) + if (openrisc_elf_howto_table[i].name != NULL + && strcasecmp (openrisc_elf_howto_table[i].name, r_name) == 0) + return &openrisc_elf_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an OpenRISC ELF reloc. */ static void @@ -550,6 +567,7 @@ openrisc_elf_final_write_processing (bfd *abfd, #define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup openrisc_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup openrisc_reloc_name_lookup #define elf_backend_object_p openrisc_elf_object_p #define elf_backend_final_write_processing openrisc_elf_final_write_processing diff --git a/bfd/elf32-or32.c b/bfd/elf32-or32.c index 546aa151f5c..7b42c92c611 100644 --- a/bfd/elf32-or32.c +++ b/bfd/elf32-or32.c @@ -1,5 +1,5 @@ /* OR32-specific support for 32-bit ELF - Copyright 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright 2002, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Ivan Guzvinec <ivang@opencores.org> This file is part of BFD, the Binary File Descriptor library. @@ -466,6 +466,22 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_or32_howto_table) / sizeof (elf_or32_howto_table[0]); + i++) + if (elf_or32_howto_table[i].name != NULL + && strcasecmp (elf_or32_howto_table[i].name, r_name) == 0) + return &elf_or32_howto_table[i]; + + return NULL; +} + /* Set the howto pointer for an OR32 ELF reloc. */ static void diff --git a/bfd/elf32-pj.c b/bfd/elf32-pj.c index bd0a5b49ffa..dedd0e2f819 100644 --- a/bfd/elf32-pj.c +++ b/bfd/elf32-pj.c @@ -1,5 +1,6 @@ /* picoJava specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2005, 2007 + Free Software Foundation, Inc. Contributed by Steve Chamberlan of Transmeta (sac@pobox.com). This file is part of BFD, the Binary File Descriptor library. @@ -291,6 +292,22 @@ pj_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +pj_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (pj_elf_howto_table) / sizeof (pj_elf_howto_table[0]); + i++) + if (pj_elf_howto_table[i].name != NULL + && strcasecmp (pj_elf_howto_table[i].name, r_name) == 0) + return &pj_elf_howto_table[i]; + + return NULL; +} + /* Given an ELF reloc, fill in the howto field of a relent. */ static void @@ -326,8 +343,10 @@ pj_elf_final_write_processing (bfd *abfd, #define ELF_MACHINE_CODE EM_PJ #define ELF_MACHINE_ALT1 EM_PJ_OLD #define ELF_MAXPAGESIZE 0x1000 -#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents -#define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup -#define elf_backend_final_write_processing pj_elf_final_write_processing -#define elf_info_to_howto pj_elf_info_to_howto +#define bfd_elf32_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup pj_elf_reloc_name_lookup +#define elf_backend_final_write_processing pj_elf_final_write_processing +#define elf_info_to_howto pj_elf_info_to_howto #include "elf32-target.h" diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index adf9d258be3..2355687665d 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1578,6 +1578,22 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return ppc_elf_howto_table[r]; }; +static reloc_howto_type * +ppc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); + i++) + if (ppc_elf_howto_raw[i].name != NULL + && strcasecmp (ppc_elf_howto_raw[i].name, r_name) == 0) + return &ppc_elf_howto_raw[i]; + + return NULL; +} + /* Set the howto pointer for a PowerPC ELF reloc. */ static void @@ -7497,6 +7513,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data #define bfd_elf32_bfd_relax_section ppc_elf_relax_section #define bfd_elf32_bfd_reloc_type_lookup ppc_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup ppc_elf_reloc_name_lookup #define bfd_elf32_bfd_set_private_flags ppc_elf_set_private_flags #define bfd_elf32_bfd_link_hash_table_create ppc_elf_link_hash_table_create diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 40338573b89..75d9692e974 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -334,6 +334,25 @@ elf_s390_reloc_type_lookup (abfd, code) return 0; } +static reloc_howto_type * +elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + if (strcasecmp (elf32_s390_vtinherit_howto.name, r_name) == 0) + return &elf32_s390_vtinherit_howto; + if (strcasecmp (elf32_s390_vtentry_howto.name, r_name) == 0) + return &elf32_s390_vtentry_howto; + + return NULL; +} + /* We need to use ELF32_R_TYPE so we have our own copy of this function, and elf32-s390.c has its own copy. */ @@ -3540,6 +3559,7 @@ elf_s390_plt_sym_val (bfd_vma i, const asection *plt, #define bfd_elf32_bfd_is_local_label_name elf_s390_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_s390_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf_s390_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup elf_s390_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol #define elf_backend_check_relocs elf_s390_check_relocs diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 4ad4eb80aa4..b121ef24175 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -3699,6 +3699,23 @@ elf32_score_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_t return NULL; } +static reloc_howto_type * +elf32_score_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf32_score_howto_table) + / sizeof (elf32_score_howto_table[0])); + i++) + if (elf32_score_howto_table[i].name != NULL + && strcasecmp (elf32_score_howto_table[i].name, r_name) == 0) + return &elf32_score_howto_table[i]; + + return NULL; +} + /* Create a score elf linker hash table. */ static struct bfd_link_hash_table * @@ -3856,6 +3873,8 @@ elf32_score_new_section_hook (bfd *abfd, asection *sec) #define elf_backend_type_change_ok TRUE #define bfd_elf32_bfd_reloc_type_lookup elf32_score_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + elf32_score_reloc_name_lookup #define bfd_elf32_bfd_link_hash_table_create elf32_score_link_hash_table_create #define bfd_elf32_bfd_print_private_bfd_data elf32_score_print_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data elf32_score_merge_private_bfd_data diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 07b069e719f..2ee1e2c8187 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -402,6 +402,35 @@ sh_elf_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) return NULL; } +static reloc_howto_type * +sh_elf_reloc_name_lookup (bfd *abfd, const char *r_name) +{ + unsigned int i; + + if (vxworks_object_p (abfd)) + { + for (i = 0; + i < (sizeof (sh_vxworks_howto_table) + / sizeof (sh_vxworks_howto_table[0])); + i++) + if (sh_vxworks_howto_table[i].name != NULL + && strcasecmp (sh_vxworks_howto_table[i].name, r_name) == 0) + return &sh_vxworks_howto_table[i]; + } + else + { + for (i = 0; + i < (sizeof (sh_elf_howto_table) + / sizeof (sh_elf_howto_table[0])); + i++) + if (sh_elf_howto_table[i].name != NULL + && strcasecmp (sh_elf_howto_table[i].name, r_name) == 0) + return &sh_elf_howto_table[i]; + } + + return NULL; +} + /* Given an ELF reloc, fill in the howto field of a relent. */ static void @@ -6010,6 +6039,8 @@ sh_elf_plt_sym_val (bfd_vma i, const asection *plt, #define elf_symbol_leading_char '_' #define bfd_elf32_bfd_reloc_type_lookup sh_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + sh_elf_reloc_name_lookup #define elf_info_to_howto sh_elf_info_to_howto #define bfd_elf32_bfd_relax_section sh_elf_relax_section #define elf_backend_relocate_section sh_elf_relocate_section diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 5f13b9613db..3c5cbdea702 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -183,6 +183,8 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela) #define elf_info_to_howto _bfd_sparc_elf_info_to_howto #define bfd_elf32_bfd_reloc_type_lookup _bfd_sparc_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + _bfd_sparc_elf_reloc_name_lookup #define bfd_elf32_bfd_link_hash_table_create \ _bfd_sparc_elf_link_hash_table_create #define bfd_elf32_bfd_relax_section _bfd_sparc_elf_relax_section diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index a48a0bcaa92..25783c0df2d 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -142,6 +142,20 @@ spu_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return elf_howto_table + spu_elf_bfd_to_reloc_type (code); } +static reloc_howto_type * +spu_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + return NULL; +} + /* Apply R_SPU_REL9 and R_SPU_REL9I relocs. */ static bfd_reloc_status_type @@ -1756,6 +1770,7 @@ spu_elf_section_processing (bfd *abfd ATTRIBUTE_UNUSED, #define elf_backend_can_gc_sections 1 #define bfd_elf32_bfd_reloc_type_lookup spu_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup spu_elf_reloc_name_lookup #define elf_info_to_howto spu_elf_info_to_howto #define elf_backend_gc_mark_hook spu_elf_gc_mark_hook #define elf_backend_relocate_section spu_elf_relocate_section diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 6bb579523a6..a02210938d0 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1339,6 +1339,22 @@ v850_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } + +static reloc_howto_type * +v850_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (v850_elf_howto_table) / sizeof (v850_elf_howto_table[0]); + i++) + if (v850_elf_howto_table[i].name != NULL + && strcasecmp (v850_elf_howto_table[i].name, r_name) == 0) + return &v850_elf_howto_table[i]; + + return NULL; +} /* Set the howto pointer for an V850 ELF reloc. */ @@ -3073,6 +3089,7 @@ static const struct bfd_elf_special_section v850_elf_special_sections[] = #define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name #define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup v850_elf_reloc_name_lookup #define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data #define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index b25e20aa5a3..fce01e21579 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1,6 +1,6 @@ /* VAX series support for 32-bit ELF Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Matt Thomas <matt@3am-software.com>. This file is part of BFD, the Binary File Descriptor library. @@ -322,7 +322,22 @@ reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) return 0; } +static reloc_howto_type * +reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + #define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup reloc_name_lookup #define ELF_ARCH bfd_arch_vax /* end code generated by elf.el */ diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c index 282b68bd5fa..dc9b3bca387 100644 --- a/bfd/elf32-xc16x.c +++ b/bfd/elf32-xc16x.c @@ -205,6 +205,22 @@ xc16x_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +xc16x_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (xc16x_elf_howto_table) / sizeof (xc16x_elf_howto_table[0]); + i++) + if (xc16x_elf_howto_table[i].name != NULL + && strcasecmp (xc16x_elf_howto_table[i].name, r_name) == 0) + return &xc16x_elf_howto_table[i]; + + return NULL; +} + /* For a particular operand this function is called to finalise the type of relocation. */ @@ -454,6 +470,7 @@ elf32_xc16x_object_p (bfd *abfd) #define elf_backend_object_p elf32_xc16x_object_p #define elf_backend_can_gc_sections 1 #define bfd_elf32_bfd_reloc_type_lookup xc16x_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup xc16x_reloc_name_lookup #define elf_info_to_howto elf32_xc16x_info_to_howto #define elf_info_to_howto_rel elf32_xc16x_info_to_howto #define elf_backend_relocate_section elf32_xc16x_relocate_section diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 1d3bb5523d6..07f8e1447a5 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -349,6 +349,31 @@ xstormy16_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +xstormy16_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (xstormy16_elf_howto_table) + / sizeof (xstormy16_elf_howto_table[0])); + i++) + if (xstormy16_elf_howto_table[i].name != NULL + && strcasecmp (xstormy16_elf_howto_table[i].name, r_name) == 0) + return &xstormy16_elf_howto_table[i]; + + for (i = 0; + i < (sizeof (xstormy16_elf_howto_table2) + / sizeof (xstormy16_elf_howto_table2[0])); + i++) + if (xstormy16_elf_howto_table2[i].name != NULL + && strcasecmp (xstormy16_elf_howto_table2[i].name, r_name) == 0) + return &xstormy16_elf_howto_table2[i]; + + return NULL; +} + /* Set the howto pointer for an XSTORMY16 ELF reloc. */ static void @@ -1019,6 +1044,8 @@ xstormy16_elf_gc_mark_hook (asection *sec, #define elf_backend_rela_normal 1 #define bfd_elf32_bfd_reloc_type_lookup xstormy16_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + xstormy16_reloc_name_lookup #define bfd_elf32_bfd_relax_section xstormy16_elf_relax_section #include "elf32-target.h" diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 0c7b73e64d1..1d6fb42e6a9 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -389,6 +389,20 @@ elf_xtensa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +elf_xtensa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + return NULL; +} + /* Given an ELF "rela" relocation, find the corresponding howto and record it in the BFD internal arelent representation of the relocation. */ @@ -9808,6 +9822,8 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] = #define bfd_elf32_bfd_print_private_bfd_data elf_xtensa_print_private_bfd_data #define bfd_elf32_bfd_relax_section elf_xtensa_relax_section #define bfd_elf32_bfd_reloc_type_lookup elf_xtensa_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + elf_xtensa_reloc_name_lookup #define bfd_elf32_bfd_set_private_flags elf_xtensa_set_private_flags #define bfd_elf32_bfd_link_hash_table_create elf_xtensa_link_hash_table_create diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index efda7530e5b..89475793886 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1055,6 +1055,23 @@ elf64_alpha_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return 0; } +static reloc_howto_type * +elf64_alpha_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf64_alpha_howto_table) + / sizeof (elf64_alpha_howto_table[0])); + i++) + if (elf64_alpha_howto_table[i].name != NULL + && strcasecmp (elf64_alpha_howto_table[i].name, r_name) == 0) + return &elf64_alpha_howto_table[i]; + + return NULL; +} + /* Given an Alpha ELF reloc type, fill in an arelent structure. */ static void @@ -5282,6 +5299,8 @@ static const struct elf_size_info alpha_elf_size_info = #define bfd_elf64_bfd_reloc_type_lookup \ elf64_alpha_bfd_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup \ + elf64_alpha_bfd_reloc_name_lookup #define elf_info_to_howto \ elf64_alpha_info_to_howto diff --git a/bfd/elf64-gen.c b/bfd/elf64-gen.c index 49b8d9c5528..2077fe53335 100644 --- a/bfd/elf64-gen.c +++ b/bfd/elf64-gen.c @@ -1,5 +1,5 @@ /* Generic support for 64-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005 + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -94,6 +94,7 @@ elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info) #define ELF_MACHINE_CODE EM_NONE #define ELF_MAXPAGESIZE 0x1 #define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define bfd_elf64_bfd_link_add_symbols elf64_generic_link_add_symbols #define elf_info_to_howto elf_generic_info_to_howto #define elf_info_to_howto_rel elf_generic_info_to_howto_rel diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 8e7e9d15a45..981d822d0c4 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -1,5 +1,5 @@ /* Support for HPPA 64-bit ELF - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -2796,6 +2796,7 @@ const struct elf_size_info hppa64_elf_size_info = #define ELF_OSABI ELFOSABI_HPUX #define bfd_elf64_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup elf_hppa_reloc_name_lookup #define bfd_elf64_bfd_is_local_label_name elf_hppa_is_local_label_name #define elf_info_to_howto elf_hppa_info_to_howto #define elf_info_to_howto_rel elf_hppa_info_to_howto_rel diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 34b02e47473..4c6b5112bb6 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 64-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2007 Free Software Foundation, Inc. Ian Lance Taylor, Cygnus Support Linker support added by Mark Mitchell, CodeSourcery, LLC. <mark@codesourcery.com> @@ -2224,6 +2224,39 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (mips_elf64_howto_table_rela) + / sizeof (mips_elf64_howto_table_rela[0])); i++) + if (mips_elf64_howto_table_rela[i].name != NULL + && strcasecmp (mips_elf64_howto_table_rela[i].name, r_name) == 0) + return &mips_elf64_howto_table_rela[i]; + + for (i = 0; + i < (sizeof (mips16_elf64_howto_table_rela) + / sizeof (mips16_elf64_howto_table_rela[0])); + i++) + if (mips16_elf64_howto_table_rela[i].name != NULL + && strcasecmp (mips16_elf64_howto_table_rela[i].name, r_name) == 0) + return &mips16_elf64_howto_table_rela[i]; + + if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) + return &elf_mips_gnu_vtinherit_howto; + if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) + return &elf_mips_gnu_vtentry_howto; + if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) + return &elf_mips_gnu_rel16_s2; + if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0) + return &elf_mips_gnu_rela16_s2; + + return NULL; +} + /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 2e9577c1c51..e55257c1327 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -848,6 +848,22 @@ bfd_elf64_bfd_reloc_type_lookup (abfd, code) return NULL; } +static reloc_howto_type * +bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_mmix_howto_table) / sizeof (elf_mmix_howto_table[0]); + i++) + if (elf_mmix_howto_table[i].name != NULL + && strcasecmp (elf_mmix_howto_table[i].name, r_name) == 0) + return &elf_mmix_howto_table[i]; + + return NULL; +} + static bfd_boolean mmix_elf_new_section_hook (abfd, sec) bfd *abfd; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 50c2191c552..23b54c4cf1b 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -77,6 +77,7 @@ static bfd_vma opd_entry_value #define bfd_elf64_mkobject ppc64_elf_mkobject #define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup ppc64_elf_reloc_name_lookup #define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data #define bfd_elf64_new_section_hook ppc64_elf_new_section_hook #define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create @@ -2111,6 +2112,22 @@ ppc64_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return ppc64_elf_howto_table[r]; }; +static reloc_howto_type * +ppc64_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]); + i++) + if (ppc64_elf_howto_raw[i].name != NULL + && strcasecmp (ppc64_elf_howto_raw[i].name, r_name) == 0) + return &ppc64_elf_howto_raw[i]; + + return NULL; +} + /* Set the howto pointer for a PowerPC ELF reloc. */ static void diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 6bdcd8deefb..74162486f34 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -356,6 +356,27 @@ elf_s390_reloc_type_lookup (abfd, code) return 0; } +static reloc_howto_type * +elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); + i++) + if (elf_howto_table[i].name != NULL + && strcasecmp (elf_howto_table[i].name, r_name) == 0) + return &elf_howto_table[i]; + + if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0) + return &elf64_s390_vtinherit_howto; + if (strcasecmp (elf64_s390_vtentry_howto.name, r_name) == 0) + return &elf64_s390_vtentry_howto; + + return NULL; +} + /* We need to use ELF64_R_TYPE so we have our own copy of this function, and elf64-s390.c has its own copy. */ @@ -3448,6 +3469,7 @@ const struct elf_size_info s390_elf64_size_info = #define bfd_elf64_bfd_is_local_label_name elf_s390_is_local_label_name #define bfd_elf64_bfd_link_hash_table_create elf_s390_link_hash_table_create #define bfd_elf64_bfd_reloc_type_lookup elf_s390_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup elf_s390_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol #define elf_backend_check_relocs elf_s390_check_relocs diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 8f7ec66eaff..5050829e440 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1392,6 +1392,22 @@ sh_elf64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +sh_elf64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (sh_elf64_howto_table) / sizeof (sh_elf64_howto_table[0]); + i++) + if (sh_elf64_howto_table[i].name != NULL + && strcasecmp (sh_elf64_howto_table[i].name, r_name) == 0) + return &sh_elf64_howto_table[i]; + + return NULL; +} + /* Given an ELF reloc, fill in the howto field of a relent. See sh_elf_info_to_howto in elf32-sh.c for the original. */ @@ -4060,6 +4076,8 @@ static const struct bfd_elf_special_section sh64_elf64_special_sections[]= #define elf_symbol_leading_char '_' #define bfd_elf64_bfd_reloc_type_lookup sh_elf64_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup \ + sh_elf64_reloc_name_lookup #define elf_info_to_howto sh_elf64_info_to_howto /* Note: there's no relaxation at present. */ diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index f9d4c817092..3669a352447 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 64-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -859,6 +859,8 @@ const struct elf_size_info elf64_sparc_size_info = _bfd_sparc_elf_copy_indirect_symbol #define bfd_elf64_bfd_reloc_type_lookup \ _bfd_sparc_elf_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup \ + _bfd_sparc_elf_reloc_name_lookup #define bfd_elf64_bfd_relax_section \ _bfd_sparc_elf_relax_section #define bfd_elf64_new_section_hook \ diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index eec8441c111..f171b197acf 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -246,6 +246,23 @@ elf64_x86_64_reloc_type_lookup (bfd *abfd, return 0; } +static reloc_howto_type * +elf64_x86_64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (x86_64_elf_howto_table) + / sizeof (x86_64_elf_howto_table[0])); + i++) + if (x86_64_elf_howto_table[i].name != NULL + && strcasecmp (x86_64_elf_howto_table[i].name, r_name) == 0) + return &x86_64_elf_howto_table[i]; + + return NULL; +} + /* Given an x86_64 ELF reloc type, fill in an arelent structure. */ static void @@ -3660,6 +3677,8 @@ static const struct bfd_elf_special_section #define bfd_elf64_bfd_link_hash_table_create \ elf64_x86_64_link_hash_table_create #define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup +#define bfd_elf64_bfd_reloc_name_lookup \ + elf64_x86_64_reloc_name_lookup #define elf_backend_adjust_dynamic_symbol elf64_x86_64_adjust_dynamic_symbol #define elf_backend_check_relocs elf64_x86_64_check_relocs diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index a14760e1bff..f4d180b175b 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. @@ -2081,6 +2081,40 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } } +static reloc_howto_type * +bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (elf_mips_howto_table_rela) + / sizeof (elf_mips_howto_table_rela[0])); + i++) + if (elf_mips_howto_table_rela[i].name != NULL + && strcasecmp (elf_mips_howto_table_rela[i].name, r_name) == 0) + return &elf_mips_howto_table_rela[i]; + + for (i = 0; + i < (sizeof (elf_mips16_howto_table_rela) + / sizeof (elf_mips16_howto_table_rela[0])); + i++) + if (elf_mips16_howto_table_rela[i].name != NULL + && strcasecmp (elf_mips16_howto_table_rela[i].name, r_name) == 0) + return &elf_mips16_howto_table_rela[i]; + + if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0) + return &elf_mips_gnu_vtinherit_howto; + if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) + return &elf_mips_gnu_vtentry_howto; + if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) + return &elf_mips_gnu_rel16_s2; + if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0) + return &elf_mips_gnu_rela16_s2; + + return NULL; +} + /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */ static reloc_howto_type * diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index a0a1b1c0ee1..3c6a4a39b2b 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -613,6 +613,22 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code) return lookup_howto (rtype); } +static reloc_howto_type * +elfNN_ia64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (ia64_howto_table) / sizeof (ia64_howto_table[0]); + i++) + if (ia64_howto_table[i].name != NULL + && strcasecmp (ia64_howto_table[i].name, r_name) == 0) + return &ia64_howto_table[i]; + + return NULL; +} + /* Given a ELF reloc, return the matching HOWTO structure. */ static void @@ -5748,6 +5764,8 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define bfd_elfNN_bfd_reloc_type_lookup \ elfNN_ia64_reloc_type_lookup +#define bfd_elfNN_bfd_reloc_name_lookup \ + elfNN_ia64_reloc_name_lookup #define bfd_elfNN_bfd_is_local_label_name \ elfNN_ia64_is_local_label_name #define bfd_elfNN_bfd_relax_section \ diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index b145cdcb137..2fa65335077 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -385,6 +385,30 @@ _bfd_sparc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, } reloc_howto_type * +_bfd_sparc_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < (sizeof (_bfd_sparc_elf_howto_table) + / sizeof (_bfd_sparc_elf_howto_table[0])); + i++) + if (_bfd_sparc_elf_howto_table[i].name != NULL + && strcasecmp (_bfd_sparc_elf_howto_table[i].name, r_name) == 0) + return &_bfd_sparc_elf_howto_table[i]; + + if (strcasecmp (sparc_vtinherit_howto.name, r_name) == 0) + return &sparc_vtinherit_howto; + if (strcasecmp (sparc_vtentry_howto.name, r_name) == 0) + return &sparc_vtentry_howto; + if (strcasecmp (sparc_rev32_howto.name, r_name) == 0) + return &sparc_rev32_howto; + + return NULL; +} + +reloc_howto_type * _bfd_sparc_elf_info_to_howto_ptr (unsigned int r_type) { switch (r_type) diff --git a/bfd/elfxx-sparc.h b/bfd/elfxx-sparc.h index 0a5a88b6fe3..4e4367e3e5e 100644 --- a/bfd/elfxx-sparc.h +++ b/bfd/elfxx-sparc.h @@ -1,5 +1,5 @@ /* SPARC ELF specific backend routines. - Copyright 2005 Free Software Foundation, Inc. + Copyright 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -97,6 +97,8 @@ struct _bfd_sparc_elf_link_hash_table extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup (bfd *, bfd_reloc_code_real_type); +extern reloc_howto_type *_bfd_sparc_elf_reloc_name_lookup + (bfd *, const char *); extern void _bfd_sparc_elf_info_to_howto (bfd *, arelent *, Elf_Internal_Rela *); extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 3e1a69edc7e..b7dd075157f 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -1,6 +1,6 @@ /* BFD back-end for MS-DOS executables. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, - 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Bryan Ford of the University of Utah. Contributed by the Center for Software Science at the @@ -130,6 +130,7 @@ msdos_set_section_contents (bfd *abfd, #define msdos_mkobject aout_32_mkobject #define msdos_make_empty_symbol aout_32_make_empty_symbol #define msdos_bfd_reloc_type_lookup aout_32_reloc_type_lookup +#define msdos_bfd_reloc_name_lookup aout_32_reloc_name_lookup #define msdos_close_and_cleanup _bfd_generic_close_and_cleanup #define msdos_bfd_free_cached_info _bfd_generic_bfd_free_cached_info diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index 062f39b278d..9c9fef44065 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -1,6 +1,6 @@ /* BFD back-end for os9000 i386 binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002, - 2004, 2005, 2006 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -158,6 +158,7 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define aout_32_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define aout_32_get_section_contents_in_window \ _bfd_generic_get_section_contents_in_window diff --git a/bfd/ieee.c b/bfd/ieee.c index 0d60ad1e19c..6ea0700edb6 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -1,6 +1,6 @@ /* BFD back-end for ieee-695 objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -3747,6 +3747,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol #define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define ieee_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define ieee_set_arch_mach _bfd_generic_set_arch_mach diff --git a/bfd/libaout.h b/bfd/libaout.h index 1a6ff98941b..879de1380bd 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -1,6 +1,6 @@ /* BFD back-end data structures for a.out (and similar) files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Cygnus Support. @@ -525,6 +525,9 @@ extern void NAME (aout, swap_std_reloc_in) extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); +extern reloc_howto_type * NAME (aout, reloc_name_lookup) + (bfd *, const char *); + extern bfd_boolean NAME (aout, slurp_reloc_table) (bfd *, sec_ptr, asymbol **); diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 2a51caa8d14..3555e6a8eef 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -353,6 +353,8 @@ extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *, arelent **, asymbol **); #define _bfd_norelocs_bfd_reloc_type_lookup \ ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) +#define _bfd_norelocs_bfd_reloc_name_lookup \ + ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index c480d9a3d47..92bf14a4e18 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -358,6 +358,8 @@ extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *, arelent **, asymbol **); #define _bfd_norelocs_bfd_reloc_type_lookup \ ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) +#define _bfd_norelocs_bfd_reloc_name_lookup \ + ((reloc_howto_type *(*) (bfd *, const char *)) bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index b8621e486ae..a53345df238 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -1,6 +1,6 @@ /* BFD backend for MIPS BSD (a.out) binaries. - Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2007 Free Software Foundation, Inc. Written by Ralph Campbell. This file is part of BFD, the Binary File Descriptor library. @@ -56,7 +56,8 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); /* We can't use MY(x) here because it leads to a recursive call to CONCAT2 when expanded inside JUMP_TABLE. */ -#define MY_bfd_reloc_type_lookup mipsbsd_reloc_howto_type_lookup +#define MY_bfd_reloc_type_lookup mipsbsd_reloc_type_lookup +#define MY_bfd_reloc_name_lookup mipsbsd_reloc_name_lookup #define MY_canonicalize_reloc mipsbsd_canonicalize_reloc #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create @@ -72,8 +73,6 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); static bfd_reloc_status_type mips_fix_jmp_addr PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *MY(reloc_howto_type_lookup) - PARAMS ((bfd *, bfd_reloc_code_real_type)); long MY(canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); @@ -302,9 +301,7 @@ static reloc_howto_type mips_howto_table_ext[] = { }; static reloc_howto_type * -MY(reloc_howto_type_lookup) (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; +MY(reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code) { if (bfd_get_arch (abfd) != bfd_arch_mips) @@ -330,6 +327,22 @@ MY(reloc_howto_type_lookup) (abfd, code) } } +static reloc_howto_type * +MY(reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (mips_howto_table_ext) / sizeof (mips_howto_table_ext[0]); + i++) + if (mips_howto_table_ext[i].name != NULL + && strcasecmp (mips_howto_table_ext[i].name, r_name) == 0) + return &mips_howto_table_ext[i]; + + return NULL; +} + /* This is just like the standard aoutx.h version but we need to do our own mapping of external reloc type values to howto entries. */ long diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index 3358aef8e75..7556112b5bd 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -1,6 +1,6 @@ /* Target definitions for 32/64-bit NLM (NetWare Loadable Module) Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005 Free Software Foundation, Inc. + 2005, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -37,6 +37,7 @@ #define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound) #define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc) #define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup +#define nlm_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define nlm_set_section_contents nlmNAME (set_section_contents) #define nlm_sizeof_headers _bfd_nolink_sizeof_headers diff --git a/bfd/oasys.c b/bfd/oasys.c index ec08555afd0..95a708f77b4 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1,6 +1,6 @@ /* BFD back-end for oasys objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, - 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>. This file is part of BFD, the Binary File Descriptor library. @@ -1187,6 +1187,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define oasys_read_minisymbols _bfd_generic_read_minisymbols #define oasys_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol #define oasys_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define oasys_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define oasys_set_arch_mach bfd_default_set_arch_mach #define oasys_get_section_contents_in_window _bfd_generic_get_section_contents_in_window #define oasys_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents diff --git a/bfd/pdp11.c b/bfd/pdp11.c index a3950793822..ad7fe1ed68d 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -1,5 +1,5 @@ /* BFD back-end for PDP-11 a.out binaries. - Copyright 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -277,6 +277,22 @@ NAME (aout, reloc_type_lookup) (bfd * abfd ATTRIBUTE_UNUSED, } } +reloc_howto_type * +NAME (aout, reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (howto_table_pdp11) / sizeof (howto_table_pdp11[0]); + i++) + if (howto_table_pdp11[i].name != NULL + && strcasecmp (howto_table_pdp11[i].name, r_name) == 0) + return &howto_table_pdp11[i]; + + return NULL; +} + static int pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp) { diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c index 03d6beca981..63ab4ac291d 100644 --- a/bfd/pe-mips.c +++ b/bfd/pe-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS PE COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Modified from coff-i386.c by DJ Delorie, dj@cygnus.com This file is part of BFD, the Binary File Descriptor library. @@ -453,6 +453,7 @@ coff_mips_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, #define coff_rtype_to_howto coff_mips_rtype_to_howto #define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup +#define coff_bfd_reloc_name_lookup coff_mips_reloc_name_lookup /* Get the howto structure for a generic reloc type. */ @@ -496,6 +497,22 @@ coff_mips_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return & howto_table [mips_type]; } +static reloc_howto_type * +coff_mips_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (howto_table) / sizeof (howto_table[0]); + i++) + if (howto_table[i].name != NULL + && strcasecmp (howto_table[i].name, r_name) == 0) + return &howto_table[i]; + + return NULL; +} + static void mips_swap_reloc_in (bfd * abfd, void * src, void * dst) { diff --git a/bfd/reloc.c b/bfd/reloc.c index a31ebe0aaee..06828627d8b 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -4942,10 +4942,13 @@ CODE_FRAGMENT /* FUNCTION bfd_reloc_type_lookup + bfd_reloc_name_lookup SYNOPSIS reloc_howto_type *bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); + reloc_howto_type *bfd_reloc_name_lookup + (bfd *abfd, const char *reloc_name); DESCRIPTION Return a pointer to a howto structure which, when @@ -4960,6 +4963,12 @@ bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) return BFD_SEND (abfd, reloc_type_lookup, (abfd, code)); } +reloc_howto_type * +bfd_reloc_name_lookup (bfd *abfd, const char *reloc_name) +{ + return BFD_SEND (abfd, reloc_name_lookup, (abfd, reloc_name)); +} + static reloc_howto_type bfd_howto_32 = HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_dont, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE); diff --git a/bfd/riscix.c b/bfd/riscix.c index 182707981e4..04fee615443 100644 --- a/bfd/riscix.c +++ b/bfd/riscix.c @@ -1,6 +1,6 @@ /* BFD back-end for RISC iX (Acorn, arm) binaries. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, - 2005 Free Software Foundation, Inc. + 2005, 2007 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -274,12 +274,29 @@ riscix_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) } } +static reloc_howto_type * +riscix_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (riscix_std_reloc_howto) / sizeof (riscix_std_reloc_howto[0]); + i++) + if (riscix_std_reloc_howto[i].name != NULL + && strcasecmp (riscix_std_reloc_howto[i].name, r_name) == 0) + return &riscix_std_reloc_howto[i]; + + return NULL; +} + #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols #define MY_final_link_callback should_not_be_used #define MY_bfd_final_link _bfd_generic_final_link #define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup +#define MY_bfd_reloc_name_lookup riscix_reloc_name_lookup #define MY_canonicalize_reloc riscix_canonicalize_reloc #define MY_object_p riscix_object_p diff --git a/bfd/som.c b/bfd/som.c index 4d00d49a323..469310785dd 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -1,6 +1,6 @@ /* bfd back-end for HP PA-RISC SOM objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by the Center for Software Science at the @@ -1626,6 +1626,22 @@ som_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return NULL; } +static reloc_howto_type * +som_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (som_hppa_howto_table) / sizeof (som_hppa_howto_table[0]); + i++) + if (som_hppa_howto_table[i].name != NULL + && strcasecmp (som_hppa_howto_table[i].name, r_name) == 0) + return &som_hppa_howto_table[i]; + + return NULL; +} + /* Perform some initialization for an object. Save results of this initialization in the BFD. */ diff --git a/bfd/targets.c b/bfd/targets.c index 13247796170..622d86bd148 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -402,7 +402,8 @@ BFD_JUMP_TABLE macros. .#define BFD_JUMP_TABLE_RELOCS(NAME) \ . NAME##_get_reloc_upper_bound, \ . NAME##_canonicalize_reloc, \ -. NAME##_bfd_reloc_type_lookup +. NAME##_bfd_reloc_type_lookup, \ +. NAME##_bfd_reloc_name_lookup . . long (*_get_reloc_upper_bound) (bfd *, sec_ptr); . long (*_bfd_canonicalize_reloc) @@ -410,6 +411,8 @@ BFD_JUMP_TABLE macros. . {* See documentation on reloc types. *} . reloc_howto_type * . (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); +. reloc_howto_type * +. (*reloc_name_lookup) (bfd *, const char *); . . . {* Routines used when writing an object file. *} diff --git a/bfd/versados.c b/bfd/versados.c index c29483e4c68..f7a7cad1f33 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -1,6 +1,6 @@ /* BFD back-end for VERSAdos-E objects. Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006 Free Software Foundation, Inc. + 2006, 2007 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. Versados is a Motorola trademark. @@ -798,6 +798,7 @@ versados_canonicalize_reloc (bfd *abfd, #define versados_read_minisymbols _bfd_generic_read_minisymbols #define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol #define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define versados_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup #define versados_set_arch_mach bfd_default_set_arch_mach #define versados_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents #define versados_bfd_relax_section bfd_generic_relax_section diff --git a/bfd/vms.c b/bfd/vms.c index d2d98310ca3..d14a76b0810 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -1,7 +1,7 @@ /* vms.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006 Free Software Foundation, Inc. + 2006, 2007 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -1353,6 +1353,22 @@ vms_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, return & alpha_howto_table[alpha_type]; } +static reloc_howto_type * +vms_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (alpha_howto_table) / sizeof (alpha_howto_table[0]); + i++) + if (alpha_howto_table[i].name != NULL + && strcasecmp (alpha_howto_table[i].name, r_name) == 0) + return &alpha_howto_table[i]; + + return NULL; +} + /* Part 4.7, writing an object file. */ /* Set the architecture and machine type in BFD abfd to arch and mach. |