X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fcoff-alpha.c;h=4799fdf0ffedb10b3a95cc16e312e385fa4462cf;hb=377caf49a5881bb23084de3e9bcaa1812327119f;hp=f29f732575e2c26b4b6f4cb4553103f6e0ec3f67;hpb=ca724bf2dab9f9cc4459320f696720b064ebfed9;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index f29f732575..4799fdf0ff 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1,27 +1,28 @@ /* BFD back-end for ALPHA Extended-Coff files. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain and Ian Lance Taylor . -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -481,10 +482,16 @@ alpha_ecoff_bad_format_hook (abfd, filehdr) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - if (ALPHA_ECOFF_BADMAG (*internal_f)) - return FALSE; + if (! ALPHA_ECOFF_BADMAG (*internal_f)) + return TRUE; - return TRUE; + if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f)) + (*_bfd_error_handler) + (_("%B: Cannot handle compressed Alpha binaries.\n" + " Use compiler flags, or objZ, to generate uncompressed binaries."), + abfd); + + return FALSE; } /* This is a hook called by coff_real_object_p to create any backend @@ -603,8 +610,11 @@ alpha_ecoff_swap_reloc_out (abfd, intern, dst) size = intern->r_size; } + /* XXX FIXME: The maximum symndx value used to be 14 but this + fails with object files produced by DEC's C++ compiler. + Where does the value 14 (or 15) come from anyway ? */ BFD_ASSERT (intern->r_extern - || (intern->r_symndx >= 0 && intern->r_symndx <= 14)); + || (intern->r_symndx >= 0 && intern->r_symndx <= 15)); H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr); H_PUT_32 (abfd, symndx, ext->r_symndx); @@ -632,7 +642,15 @@ alpha_adjust_reloc_in (abfd, intern, rptr) arelent *rptr; { if (intern->r_type > ALPHA_R_GPVALUE) - abort (); + { + (*_bfd_error_handler) + (_("%B: unknown/unsupported relocation type %d"), + abfd, intern->r_type); + bfd_set_error (bfd_error_bad_value); + rptr->addend = 0; + rptr->howto = NULL; + return; + } switch (intern->r_type) { @@ -1227,6 +1245,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 @@ -1521,8 +1555,26 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, switch (r_type) { + case ALPHA_R_GPRELHIGH: + (*_bfd_error_handler) + (_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"), + input_bfd); + bfd_set_error (bfd_error_bad_value); + continue; + + case ALPHA_R_GPRELLOW: + (*_bfd_error_handler) + (_("%B: unsupported relocation: ALPHA_R_GPRELLOW"), + input_bfd); + bfd_set_error (bfd_error_bad_value); + continue; + default: - abort (); + (*_bfd_error_handler) + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); + bfd_set_error (bfd_error_bad_value); + continue; case ALPHA_R_IGNORE: /* This reloc appears after a GPDISP reloc. On earlier @@ -2326,6 +2378,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 \