X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fcoff-sparc.c;h=2e52bce72ba2c8283655510655657f2eebe8927b;hb=bb95117e107fe58ecd35683bf0e8da3b414378ff;hp=2c2c2dfe7a8d2900908cbe4557bc1357b079bb91;hpb=53e09e0aaf3d13e4b893744e2fe79edde7edfd20;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c index 2c2c2dfe7a..2e52bce72b 100644 --- a/bfd/coff-sparc.c +++ b/bfd/coff-sparc.c @@ -1,26 +1,26 @@ /* 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. + Copyright (C) 1990-2016 Free Software Foundation, Inc. Written by Cygnus Support. -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 02110-1301, 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 "libbfd.h" #include "coff/sparc.h" #include "coff/internal.h" @@ -33,11 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA. */ /* The page size is a guess based on ELF. */ #define COFF_PAGE_SIZE 0x10000 - -static reloc_howto_type *coff_sparc_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); - enum reloc_type { R_SPARC_NONE = 0, @@ -57,20 +52,15 @@ enum reloc_type }; /* This is stolen pretty directly from elf.c. */ -static bfd_reloc_status_type -bfd_coff_generic_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, - asection *, bfd *, char **)); static bfd_reloc_status_type -bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +bfd_coff_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol, + void * data ATTRIBUTE_UNUSED, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0) @@ -84,7 +74,7 @@ bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section, static reloc_howto_type coff_sparc_howto_table[] = { - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_NONE, 0,3, 0,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", FALSE,0,0x000000ff,TRUE), HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE), HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", FALSE,0,0xffffffff,TRUE), @@ -110,7 +100,8 @@ static reloc_howto_type coff_sparc_howto_table[] = HOWTO(R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE), }; -struct coff_reloc_map { +struct coff_reloc_map +{ bfd_reloc_code_real_type bfd_reloc_val; unsigned char coff_reloc_val; }; @@ -144,9 +135,8 @@ static const struct coff_reloc_map sparc_reloc_map[] = }; static reloc_howto_type * -coff_sparc_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +coff_sparc_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct coff_reloc_map); i++) @@ -158,10 +148,26 @@ 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; - struct internal_reloc *dst; +rtype2howto (arelent *cache_ptr, struct internal_reloc *dst) { BFD_ASSERT (dst->r_type < (unsigned int) R_SPARC_max); cache_ptr->howto = &coff_sparc_howto_table[dst->r_type]; @@ -187,10 +193,12 @@ rtype2howto (cache_ptr, dst) #define COFF_SPARC +#define bfd_pe_print_pdata NULL + #include "coffcode.h" #ifndef TARGET_SYM -#define TARGET_SYM sparccoff_vec +#define TARGET_SYM sparc_coff_vec #endif #ifndef TARGET_NAME