Changeset 609 for branches/GNU/src/binutils/bfd/coff-h8500.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/coff-h8500.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 /* BFD back-end for HitachiH8/500 COFF binaries.2 Copyright 1993, 1994, 1995, 1997, 1999, 2000 1 /* BFD back-end for Renesas H8/500 COFF binaries. 2 Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 3 3 Free Software Foundation, Inc. 4 4 Contributed by Cygnus Support. 5 5 Written by Steve Chamberlain, <sac@cygnus.com>. 6 6 7 This file is part of BFD, the Binary File Descriptor library.8 9 This program is free software; you can redistribute it and/or modify10 it under the terms of the GNU General Public License as published by11 the Free Software Foundation; either version 2 of the License, or12 (at your option) any later version.13 14 This program is distributed in the hope that it will be useful,15 but WITHOUT ANY WARRANTY; without even the implied warranty of16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 GNU General Public License for more details.18 19 You should have received a copy of the GNU General Public License20 along with this program; if not, write to the Free Software21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */7 This file is part of BFD, the Binary File Descriptor library. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 22 22 23 23 #include "bfd.h" … … 29 29 #include "libcoff.h" 30 30 31 static int coff_h8500_select_reloc PARAMS ((reloc_howto_type *)); 32 static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); 33 static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); 34 static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); 35 31 36 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) 32 37 33 38 static reloc_howto_type r_imm8 = 34 HOWTO (R_H8500_IMM8, 0, 1, 8, false, 0,35 complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff, false);39 HOWTO (R_H8500_IMM8, 0, 1, 8, FALSE, 0, 40 complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff, FALSE); 36 41 37 42 static reloc_howto_type r_imm16 = 38 HOWTO (R_H8500_IMM16, 0, 1, 16, false, 0,39 complain_overflow_bitfield, 0, "r_imm16", true, 0x0000ffff, 0x0000ffff, false);43 HOWTO (R_H8500_IMM16, 0, 1, 16, FALSE, 0, 44 complain_overflow_bitfield, 0, "r_imm16", TRUE, 0x0000ffff, 0x0000ffff, FALSE); 40 45 41 46 static reloc_howto_type r_imm24 = 42 HOWTO (R_H8500_IMM24, 0, 1, 24, false, 0,43 complain_overflow_bitfield, 0, "r_imm24", true, 0x00ffffff, 0x00ffffff, false);47 HOWTO (R_H8500_IMM24, 0, 1, 24, FALSE, 0, 48 complain_overflow_bitfield, 0, "r_imm24", TRUE, 0x00ffffff, 0x00ffffff, FALSE); 44 49 45 50 static reloc_howto_type r_imm32 = 46 HOWTO (R_H8500_IMM32, 0, 1, 32, false, 0,47 complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff, 0xffffffff, false);51 HOWTO (R_H8500_IMM32, 0, 1, 32, FALSE, 0, 52 complain_overflow_bitfield, 0, "r_imm32", TRUE, 0xffffffff, 0xffffffff, FALSE); 48 53 49 54 static reloc_howto_type r_high8 = 50 HOWTO (R_H8500_HIGH8, 0, 1, 8, false, 0,51 complain_overflow_dont, 0, "r_high8", true, 0x000000ff, 0x000000ff, false);55 HOWTO (R_H8500_HIGH8, 0, 1, 8, FALSE, 0, 56 complain_overflow_dont, 0, "r_high8", TRUE, 0x000000ff, 0x000000ff, FALSE); 52 57 53 58 static reloc_howto_type r_low16 = 54 HOWTO (R_H8500_LOW16, 0, 1, 16, false, 0,55 complain_overflow_dont, 0, "r_low16", true, 0x0000ffff, 0x0000ffff, false);59 HOWTO (R_H8500_LOW16, 0, 1, 16, FALSE, 0, 60 complain_overflow_dont, 0, "r_low16", TRUE, 0x0000ffff, 0x0000ffff, FALSE); 56 61 57 62 static reloc_howto_type r_pcrel8 = 58 HOWTO (R_H8500_PCREL8, 0, 1, 8, true, 0, complain_overflow_signed, 0, "r_pcrel8", true, 0, 0, true);63 HOWTO (R_H8500_PCREL8, 0, 1, 8, TRUE, 0, complain_overflow_signed, 0, "r_pcrel8", TRUE, 0, 0, TRUE); 59 64 60 65 static reloc_howto_type r_pcrel16 = 61 HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel16", true, 0, 0, true);66 HOWTO (R_H8500_PCREL16, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "r_pcrel16", TRUE, 0, 0, TRUE); 62 67 63 68 static reloc_howto_type r_high16 = 64 HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0, 65 complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false); 66 67 /* Turn a howto into a reloc number */ 69 HOWTO (R_H8500_HIGH16, 0, 1, 8, FALSE, 0, 70 complain_overflow_dont, 0, "r_high16", TRUE, 0x000ffff, 0x0000ffff, FALSE); 71 72 73 /* Turn a howto into a reloc number. */ 68 74 69 75 static int … … 81 87 #define __A_MAGIC_SET__ 82 88 83 /* Code to swap in the reloc */84 #define SWAP_IN_RELOC_OFFSET bfd_h_get_3285 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_3289 /* Code to swap in the reloc. */ 90 #define SWAP_IN_RELOC_OFFSET H_GET_32 91 #define SWAP_OUT_RELOC_OFFSET H_PUT_32 86 92 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ 87 93 dst->r_stuff[0] = 'S'; \ 88 94 dst->r_stuff[1] = 'C'; 89 95 90 /* Code to turn a r_type into a howto ptr, uses the above howto table 91 */ 96 /* Code to turn a r_type into a howto ptr, uses the above howto table. */ 92 97 93 98 static void 94 rtype2howto (internal, dst)99 rtype2howto (internal, dst) 95 100 arelent * internal; 96 101 struct internal_reloc *dst; … … 133 138 #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) 134 139 135 /* Perform any necessary magic to the addend in a reloc entry */140 /* Perform any necessary magic to the addend in a reloc entry. */ 136 141 137 142 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ … … 152 157 153 158 if (reloc->r_symndx > 0) 154 { 155 relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; 156 } 159 relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; 157 160 else 158 { 159 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; 160 } 161 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; 161 162 162 163 relent->addend = reloc->r_offset; … … 176 177 bfd_byte *d = data+*dst_ptr; 177 178 asection *input_section = link_order->u.indirect.section; 179 178 180 switch (reloc->howto->type) 179 181 { … … 190 192 (bfd_coff_reloc16_get_value (reloc, link_info, input_section) 191 193 >> 16), 192 d 194 d); 193 195 (*dst_ptr) += 1; 194 196 (*src_ptr) += 1; … … 198 200 bfd_put_16 (in_abfd, 199 201 bfd_coff_reloc16_get_value (reloc, link_info, input_section), 200 d 202 d); 201 203 (*dst_ptr) += 2; 202 204 (*src_ptr) += 2; … … 215 217 bfd_put_16 (in_abfd, 216 218 (bfd_coff_reloc16_get_value (reloc, link_info, input_section) 217 >> 16),219 >> 16), 218 220 d); 219 221 … … 224 226 case R_H8500_IMM24: 225 227 { 226 int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section);228 int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); 227 229 int o = bfd_get_32 (in_abfd, data+ *dst_ptr -1); 228 230 v = (v & 0x00ffffff) | (o & 0xff00000); 229 bfd_put_32 (in_abfd, v, data + *dst_ptr -1);230 (*dst_ptr) += 3;231 (*src_ptr) +=3;;231 bfd_put_32 (in_abfd, (bfd_vma) v, data + *dst_ptr -1); 232 (*dst_ptr) += 3; 233 (*src_ptr) += 3;; 232 234 } 233 235 break; 234 236 case R_H8500_IMM32: 235 237 { 236 int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section);237 bfd_put_32 (in_abfd, v, data + *dst_ptr);238 (*dst_ptr) += 4;239 (*src_ptr) +=4;;238 int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); 239 bfd_put_32 (in_abfd, (bfd_vma) v, data + *dst_ptr); 240 (*dst_ptr) += 4; 241 (*src_ptr) += 4;; 240 242 } 241 243 break; … … 249 251 + link_order->u.indirect.section->output_section->vma; 250 252 int gap = dst - dot - 1; /* -1 since were in the odd byte of the 251 word and the pc's been incremented */253 word and the pc's been incremented. */ 252 254 253 255 if (gap > 128 || gap < -128) … … 272 274 + link_order->u.indirect.section->output_section->vma; 273 275 int gap = dst - dot - 1; /* -1 since were in the odd byte of the 274 word and the pc's been incremented */276 word and the pc's been incremented. */ 275 277 276 278 if (gap > 32767 || gap < -32768) … … 282 284 abort (); 283 285 } 284 bfd_put_16 (in_abfd, gap, data + *dst_ptr);285 (*dst_ptr) +=2;286 (*src_ptr) +=2;286 bfd_put_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr); 287 (*dst_ptr) += 2; 288 (*src_ptr) += 2; 287 289 break; 288 290 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.