| OLD | NEW |
| 1 /* BFD back-end for Motorola 88000 COFF "Binary Compatibility Standard" files. | 1 /* BFD back-end for Motorola 88000 COFF "Binary Compatibility Standard" files. |
| 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, | 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, |
| 3 2001, 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. | 3 2001, 2002, 2003, 2005, 2007, 2008, 2012 Free Software Foundation, Inc. |
| 4 Written by Cygnus Support. | 4 Written by Cygnus Support. |
| 5 | 5 |
| 6 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
| 7 | 7 |
| 8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
| 9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
| 10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
| 11 (at your option) any later version. | 11 (at your option) any later version. |
| 12 | 12 |
| 13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
| 14 but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 GNU General Public License for more details. | 16 GNU General Public License for more details. |
| 17 | 17 |
| 18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
| 19 along with this program; if not, write to the Free Software | 19 along with this program; if not, write to the Free Software |
| 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 21 MA 02110-1301, USA. */ | 21 MA 02110-1301, USA. */ |
| 22 | 22 |
| 23 #define M88 1 /* Customize various include files */ | 23 #define M88 1 /* Customize various include files */ |
| 24 #include "sysdep.h" | 24 #include "sysdep.h" |
| 25 #include "bfd.h" | 25 #include "bfd.h" |
| 26 #include "libbfd.h" | 26 #include "libbfd.h" |
| 27 #include "coff/m88k.h" | 27 #include "coff/m88k.h" |
| 28 #include "coff/internal.h" | 28 #include "coff/internal.h" |
| 29 #include "libcoff.h" | 29 #include "libcoff.h" |
| 30 | 30 |
| 31 static bfd_boolean m88k_is_local_label_name PARAMS ((bfd *, const char *)); | |
| 32 static bfd_reloc_status_type m88k_special_reloc | 31 static bfd_reloc_status_type m88k_special_reloc |
| 33 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | 32 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); |
| 34 static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); | |
| 35 static void reloc_processing | |
| 36 PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); | |
| 37 | 33 |
| 38 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) | 34 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) |
| 39 | 35 |
| 40 #define GET_SCNHDR_NRELOC H_GET_32 | 36 #define GET_SCNHDR_NRELOC H_GET_32 |
| 41 #define GET_SCNHDR_NLNNO H_GET_32 | 37 #define GET_SCNHDR_NLNNO H_GET_32 |
| 42 | 38 |
| 43 /* On coff-m88k, local labels start with '@'. */ | 39 /* On coff-m88k, local labels start with '@'. */ |
| 44 | 40 |
| 45 #define coff_bfd_is_local_label_name m88k_is_local_label_name | 41 #define coff_bfd_is_local_label_name m88k_is_local_label_name |
| 46 | 42 |
| 47 static bfd_boolean | 43 static bfd_boolean |
| 48 m88k_is_local_label_name (abfd, name) | 44 m88k_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) |
| 49 bfd *abfd ATTRIBUTE_UNUSED; | |
| 50 const char *name; | |
| 51 { | 45 { |
| 52 return name[0] == '@'; | 46 return name[0] == '@'; |
| 53 } | 47 } |
| 54 | 48 |
| 55 static bfd_reloc_status_type | 49 static bfd_reloc_status_type |
| 56 m88k_special_reloc (abfd, reloc_entry, symbol, data, | 50 m88k_special_reloc (bfd *abfd, |
| 57 » » input_section, output_bfd, error_message) | 51 » » arelent *reloc_entry, |
| 58 bfd *abfd; | 52 » » asymbol *symbol, |
| 59 arelent *reloc_entry; | 53 » » void * data, |
| 60 asymbol *symbol; | 54 » » asection *input_section, |
| 61 PTR data; | 55 » » bfd *output_bfd, |
| 62 asection *input_section; | 56 » » char **error_message ATTRIBUTE_UNUSED) |
| 63 bfd *output_bfd; | |
| 64 char **error_message ATTRIBUTE_UNUSED; | |
| 65 { | 57 { |
| 66 reloc_howto_type *howto = reloc_entry->howto; | 58 reloc_howto_type *howto = reloc_entry->howto; |
| 67 | 59 |
| 68 switch (howto->type) | 60 switch (howto->type) |
| 69 { | 61 { |
| 70 case R_HVRT16: | 62 case R_HVRT16: |
| 71 case R_LVRT16: | 63 case R_LVRT16: |
| 72 if (output_bfd != (bfd *) NULL) | 64 if (output_bfd != (bfd *) NULL) |
| 73 { | 65 { |
| 74 /* This is a partial relocation, and we want to apply the | 66 /* This is a partial relocation, and we want to apply the |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 "VRT32", /* name */ | 221 "VRT32", /* name */ |
| 230 FALSE, /* partial_inplace */ | 222 FALSE, /* partial_inplace */ |
| 231 0xffffffff, /* src_mask */ | 223 0xffffffff, /* src_mask */ |
| 232 0xffffffff, /* dst_mask */ | 224 0xffffffff, /* dst_mask */ |
| 233 TRUE), /* pcrel_offset */ | 225 TRUE), /* pcrel_offset */ |
| 234 }; | 226 }; |
| 235 | 227 |
| 236 /* Code to turn an external r_type into a pointer to an entry in the | 228 /* Code to turn an external r_type into a pointer to an entry in the |
| 237 above howto table. */ | 229 above howto table. */ |
| 238 static void | 230 static void |
| 239 rtype2howto (cache_ptr, dst) | 231 rtype2howto (arelent *cache_ptr, struct internal_reloc *dst) |
| 240 arelent *cache_ptr; | |
| 241 struct internal_reloc *dst; | |
| 242 { | 232 { |
| 243 if (dst->r_type >= R_PCR16L && dst->r_type <= R_VRT32) | 233 if (dst->r_type >= R_PCR16L && dst->r_type <= R_VRT32) |
| 244 { | 234 { |
| 245 cache_ptr->howto = howto_table + dst->r_type - R_PCR16L; | 235 cache_ptr->howto = howto_table + dst->r_type - R_PCR16L; |
| 246 } | 236 } |
| 247 else | 237 else |
| 248 { | 238 { |
| 249 BFD_ASSERT (0); | 239 BFD_ASSERT (0); |
| 250 } | 240 } |
| 251 } | 241 } |
| 252 | 242 |
| 253 #define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst) | 243 #define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst) |
| 254 | 244 |
| 255 /* Code to swap in the reloc offset */ | 245 /* Code to swap in the reloc offset */ |
| 256 #define SWAP_IN_RELOC_OFFSET H_GET_16 | 246 #define SWAP_IN_RELOC_OFFSET H_GET_16 |
| 257 #define SWAP_OUT_RELOC_OFFSET H_PUT_16 | 247 #define SWAP_OUT_RELOC_OFFSET H_PUT_16 |
| 258 | 248 |
| 259 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ | 249 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ |
| 260 reloc_processing(relent, reloc, symbols, abfd, section) | 250 reloc_processing(relent, reloc, symbols, abfd, section) |
| 261 | 251 |
| 262 static void | 252 static void |
| 263 reloc_processing (relent, reloc, symbols, abfd, section) | 253 reloc_processing (arelent *relent, |
| 264 arelent *relent; | 254 » » struct internal_reloc *reloc, |
| 265 struct internal_reloc *reloc; | 255 » » asymbol **symbols, |
| 266 asymbol **symbols; | 256 » » bfd *abfd, |
| 267 bfd *abfd; | 257 » » asection *section) |
| 268 asection *section; | |
| 269 { | 258 { |
| 270 relent->address = reloc->r_vaddr; | 259 relent->address = reloc->r_vaddr; |
| 271 rtype2howto (relent, reloc); | 260 rtype2howto (relent, reloc); |
| 272 | 261 |
| 273 if (((int) reloc->r_symndx) > 0) | 262 if (((int) reloc->r_symndx) > 0) |
| 274 { | 263 { |
| 275 relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; | 264 relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; |
| 276 } | 265 } |
| 277 else | 266 else |
| 278 { | 267 { |
| 279 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; | 268 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; |
| 280 } | 269 } |
| 281 | 270 |
| 282 relent->addend = reloc->r_offset; | 271 relent->addend = reloc->r_offset; |
| 283 relent->address -= section->vma; | 272 relent->address -= section->vma; |
| 284 } | 273 } |
| 285 | 274 |
| 286 #define BADMAG(x) MC88BADMAG(x) | 275 #define BADMAG(x) MC88BADMAG(x) |
| 287 | 276 |
| 288 #ifndef bfd_pe_print_pdata | 277 #ifndef bfd_pe_print_pdata |
| 289 #define bfd_pe_print_pdata NULL | 278 #define bfd_pe_print_pdata NULL |
| 290 #endif | 279 #endif |
| 291 | 280 |
| 292 #include "coffcode.h" | 281 #include "coffcode.h" |
| 293 | 282 |
| 294 #undef coff_write_armap | 283 #undef coff_write_armap |
| 295 | 284 |
| 296 CREATE_BIG_COFF_TARGET_VEC (m88kbcs_vec, "coff-m88kbcs", 0, 0, '_', NULL, COFF_S
WAP_TABLE) | 285 CREATE_BIG_COFF_TARGET_VEC (m88kbcs_vec, "coff-m88kbcs", 0, 0, '_', NULL, COFF_S
WAP_TABLE) |
| OLD | NEW |