diff options
author | Nick Clifton <nickc@redhat.com> | 2002-01-15 11:58:45 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2002-01-15 11:58:45 +0000 |
commit | 1f7fd4789110049226f584999078f24a538a72fb (patch) | |
tree | 874dbaa038ffe10fb7b3fab57519ce82feb4f4fd | |
parent | 4ee3352dfb3c05c6a0e937fd5a691ba0aa92c15a (diff) | |
download | gdb-1f7fd4789110049226f584999078f24a538a72fb.zip gdb-1f7fd4789110049226f584999078f24a538a72fb.tar.gz gdb-1f7fd4789110049226f584999078f24a538a72fb.tar.bz2 |
Fix up generation of VTINHERIT relocs
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/elf32-xstormy16.c | 52 | ||||
-rw-r--r-- | gas/ChangeLog | 6 | ||||
-rw-r--r-- | gas/config/tc-xstormy16.c | 13 |
4 files changed, 52 insertions, 27 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ed91848..080765c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2002-01-15 Nick Clifton <nickc@cambridge.redhat.com> + + * elf32-xstormy16.c (xstormy16_reloc_map): Add new field 'table'. + (xstormy16_reloc_map): Initialise new field with correct howto + table. + (xstormy16_reloc_type_lookup): Use 'table' field to locate correct + howto entry. + 2002-01-10 Michael Snyder <msnyder@redhat.com> * elf.c (elfcore_write_prstatus): Use long instead of pid_t; diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 5d3d171..bdb0279 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -1,5 +1,5 @@ /* XSTORMY16-specific support for 32-bit ELF. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "libbfd.h" #include "elf-bfd.h" #include "elf/xstormy16.h" +#include "libiberty.h" /* Forward declarations. */ static reloc_howto_type * xstormy16_reloc_type_lookup @@ -245,26 +246,27 @@ static reloc_howto_type xstormy16_elf_howto_table2 [] = /* Map BFD reloc types to XSTORMY16 ELF reloc types. */ -struct xstormy16_reloc_map +typedef struct xstormy16_reloc_map { - bfd_reloc_code_real_type bfd_reloc_val; - unsigned int xstormy16_reloc_val; -}; + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int xstormy16_reloc_val; + reloc_howto_type * table; +} reloc_map; -static const struct xstormy16_reloc_map xstormy16_reloc_map [] = +static const reloc_map xstormy16_reloc_map [] = { - { BFD_RELOC_NONE, R_XSTORMY16_NONE }, - { BFD_RELOC_32, R_XSTORMY16_32 }, - { BFD_RELOC_16, R_XSTORMY16_16 }, - { BFD_RELOC_8, R_XSTORMY16_8 }, - { BFD_RELOC_32_PCREL, R_XSTORMY16_PC32 }, - { BFD_RELOC_16_PCREL, R_XSTORMY16_PC16 }, - { BFD_RELOC_8_PCREL, R_XSTORMY16_PC8 }, - { BFD_RELOC_XSTORMY16_REL_12, R_XSTORMY16_REL_12 }, - { BFD_RELOC_XSTORMY16_24, R_XSTORMY16_24 }, - { BFD_RELOC_XSTORMY16_FPTR16, R_XSTORMY16_FPTR16 }, - { BFD_RELOC_VTABLE_INHERIT, R_XSTORMY16_GNU_VTINHERIT }, - { BFD_RELOC_VTABLE_ENTRY, R_XSTORMY16_GNU_VTENTRY }, + { BFD_RELOC_NONE, R_XSTORMY16_NONE, xstormy16_elf_howto_table }, + { BFD_RELOC_32, R_XSTORMY16_32, xstormy16_elf_howto_table }, + { BFD_RELOC_16, R_XSTORMY16_16, xstormy16_elf_howto_table }, + { BFD_RELOC_8, R_XSTORMY16_8, xstormy16_elf_howto_table }, + { BFD_RELOC_32_PCREL, R_XSTORMY16_PC32, xstormy16_elf_howto_table }, + { BFD_RELOC_16_PCREL, R_XSTORMY16_PC16, xstormy16_elf_howto_table }, + { BFD_RELOC_8_PCREL, R_XSTORMY16_PC8, xstormy16_elf_howto_table }, + { BFD_RELOC_XSTORMY16_REL_12, R_XSTORMY16_REL_12, xstormy16_elf_howto_table }, + { BFD_RELOC_XSTORMY16_24, R_XSTORMY16_24, xstormy16_elf_howto_table }, + { BFD_RELOC_XSTORMY16_FPTR16, R_XSTORMY16_FPTR16, xstormy16_elf_howto_table }, + { BFD_RELOC_VTABLE_INHERIT, R_XSTORMY16_GNU_VTINHERIT, xstormy16_elf_howto_table2 }, + { BFD_RELOC_VTABLE_ENTRY, R_XSTORMY16_GNU_VTENTRY, xstormy16_elf_howto_table2 }, }; static reloc_howto_type * @@ -274,10 +276,16 @@ xstormy16_reloc_type_lookup (abfd, code) { unsigned int i; - for (i = sizeof (xstormy16_reloc_map) / sizeof (xstormy16_reloc_map[0]); - --i;) - if (xstormy16_reloc_map [i].bfd_reloc_val == code) - return & xstormy16_elf_howto_table [xstormy16_reloc_map[i].xstormy16_reloc_val]; + for (i = ARRAY_SIZE (xstormy16_reloc_map); --i;) + { + const reloc_map * entry; + + entry = xstormy16_reloc_map + i; + + if (entry->bfd_reloc_val == code) + return entry->table + (entry->xstormy16_reloc_val + - entry->table[0].type); + } return NULL; } diff --git a/gas/ChangeLog b/gas/ChangeLog index 9aa6b33..c274442 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2002-01-15 Nick Clifton <nickc@cambridge.redhat.com> + + * config/tc-xstormy16.c: (xstormy16_fix_adjustable): Do not fix + vtinherit relocs. + (xstormy16_md_apply_fix3): Do not return a value. + 2002-01-14 Richard Earnshaw <rearnsha@arm.com> * tc-arm.c (md_longopts): On targets that aren't bi-endian, support diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c index 7ef10e5..446ac38 100644 --- a/gas/config/tc-xstormy16.c +++ b/gas/config/tc-xstormy16.c @@ -1,5 +1,5 @@ /* tc-xstormy16.c -- Assembler for the Sanyo XSTORMY16. - Copyright (C) 2000, 2001 Free Software Foundation. + Copyright (C) 2000, 2001, 2002 Free Software Foundation. This file is part of GAS, the GNU Assembler. @@ -400,6 +400,11 @@ xstormy16_fix_adjustable (fixP) if (S_IS_WEAK (fixP->fx_addsy)) return 0; + /* We need the symbol name for the VTABLE entries. */ + if ( fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT + || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + return 0; + return ! xstormy16_force_relocation (fixP); } @@ -513,7 +518,7 @@ xstormy16_md_apply_fix3 (fixP, valueP, seg) } if (fixP->fx_done) - return 1; + return; /* The operand isn't fully resolved. Determine a BFD reloc value based on the operand information and leave it to @@ -530,7 +535,7 @@ xstormy16_md_apply_fix3 (fixP, valueP, seg) as_bad_where (fixP->fx_file, fixP->fx_line, _("unresolved expression that must be resolved")); fixP->fx_done = 1; - return 1; + return; } } else if (fixP->fx_done) @@ -578,8 +583,6 @@ xstormy16_md_apply_fix3 (fixP, valueP, seg) See the comment describing fx_addnumber in write.h. This field is misnamed (or misused :-). */ fixP->fx_addnumber = value; - - return 1; } |