diff options
author | Alan Modra <amodra@gmail.com> | 2000-06-07 03:43:33 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2000-06-07 03:43:33 +0000 |
commit | 1b452ec66bd22e10bfa182d8e6995f0037486560 (patch) | |
tree | 0de40f36aea82f8394c6fff3aab17271dcae57fa /bfd | |
parent | 3e0bf9f1f0e77a5d40d6799fa49795350c39333e (diff) | |
download | gdb-1b452ec66bd22e10bfa182d8e6995f0037486560.zip gdb-1b452ec66bd22e10bfa182d8e6995f0037486560.tar.gz gdb-1b452ec66bd22e10bfa182d8e6995f0037486560.tar.bz2 |
Get rid of the -1 dummy valued enum in START_RELOC_NUMBERS.
Remove duplicate reloc enums in elf32-d[13]0v.c
Remove EMPTY_HOWTOs in elf32-i386.c
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 17 | ||||
-rw-r--r-- | bfd/Makefile.am | 6 | ||||
-rw-r--r-- | bfd/Makefile.in | 6 | ||||
-rw-r--r-- | bfd/elf32-d10v.c | 16 | ||||
-rw-r--r-- | bfd/elf32-d30v.c | 19 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 132 |
6 files changed, 108 insertions, 88 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6df6346..d0f4584 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2000-06-07 Alan Modra <alan@linuxcare.com.au> + + * elf32-d10v.c: Include elf/d10v.h + (enum reloc_type): Delete. + * elf32-d30v.c: Include elf/d30v.h + (enum reloc_type): Delete. + + * Makefile.am: Run "make dep-am" to regenerate dependencies. + * Makefile.in: Regenerate. + + * elf32-i386.c (elf_howto_table): Remove EMPTY_HOWTOs. + (R_386_standard, R_386_ext_offset): Define. + (elf_i386_reloc_type_lookup): Modify calculation of index into + elf_howto_table since we've removed the gap. + (elf_i386_info_to_howto_rel): Likewise. + (elf_i386_relocate_section): Likewise. + 2000-06-06 Michael Snyder <msnyder@seadog.cygnus.com> * elf.c (elf_grok_pr_status): Eliminate reference to prgregset_t. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 380b993..1b6a0a7 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -900,10 +900,12 @@ elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \ elf32-target.h elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h + $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h + $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 3192f32..f23960a 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1428,10 +1428,12 @@ elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \ elf32-target.h elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h + $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h + $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \ diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index dd2e892..3fbf05b 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" #include "elf-bfd.h" -/* #include "elf/d10v.h" */ +#include "elf/d10v.h" static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); @@ -33,20 +33,6 @@ static void d10v_info_to_howto_rel /* Use REL instead of RELA to save space */ #define USE_REL -enum reloc_type -{ - R_D10V_NONE = 0, - R_D10V_10_PCREL_R, - R_D10V_10_PCREL_L, - R_D10V_16, - R_D10V_18, - R_D10V_18_PCREL, - R_D10V_32, - R_D10V_GNU_VTINHERIT, - R_D10V_GNU_VTENTRY, - R_D10V_max -}; - static reloc_howto_type elf_d10v_howto_table[] = { /* This reloc does nothing. */ diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c index 52bafb9..c7fde2b 100644 --- a/bfd/elf32-d30v.c +++ b/bfd/elf32-d30v.c @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" #include "elf-bfd.h" +#include "elf/d30v.h" static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); @@ -46,24 +47,6 @@ static bfd_reloc_status_type bfd_elf_d30v_reloc_21 PARAMS (( bfd *output_bfd, char **error_message)); -enum reloc_type -{ - R_D30V_NONE = 0, - R_D30V_6, - R_D30V_9_PCREL, - R_D30V_9_PCREL_R, - R_D30V_15, - R_D30V_15_PCREL, - R_D30V_15_PCREL_R, - R_D30V_21, - R_D30V_21_PCREL, - R_D30V_21_PCREL_R, - R_D30V_32, - R_D30V_32_PCREL, - R_D30V_32_NORMAL, - R_D30V_max -}; - static reloc_howto_type elf_d30v_howto_table[] = { /* This reloc does nothing. */ diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 53edaaf..1a12571 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -56,31 +56,56 @@ static boolean elf_i386_finish_dynamic_sections static reloc_howto_type elf_howto_table[]= { - HOWTO(R_386_NONE, 0,0, 0,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_NONE", true,0x00000000,0x00000000,false), - HOWTO(R_386_32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_32", true,0xffffffff,0xffffffff,false), - HOWTO(R_386_PC32, 0,2,32,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC32", true,0xffffffff,0xffffffff,true), - HOWTO(R_386_GOT32, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOT32", true,0xffffffff,0xffffffff,false), - HOWTO(R_386_PLT32, 0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PLT32", true,0xffffffff,0xffffffff,true), - HOWTO(R_386_COPY, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_COPY", true,0xffffffff,0xffffffff,false), - HOWTO(R_386_GLOB_DAT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GLOB_DAT", true,0xffffffff,0xffffffff,false), - HOWTO(R_386_JUMP_SLOT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_JUMP_SLOT",true,0xffffffff,0xffffffff,false), - HOWTO(R_386_RELATIVE, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_RELATIVE", true,0xffffffff,0xffffffff,false), - HOWTO(R_386_GOTOFF, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTOFF", true,0xffffffff,0xffffffff,false), - HOWTO(R_386_GOTPC, 0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTPC", true,0xffffffff,0xffffffff,true), - EMPTY_HOWTO (11), - EMPTY_HOWTO (12), - EMPTY_HOWTO (13), - EMPTY_HOWTO (14), - EMPTY_HOWTO (15), - EMPTY_HOWTO (16), - EMPTY_HOWTO (17), - EMPTY_HOWTO (18), - EMPTY_HOWTO (19), + HOWTO(R_386_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_NONE", + true, 0x00000000, 0x00000000, false), + HOWTO(R_386_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_32", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_PC32, 0, 2, 32, true, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_PC32", + true, 0xffffffff, 0xffffffff, true), + HOWTO(R_386_GOT32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_GOT32", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_PLT32, 0, 2, 32, true, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_PLT32", + true, 0xffffffff, 0xffffffff, true), + HOWTO(R_386_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_COPY", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_GLOB_DAT, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_GLOB_DAT", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_JUMP_SLOT, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_JUMP_SLOT", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_RELATIVE, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_RELATIVE", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_GOTOFF, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_GOTOFF", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_GOTPC, 0, 2, 32, true, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_GOTPC", + true, 0xffffffff, 0xffffffff, true), + +#define R_386_standard ((unsigned int) R_386_GOTPC + 1) +#define R_386_ext_offset ((unsigned int) R_386_16 - R_386_standard) + /* The remaining relocs are a GNU extension. */ - HOWTO(R_386_16, 0,1,16,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_16", true,0xffff,0xffff,false), - HOWTO(R_386_PC16, 0,1,16,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC16", true,0xffff,0xffff,true), - HOWTO(R_386_8, 0,0,8,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_8", true,0xff,0xff,false), - HOWTO(R_386_PC8, 0,0,8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc,"R_386_PC8", true,0xff,0xff,true), + HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_16", + true, 0xffff, 0xffff, false), + HOWTO(R_386_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_PC16", + true, 0xffff, 0xffff, true), + HOWTO(R_386_8, 0, 0, 8, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_8", + true, 0xff, 0xff, false), + HOWTO(R_386_PC8, 0, 0, 8, true, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_386_PC8", + true, 0xff, 0xff, true) }; /* GNU extension to record C++ vtable hierarchy. */ @@ -130,68 +155,68 @@ elf_i386_reloc_type_lookup (abfd, code) { case BFD_RELOC_NONE: TRACE ("BFD_RELOC_NONE"); - return &elf_howto_table[ (int)R_386_NONE ]; + return &elf_howto_table[(unsigned int) R_386_NONE ]; case BFD_RELOC_32: TRACE ("BFD_RELOC_32"); - return &elf_howto_table[ (int)R_386_32 ]; + return &elf_howto_table[(unsigned int) R_386_32 ]; case BFD_RELOC_CTOR: TRACE ("BFD_RELOC_CTOR"); - return &elf_howto_table[ (int)R_386_32 ]; + return &elf_howto_table[(unsigned int) R_386_32 ]; case BFD_RELOC_32_PCREL: TRACE ("BFD_RELOC_PC32"); - return &elf_howto_table[ (int)R_386_PC32 ]; + return &elf_howto_table[(unsigned int) R_386_PC32 ]; case BFD_RELOC_386_GOT32: TRACE ("BFD_RELOC_386_GOT32"); - return &elf_howto_table[ (int)R_386_GOT32 ]; + return &elf_howto_table[(unsigned int) R_386_GOT32 ]; case BFD_RELOC_386_PLT32: TRACE ("BFD_RELOC_386_PLT32"); - return &elf_howto_table[ (int)R_386_PLT32 ]; + return &elf_howto_table[(unsigned int) R_386_PLT32 ]; case BFD_RELOC_386_COPY: TRACE ("BFD_RELOC_386_COPY"); - return &elf_howto_table[ (int)R_386_COPY ]; + return &elf_howto_table[(unsigned int) R_386_COPY ]; case BFD_RELOC_386_GLOB_DAT: TRACE ("BFD_RELOC_386_GLOB_DAT"); - return &elf_howto_table[ (int)R_386_GLOB_DAT ]; + return &elf_howto_table[(unsigned int) R_386_GLOB_DAT ]; case BFD_RELOC_386_JUMP_SLOT: TRACE ("BFD_RELOC_386_JUMP_SLOT"); - return &elf_howto_table[ (int)R_386_JUMP_SLOT ]; + return &elf_howto_table[(unsigned int) R_386_JUMP_SLOT ]; case BFD_RELOC_386_RELATIVE: TRACE ("BFD_RELOC_386_RELATIVE"); - return &elf_howto_table[ (int)R_386_RELATIVE ]; + return &elf_howto_table[(unsigned int) R_386_RELATIVE ]; case BFD_RELOC_386_GOTOFF: TRACE ("BFD_RELOC_386_GOTOFF"); - return &elf_howto_table[ (int)R_386_GOTOFF ]; + return &elf_howto_table[(unsigned int) R_386_GOTOFF ]; case BFD_RELOC_386_GOTPC: TRACE ("BFD_RELOC_386_GOTPC"); - return &elf_howto_table[ (int)R_386_GOTPC ]; + return &elf_howto_table[(unsigned int) R_386_GOTPC ]; /* The remaining relocs are a GNU extension. */ case BFD_RELOC_16: TRACE ("BFD_RELOC_16"); - return &elf_howto_table[(int) R_386_16]; + return &elf_howto_table[(unsigned int) R_386_16 - R_386_ext_offset]; case BFD_RELOC_16_PCREL: TRACE ("BFD_RELOC_16_PCREL"); - return &elf_howto_table[(int) R_386_PC16]; + return &elf_howto_table[(unsigned int) R_386_PC16 - R_386_ext_offset]; case BFD_RELOC_8: TRACE ("BFD_RELOC_8"); - return &elf_howto_table[(int) R_386_8]; + return &elf_howto_table[(unsigned int) R_386_8 - R_386_ext_offset]; case BFD_RELOC_8_PCREL: TRACE ("BFD_RELOC_8_PCREL"); - return &elf_howto_table[(int) R_386_PC8]; + return &elf_howto_table[(unsigned int) R_386_PC8 - R_386_ext_offset]; case BFD_RELOC_VTABLE_INHERIT: TRACE ("BFD_RELOC_VTABLE_INHERIT"); @@ -231,14 +256,19 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) cache_ptr->howto = &elf32_i386_vtinherit_howto; else if (type == R_386_GNU_VTENTRY) cache_ptr->howto = &elf32_i386_vtentry_howto; - else if (type < R_386_max - && (type < FIRST_INVALID_RELOC || type > LAST_INVALID_RELOC)) - cache_ptr->howto = &elf_howto_table[(int) type]; else { - (*_bfd_error_handler) (_("%s: invalid relocation type %d"), - bfd_get_filename (abfd), (int) type); - cache_ptr->howto = &elf_howto_table[(int) R_386_NONE]; + unsigned int indx; + + if ((indx = (unsigned int) type) >= R_386_standard + && ((indx = (unsigned int) type - R_386_ext_offset) + >= sizeof (elf_howto_table) / sizeof (elf_howto_table[0]))) + { + (*_bfd_error_handler) (_("%s: invalid relocation type %d"), + bfd_get_filename (abfd), (int) type); + indx = (unsigned int) R_386_NONE; + } + cache_ptr->howto = &elf_howto_table[indx]; } } @@ -1283,20 +1313,20 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, asection *sec; bfd_vma relocation; bfd_reloc_status_type r; + unsigned int indx; r_type = ELF32_R_TYPE (rel->r_info); if (r_type == R_386_GNU_VTINHERIT || r_type == R_386_GNU_VTENTRY) continue; - if (r_type < 0 - || r_type >= (int) R_386_max - || (r_type >= (int) FIRST_INVALID_RELOC - && r_type <= (int) LAST_INVALID_RELOC)) + if ((indx = (unsigned) r_type) >= R_386_standard + && ((indx = (unsigned) r_type - R_386_ext_offset) + >= sizeof (elf_howto_table) / sizeof (elf_howto_table[0]))) { bfd_set_error (bfd_error_bad_value); return false; } - howto = elf_howto_table + r_type; + howto = elf_howto_table + indx; r_symndx = ELF32_R_SYM (rel->r_info); |