Changeset 609 for branches/GNU/src/binutils/bfd/coff-sh.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-sh.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 /* BFD back-end for HitachiSuper-H COFF binaries.2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 1 /* BFD back-end for Renesas Super-H COFF binaries. 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 3 3 Free Software Foundation, Inc. 4 4 Contributed by Cygnus Support. … … 6 6 Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. 7 7 8 This file is part of BFD, the Binary File Descriptor library.9 10 This program is free software; you can redistribute it and/or modify11 it under the terms of the GNU General Public License as published by12 the Free Software Foundation; either version 2 of the License, or13 (at your option) any later version.14 15 This program is distributed in the hope that it will be useful,16 but WITHOUT ANY WARRANTY; without even the implied warranty of17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 GNU General Public License for more details.19 20 You should have received a copy of the GNU General Public License21 along with this program; if not, write to the Free Software22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */8 This file is part of BFD, the Binary File Descriptor library. 9 10 This program is free software; you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 2 of the License, or 13 (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 23 23 24 24 #include "bfd.h" 25 25 #include "sysdep.h" 26 #include "libiberty.h" 26 27 #include "libbfd.h" 27 28 #include "bfdlink.h" … … 33 34 34 35 #ifndef COFF_IMAGE_WITH_PE 35 static b oolean sh_align_load_span36 static bfd_boolean sh_align_load_span 36 37 PARAMS ((bfd *, asection *, bfd_byte *, 37 b oolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),38 PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, b oolean *));38 bfd_boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), 39 PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *)); 39 40 40 41 #define _bfd_sh_align_load_span sh_align_load_span … … 48 49 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); 49 50 static long get_symbol_value PARAMS ((asymbol *)); 50 static b oolean sh_relax_section51 PARAMS ((bfd *, asection *, struct bfd_link_info *, b oolean *));52 static b oolean sh_relax_delete_bytes51 static bfd_boolean sh_relax_section 52 PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); 53 static bfd_boolean sh_relax_delete_bytes 53 54 PARAMS ((bfd *, asection *, bfd_vma, int)); 54 55 #ifndef COFF_IMAGE_WITH_PE 55 56 static const struct sh_opcode *sh_insn_info PARAMS ((unsigned int)); 56 57 #endif 57 static boolean sh_align_loads 58 PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, boolean *)); 59 static boolean sh_swap_insns 58 static bfd_boolean sh_align_loads 59 PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, 60 bfd_boolean *)); 61 static bfd_boolean sh_swap_insns 60 62 PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); 61 static b oolean sh_relocate_section63 static bfd_boolean sh_relocate_section 62 64 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 63 65 struct internal_reloc *, struct internal_syment *, asection **)); 64 66 static bfd_byte *sh_coff_get_relocated_section_contents 65 67 PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, 66 bfd_byte *, boolean, asymbol **)); 68 bfd_byte *, bfd_boolean, asymbol **)); 69 static reloc_howto_type * sh_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); 67 70 68 71 #ifdef COFF_WITH_PE … … 83 86 84 87 #ifdef COFF_WITH_PE 85 /* Return true if this relocation should 88 static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *)); 89 /* Return TRUE if this relocation should 86 90 appear in the output .reloc section. */ 87 static b oolean in_reloc_p (abfd, howto)91 static bfd_boolean in_reloc_p (abfd, howto) 88 92 bfd * abfd ATTRIBUTE_UNUSED; 89 93 reloc_howto_type * howto; … … 105 109 2, /* size (0 = byte, 1 = short, 2 = long) */ 106 110 32, /* bitsize */ 107 false, /* pc_relative */111 FALSE, /* pc_relative */ 108 112 0, /* bitpos */ 109 113 complain_overflow_bitfield, /* complain_on_overflow */ 110 114 sh_reloc, /* special_function */ 111 115 "r_imm32ce", /* name */ 112 true, /* partial_inplace */116 TRUE, /* partial_inplace */ 113 117 0xffffffff, /* src_mask */ 114 118 0xffffffff, /* dst_mask */ 115 false), /* pcrel_offset */119 FALSE), /* pcrel_offset */ 116 120 #else 117 121 EMPTY_HOWTO (2), … … 129 133 1, /* size (0 = byte, 1 = short, 2 = long) */ 130 134 8, /* bitsize */ 131 true, /* pc_relative */135 TRUE, /* pc_relative */ 132 136 0, /* bitpos */ 133 137 complain_overflow_signed, /* complain_on_overflow */ 134 138 sh_reloc, /* special_function */ 135 139 "r_pcdisp8by2", /* name */ 136 true, /* partial_inplace */140 TRUE, /* partial_inplace */ 137 141 0xff, /* src_mask */ 138 142 0xff, /* dst_mask */ 139 true), /* pcrel_offset */143 TRUE), /* pcrel_offset */ 140 144 141 145 EMPTY_HOWTO (11), /* R_SH_PCDISP8 */ … … 145 149 1, /* size (0 = byte, 1 = short, 2 = long) */ 146 150 12, /* bitsize */ 147 true, /* pc_relative */151 TRUE, /* pc_relative */ 148 152 0, /* bitpos */ 149 153 complain_overflow_signed, /* complain_on_overflow */ 150 154 sh_reloc, /* special_function */ 151 155 "r_pcdisp12by2", /* name */ 152 true, /* partial_inplace */156 TRUE, /* partial_inplace */ 153 157 0xfff, /* src_mask */ 154 158 0xfff, /* dst_mask */ 155 true), /* pcrel_offset */159 TRUE), /* pcrel_offset */ 156 160 157 161 EMPTY_HOWTO (13), … … 161 165 2, /* size (0 = byte, 1 = short, 2 = long) */ 162 166 32, /* bitsize */ 163 false, /* pc_relative */167 FALSE, /* pc_relative */ 164 168 0, /* bitpos */ 165 169 complain_overflow_bitfield, /* complain_on_overflow */ 166 170 sh_reloc, /* special_function */ 167 171 "r_imm32", /* name */ 168 true, /* partial_inplace */172 TRUE, /* partial_inplace */ 169 173 0xffffffff, /* src_mask */ 170 174 0xffffffff, /* dst_mask */ 171 false), /* pcrel_offset */175 FALSE), /* pcrel_offset */ 172 176 173 177 EMPTY_HOWTO (15), … … 177 181 2, /* size (0 = byte, 1 = short, 2 = long) */ 178 182 32, /* bitsize */ 179 false, /* pc_relative */183 FALSE, /* pc_relative */ 180 184 0, /* bitpos */ 181 185 complain_overflow_bitfield, /* complain_on_overflow */ 182 186 sh_reloc, /* special_function */ 183 187 "rva32", /* name */ 184 true, /* partial_inplace */188 TRUE, /* partial_inplace */ 185 189 0xffffffff, /* src_mask */ 186 190 0xffffffff, /* dst_mask */ 187 false), /* pcrel_offset */191 FALSE), /* pcrel_offset */ 188 192 #else 189 193 EMPTY_HOWTO (16), /* R_SH_IMM8 */ … … 199 203 1, /* size (0 = byte, 1 = short, 2 = long) */ 200 204 8, /* bitsize */ 201 true, /* pc_relative */205 TRUE, /* pc_relative */ 202 206 0, /* bitpos */ 203 207 complain_overflow_unsigned, /* complain_on_overflow */ 204 208 sh_reloc, /* special_function */ 205 209 "r_pcrelimm8by2", /* name */ 206 true, /* partial_inplace */210 TRUE, /* partial_inplace */ 207 211 0xff, /* src_mask */ 208 212 0xff, /* dst_mask */ 209 true), /* pcrel_offset */213 TRUE), /* pcrel_offset */ 210 214 211 215 HOWTO (R_SH_PCRELIMM8BY4, /* type */ … … 213 217 1, /* size (0 = byte, 1 = short, 2 = long) */ 214 218 8, /* bitsize */ 215 true, /* pc_relative */219 TRUE, /* pc_relative */ 216 220 0, /* bitpos */ 217 221 complain_overflow_unsigned, /* complain_on_overflow */ 218 222 sh_reloc, /* special_function */ 219 223 "r_pcrelimm8by4", /* name */ 220 true, /* partial_inplace */224 TRUE, /* partial_inplace */ 221 225 0xff, /* src_mask */ 222 226 0xff, /* dst_mask */ 223 true), /* pcrel_offset */227 TRUE), /* pcrel_offset */ 224 228 225 229 HOWTO (R_SH_IMM16, /* type */ … … 227 231 1, /* size (0 = byte, 1 = short, 2 = long) */ 228 232 16, /* bitsize */ 229 false, /* pc_relative */233 FALSE, /* pc_relative */ 230 234 0, /* bitpos */ 231 235 complain_overflow_bitfield, /* complain_on_overflow */ 232 236 sh_reloc, /* special_function */ 233 237 "r_imm16", /* name */ 234 true, /* partial_inplace */238 TRUE, /* partial_inplace */ 235 239 0xffff, /* src_mask */ 236 240 0xffff, /* dst_mask */ 237 false), /* pcrel_offset */241 FALSE), /* pcrel_offset */ 238 242 239 243 HOWTO (R_SH_SWITCH16, /* type */ … … 241 245 1, /* size (0 = byte, 1 = short, 2 = long) */ 242 246 16, /* bitsize */ 243 false, /* pc_relative */247 FALSE, /* pc_relative */ 244 248 0, /* bitpos */ 245 249 complain_overflow_bitfield, /* complain_on_overflow */ 246 250 sh_reloc, /* special_function */ 247 251 "r_switch16", /* name */ 248 true, /* partial_inplace */252 TRUE, /* partial_inplace */ 249 253 0xffff, /* src_mask */ 250 254 0xffff, /* dst_mask */ 251 false), /* pcrel_offset */255 FALSE), /* pcrel_offset */ 252 256 253 257 HOWTO (R_SH_SWITCH32, /* type */ … … 255 259 2, /* size (0 = byte, 1 = short, 2 = long) */ 256 260 32, /* bitsize */ 257 false, /* pc_relative */261 FALSE, /* pc_relative */ 258 262 0, /* bitpos */ 259 263 complain_overflow_bitfield, /* complain_on_overflow */ 260 264 sh_reloc, /* special_function */ 261 265 "r_switch32", /* name */ 262 true, /* partial_inplace */266 TRUE, /* partial_inplace */ 263 267 0xffffffff, /* src_mask */ 264 268 0xffffffff, /* dst_mask */ 265 false), /* pcrel_offset */269 FALSE), /* pcrel_offset */ 266 270 267 271 HOWTO (R_SH_USES, /* type */ … … 269 273 1, /* size (0 = byte, 1 = short, 2 = long) */ 270 274 16, /* bitsize */ 271 false, /* pc_relative */275 FALSE, /* pc_relative */ 272 276 0, /* bitpos */ 273 277 complain_overflow_bitfield, /* complain_on_overflow */ 274 278 sh_reloc, /* special_function */ 275 279 "r_uses", /* name */ 276 true, /* partial_inplace */280 TRUE, /* partial_inplace */ 277 281 0xffff, /* src_mask */ 278 282 0xffff, /* dst_mask */ 279 false), /* pcrel_offset */283 FALSE), /* pcrel_offset */ 280 284 281 285 HOWTO (R_SH_COUNT, /* type */ … … 283 287 2, /* size (0 = byte, 1 = short, 2 = long) */ 284 288 32, /* bitsize */ 285 false, /* pc_relative */289 FALSE, /* pc_relative */ 286 290 0, /* bitpos */ 287 291 complain_overflow_bitfield, /* complain_on_overflow */ 288 292 sh_reloc, /* special_function */ 289 293 "r_count", /* name */ 290 true, /* partial_inplace */294 TRUE, /* partial_inplace */ 291 295 0xffffffff, /* src_mask */ 292 296 0xffffffff, /* dst_mask */ 293 false), /* pcrel_offset */297 FALSE), /* pcrel_offset */ 294 298 295 299 HOWTO (R_SH_ALIGN, /* type */ … … 297 301 2, /* size (0 = byte, 1 = short, 2 = long) */ 298 302 32, /* bitsize */ 299 false, /* pc_relative */303 FALSE, /* pc_relative */ 300 304 0, /* bitpos */ 301 305 complain_overflow_bitfield, /* complain_on_overflow */ 302 306 sh_reloc, /* special_function */ 303 307 "r_align", /* name */ 304 true, /* partial_inplace */308 TRUE, /* partial_inplace */ 305 309 0xffffffff, /* src_mask */ 306 310 0xffffffff, /* dst_mask */ 307 false), /* pcrel_offset */311 FALSE), /* pcrel_offset */ 308 312 309 313 HOWTO (R_SH_CODE, /* type */ … … 311 315 2, /* size (0 = byte, 1 = short, 2 = long) */ 312 316 32, /* bitsize */ 313 false, /* pc_relative */317 FALSE, /* pc_relative */ 314 318 0, /* bitpos */ 315 319 complain_overflow_bitfield, /* complain_on_overflow */ 316 320 sh_reloc, /* special_function */ 317 321 "r_code", /* name */ 318 true, /* partial_inplace */322 TRUE, /* partial_inplace */ 319 323 0xffffffff, /* src_mask */ 320 324 0xffffffff, /* dst_mask */ 321 false), /* pcrel_offset */325 FALSE), /* pcrel_offset */ 322 326 323 327 HOWTO (R_SH_DATA, /* type */ … … 325 329 2, /* size (0 = byte, 1 = short, 2 = long) */ 326 330 32, /* bitsize */ 327 false, /* pc_relative */331 FALSE, /* pc_relative */ 328 332 0, /* bitpos */ 329 333 complain_overflow_bitfield, /* complain_on_overflow */ 330 334 sh_reloc, /* special_function */ 331 335 "r_data", /* name */ 332 true, /* partial_inplace */336 TRUE, /* partial_inplace */ 333 337 0xffffffff, /* src_mask */ 334 338 0xffffffff, /* dst_mask */ 335 false), /* pcrel_offset */339 FALSE), /* pcrel_offset */ 336 340 337 341 HOWTO (R_SH_LABEL, /* type */ … … 339 343 2, /* size (0 = byte, 1 = short, 2 = long) */ 340 344 32, /* bitsize */ 341 false, /* pc_relative */345 FALSE, /* pc_relative */ 342 346 0, /* bitpos */ 343 347 complain_overflow_bitfield, /* complain_on_overflow */ 344 348 sh_reloc, /* special_function */ 345 349 "r_label", /* name */ 346 true, /* partial_inplace */350 TRUE, /* partial_inplace */ 347 351 0xffffffff, /* src_mask */ 348 352 0xffffffff, /* dst_mask */ 349 false), /* pcrel_offset */353 FALSE), /* pcrel_offset */ 350 354 351 355 HOWTO (R_SH_SWITCH8, /* type */ … … 353 357 0, /* size (0 = byte, 1 = short, 2 = long) */ 354 358 8, /* bitsize */ 355 false, /* pc_relative */359 FALSE, /* pc_relative */ 356 360 0, /* bitpos */ 357 361 complain_overflow_bitfield, /* complain_on_overflow */ 358 362 sh_reloc, /* special_function */ 359 363 "r_switch8", /* name */ 360 true, /* partial_inplace */364 TRUE, /* partial_inplace */ 361 365 0xff, /* src_mask */ 362 366 0xff, /* dst_mask */ 363 false) /* pcrel_offset */367 FALSE) /* pcrel_offset */ 364 368 }; 365 369 … … 377 381 #ifndef COFF_WITH_PE 378 382 /* Swap the r_offset field in and out. */ 379 #define SWAP_IN_RELOC_OFFSET bfd_h_get_32380 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32383 #define SWAP_IN_RELOC_OFFSET H_GET_32 384 #define SWAP_OUT_RELOC_OFFSET H_PUT_32 381 385 382 386 /* Swap out extra information in the reloc structure. */ … … 412 416 Copied from coff-i386. */ 413 417 #define coff_rtype_to_howto coff_sh_rtype_to_howto 418 static reloc_howto_type * coff_sh_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); 414 419 415 420 static reloc_howto_type * … … 461 466 } 462 467 468 #endif /* COFF_WITH_PE */ 469 463 470 /* This structure is used to map BFD reloc codes to SH PE relocs. */ 464 471 struct shcoff_reloc_map 465 472 { 466 unsigned charbfd_reloc_val;473 bfd_reloc_code_real_type bfd_reloc_val; 467 474 unsigned char shcoff_reloc_val; 468 475 }; 469 476 477 #ifdef COFF_WITH_PE 470 478 /* An array mapping BFD reloc codes to SH PE relocs. */ 471 479 static const struct shcoff_reloc_map sh_reloc_map[] = … … 475 483 { BFD_RELOC_CTOR, R_SH_IMM32CE }, 476 484 }; 485 #else 486 /* An array mapping BFD reloc codes to SH PE relocs. */ 487 static const struct shcoff_reloc_map sh_reloc_map[] = 488 { 489 { BFD_RELOC_32, R_SH_IMM32 }, 490 { BFD_RELOC_CTOR, R_SH_IMM32 }, 491 }; 492 #endif 477 493 478 494 /* Given a BFD reloc code, return the howto structure for the … … 487 503 unsigned int i; 488 504 489 for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct shcoff_reloc_map); i++) 490 { 491 if (sh_reloc_map[i].bfd_reloc_val == code) 492 return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val]; 493 } 505 for (i = ARRAY_SIZE (sh_reloc_map); i--;) 506 if (sh_reloc_map[i].bfd_reloc_val == code) 507 return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val]; 494 508 495 509 fprintf (stderr, "SH Error: unknown reloc type %d\n", code); 496 510 return NULL; 497 511 } 498 #endif /* COFF_WITH_PE */499 512 500 513 /* This macro is used in coffcode.h to get the howto corresponding to … … 587 600 insn = bfd_get_32 (abfd, hit_data); 588 601 insn += sym_value + reloc_entry->addend; 589 bfd_put_32 (abfd, insn, hit_data);602 bfd_put_32 (abfd, (bfd_vma) insn, hit_data); 590 603 break; 591 604 #ifdef COFF_WITH_PE 592 605 case R_SH_IMAGEBASE: 593 606 insn = bfd_get_32 (abfd, hit_data); 594 insn += (sym_value + reloc_entry->addend595 - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase);596 bfd_put_32 (abfd, insn, hit_data);607 insn += sym_value + reloc_entry->addend; 608 insn -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; 609 bfd_put_32 (abfd, (bfd_vma) insn, hit_data); 597 610 break; 598 611 #endif … … 608 621 sym_value -= 0x1000; 609 622 insn = (insn & 0xf000) | (sym_value & 0xfff); 610 bfd_put_16 (abfd, insn, hit_data);623 bfd_put_16 (abfd, (bfd_vma) insn, hit_data); 611 624 if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) 612 625 return bfd_reloc_overflow; … … 679 692 can, by swapping them with one of the adjacent instructions. */ 680 693 681 static b oolean694 static bfd_boolean 682 695 sh_relax_section (abfd, sec, link_info, again) 683 696 bfd *abfd; 684 697 asection *sec; 685 698 struct bfd_link_info *link_info; 686 b oolean *again;699 bfd_boolean *again; 687 700 { 688 701 struct internal_reloc *internal_relocs; 689 702 struct internal_reloc *free_relocs = NULL; 690 b oolean have_code;703 bfd_boolean have_code; 691 704 struct internal_reloc *irel, *irelend; 692 705 bfd_byte *contents = NULL; 693 706 bfd_byte *free_contents = NULL; 694 707 695 *again = false;708 *again = FALSE; 696 709 697 710 if (link_info->relocateable 698 711 || (sec->flags & SEC_RELOC) == 0 699 712 || sec->reloc_count == 0) 700 return true;713 return TRUE; 701 714 702 715 /* If this is the first time we have been called for this section, … … 707 720 internal_relocs = (_bfd_coff_read_internal_relocs 708 721 (abfd, sec, link_info->keep_memory, 709 (bfd_byte *) NULL, false,722 (bfd_byte *) NULL, FALSE, 710 723 (struct internal_reloc *) NULL)); 711 724 if (internal_relocs == NULL) … … 714 727 free_relocs = internal_relocs; 715 728 716 have_code = false;729 have_code = FALSE; 717 730 718 731 irelend = internal_relocs + sec->reloc_count; … … 726 739 727 740 if (irel->r_type == R_SH_CODE) 728 have_code = true;741 have_code = TRUE; 729 742 730 743 if (irel->r_type != R_SH_USES) … … 760 773 { 761 774 (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", 762 bfd_ get_filename (abfd),775 bfd_archive_filename (abfd), 763 776 (unsigned long) irel->r_vaddr); 764 777 continue; … … 771 784 ((*_bfd_error_handler) 772 785 ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", 773 bfd_ get_filename (abfd), (unsigned long) irel->r_vaddr, insn));786 bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr, insn)); 774 787 continue; 775 788 } … … 783 796 paddr = insn & 0xff; 784 797 paddr *= 4; 785 paddr += (laddr + 4) &~ 3;798 paddr += (laddr + 4) &~ (bfd_vma) 3; 786 799 if (paddr >= sec->_raw_size) 787 800 { 788 801 ((*_bfd_error_handler) 789 802 ("%s: 0x%lx: warning: bad R_SH_USES load offset", 790 bfd_ get_filename (abfd), (unsigned long) irel->r_vaddr));803 bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); 791 804 continue; 792 805 } … … 811 824 ((*_bfd_error_handler) 812 825 ("%s: 0x%lx: warning: could not find expected reloc", 813 bfd_ get_filename (abfd), (unsigned long) paddr));826 bfd_archive_filename (abfd), (unsigned long) paddr)); 814 827 continue; 815 828 } … … 827 840 ((*_bfd_error_handler) 828 841 ("%s: 0x%lx: warning: symbol in unexpected section", 829 bfd_ get_filename (abfd), (unsigned long) paddr));842 bfd_archive_filename (abfd), (unsigned long) paddr)); 830 843 continue; 831 844 } … … 885 898 if (coff_section_data (abfd, sec) == NULL) 886 899 { 887 sec->used_by_bfd =888 ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));900 bfd_size_type amt = sizeof (struct coff_section_tdata); 901 sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); 889 902 if (sec->used_by_bfd == NULL) 890 903 goto error_return; … … 892 905 893 906 coff_section_data (abfd, sec)->relocs = internal_relocs; 894 coff_section_data (abfd, sec)->keep_relocs = true;907 coff_section_data (abfd, sec)->keep_relocs = TRUE; 895 908 free_relocs = NULL; 896 909 897 910 coff_section_data (abfd, sec)->contents = contents; 898 coff_section_data (abfd, sec)->keep_contents = true;911 coff_section_data (abfd, sec)->keep_contents = TRUE; 899 912 free_contents = NULL; 900 913 901 obj_coff_keep_syms (abfd) = true;914 obj_coff_keep_syms (abfd) = TRUE; 902 915 903 916 /* Replace the jsr with a bsr. */ … … 913 926 relocs. */ 914 927 bfd_put_16 (abfd, 915 0xb000 | ((foff >> 1) & 0xfff),928 (bfd_vma) 0xb000 | ((foff >> 1) & 0xfff), 916 929 contents + irel->r_vaddr - sec->vma); 917 930 } … … 921 934 symbol value may be changed by future relaxing. We let 922 935 the final link phase handle it. */ 923 bfd_put_16 (abfd, 0xb000, contents + irel->r_vaddr - sec->vma); 936 bfd_put_16 (abfd, (bfd_vma) 0xb000, 937 contents + irel->r_vaddr - sec->vma); 924 938 } 925 939 … … 954 968 other function call to come within range, we should relax 955 969 again. Note that this is not required, and it may be slow. */ 956 *again = true;970 *again = TRUE; 957 971 958 972 /* Now check whether we got a COUNT reloc. */ … … 961 975 ((*_bfd_error_handler) 962 976 ("%s: 0x%lx: warning: could not find expected COUNT reloc", 963 bfd_ get_filename (abfd), (unsigned long) paddr));977 bfd_archive_filename (abfd), (unsigned long) paddr)); 964 978 continue; 965 979 } … … 970 984 { 971 985 ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", 972 bfd_ get_filename (abfd),986 bfd_archive_filename (abfd), 973 987 (unsigned long) paddr)); 974 988 continue; … … 994 1008 if (have_code) 995 1009 { 996 b oolean swapped;1010 bfd_boolean swapped; 997 1011 998 1012 /* Get the section contents. */ … … 1022 1036 if (coff_section_data (abfd, sec) == NULL) 1023 1037 { 1024 sec->used_by_bfd =1025 ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));1038 bfd_size_type amt = sizeof (struct coff_section_tdata); 1039 sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); 1026 1040 if (sec->used_by_bfd == NULL) 1027 1041 goto error_return; … … 1029 1043 1030 1044 coff_section_data (abfd, sec)->relocs = internal_relocs; 1031 coff_section_data (abfd, sec)->keep_relocs = true;1045 coff_section_data (abfd, sec)->keep_relocs = TRUE; 1032 1046 free_relocs = NULL; 1033 1047 1034 1048 coff_section_data (abfd, sec)->contents = contents; 1035 coff_section_data (abfd, sec)->keep_contents = true;1049 coff_section_data (abfd, sec)->keep_contents = TRUE; 1036 1050 free_contents = NULL; 1037 1051 1038 obj_coff_keep_syms (abfd) = true;1052 obj_coff_keep_syms (abfd) = TRUE; 1039 1053 } 1040 1054 } … … 1055 1069 if (coff_section_data (abfd, sec) == NULL) 1056 1070 { 1057 sec->used_by_bfd =1058 ((PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)));1071 bfd_size_type amt = sizeof (struct coff_section_tdata); 1072 sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); 1059 1073 if (sec->used_by_bfd == NULL) 1060 1074 goto error_return; … … 1065 1079 } 1066 1080 1067 return true;1081 return TRUE; 1068 1082 1069 1083 error_return: … … 1072 1086 if (free_contents != NULL) 1073 1087 free (free_contents); 1074 return false;1088 return FALSE; 1075 1089 } 1076 1090 1077 1091 /* Delete some bytes from a section while relaxing. */ 1078 1092 1079 static b oolean1093 static bfd_boolean 1080 1094 sh_relax_delete_bytes (abfd, sec, addr, count) 1081 1095 bfd *abfd; … … 1116 1130 1117 1131 /* Actually delete the bytes. */ 1118 memmove (contents + addr, contents + addr + count, toaddr - addr - count); 1132 memmove (contents + addr, contents + addr + count, 1133 (size_t) (toaddr - addr - count)); 1119 1134 if (irelalign == NULL) 1120 1135 sec->_cooked_size -= count; … … 1127 1142 BFD_ASSERT ((count & 1) == 0); 1128 1143 for (i = 0; i < count; i += 2) 1129 bfd_put_16 (abfd, NOP_OPCODE, contents + toaddr - count + i);1144 bfd_put_16 (abfd, (bfd_vma) NOP_OPCODE, contents + toaddr - count + i); 1130 1145 } 1131 1146 … … 1139 1154 int off, adjust, oinsn; 1140 1155 bfd_signed_vma voff = 0; 1141 b oolean overflow;1156 bfd_boolean overflow; 1142 1157 1143 1158 /* Get the new reloc address. */ … … 1301 1316 { 1302 1317 oinsn = insn; 1303 overflow = false;1318 overflow = FALSE; 1304 1319 switch (irel->r_type) 1305 1320 { … … 1312 1327 insn += adjust / 2; 1313 1328 if ((oinsn & 0xff00) != (insn & 0xff00)) 1314 overflow = true;1315 bfd_put_16 (abfd, insn, contents + nraddr);1329 overflow = TRUE; 1330 bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); 1316 1331 break; 1317 1332 … … 1319 1334 insn += adjust / 2; 1320 1335 if ((oinsn & 0xf000) != (insn & 0xf000)) 1321 overflow = true;1322 bfd_put_16 (abfd, insn, contents + nraddr);1336 overflow = TRUE; 1337 bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); 1323 1338 break; 1324 1339 … … 1333 1348 } 1334 1349 if ((oinsn & 0xff00) != (insn & 0xff00)) 1335 overflow = true;1336 bfd_put_16 (abfd, insn, contents + nraddr);1350 overflow = TRUE; 1351 bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); 1337 1352 break; 1338 1353 … … 1340 1355 voff += adjust; 1341 1356 if (voff < 0 || voff >= 0xff) 1342 overflow = true;1343 bfd_put_8 (abfd, voff, contents + nraddr);1357 overflow = TRUE; 1358 bfd_put_8 (abfd, (bfd_vma) voff, contents + nraddr); 1344 1359 break; 1345 1360 … … 1347 1362 voff += adjust; 1348 1363 if (voff < - 0x8000 || voff >= 0x8000) 1349 overflow = true;1350 bfd_put_signed_16 (abfd, voff, contents + nraddr);1364 overflow = TRUE; 1365 bfd_put_signed_16 (abfd, (bfd_vma) voff, contents + nraddr); 1351 1366 break; 1352 1367 1353 1368 case R_SH_SWITCH32: 1354 1369 voff += adjust; 1355 bfd_put_signed_32 (abfd, voff, contents + nraddr);1370 bfd_put_signed_32 (abfd, (bfd_vma) voff, contents + nraddr); 1356 1371 break; 1357 1372 … … 1365 1380 ((*_bfd_error_handler) 1366 1381 ("%s: 0x%lx: fatal: reloc overflow while relaxing", 1367 bfd_ get_filename (abfd), (unsigned long) irel->r_vaddr));1382 bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); 1368 1383 bfd_set_error (bfd_error_bad_value); 1369 return false;1384 return FALSE; 1370 1385 } 1371 1386 } … … 1389 1404 1390 1405 /* We always cache the relocs. Perhaps, if info->keep_memory is 1391 false, we should free them, if we are permitted to, when we1406 FALSE, we should free them, if we are permitted to, when we 1392 1407 leave sh_coff_relax_section. */ 1393 1408 internal_relocs = (_bfd_coff_read_internal_relocs 1394 (abfd, o, true, (bfd_byte *) NULL, false,1409 (abfd, o, TRUE, (bfd_byte *) NULL, FALSE, 1395 1410 (struct internal_reloc *) NULL)); 1396 1411 if (internal_relocs == NULL) 1397 return false;1412 return FALSE; 1398 1413 1399 1414 ocontents = NULL; … … 1431 1446 { 1432 1447 /* We always cache the section contents. 1433 Perhaps, if info->keep_memory is false, we1448 Perhaps, if info->keep_memory is FALSE, we 1434 1449 should free them, if we are permitted to, 1435 1450 when we leave sh_coff_relax_section. */ 1436 1451 ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); 1437 1452 if (ocontents == NULL) 1438 return false;1453 return FALSE; 1439 1454 if (! bfd_get_section_contents (abfd, o, ocontents, 1440 1455 (file_ptr) 0, 1441 1456 o->_raw_size)) 1442 return false;1457 return FALSE; 1443 1458 coff_section_data (abfd, o)->contents = ocontents; 1444 1459 } … … 1451 1466 ocontents + irelscan->r_vaddr - o->vma); 1452 1467 1453 coff_section_data (abfd, o)->keep_contents = true;1468 coff_section_data (abfd, o)->keep_contents = TRUE; 1454 1469 } 1455 1470 } … … 1465 1480 ((*_bfd_error_handler) 1466 1481 ("%s: fatal: generic symbols retrieved before relaxing", 1467 bfd_ get_filename (abfd)));1482 bfd_archive_filename (abfd))); 1468 1483 bfd_set_error (bfd_error_invalid_operation); 1469 return false;1484 return FALSE; 1470 1485 } 1471 1486 … … 1516 1531 /* Tail recursion. */ 1517 1532 return sh_relax_delete_bytes (abfd, sec, alignaddr, 1518 alignto - alignaddr);1533 (int) (alignto - alignaddr)); 1519 1534 } 1520 1535 } 1521 1536 1522 return true;1537 return TRUE; 1523 1538 } 1524 1539 … … 1636 1651 1637 1652 #ifndef COFF_IMAGE_WITH_PE 1638 static b oolean sh_insn_uses_reg1653 static bfd_boolean sh_insn_uses_reg 1639 1654 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); 1640 static b oolean sh_insn_sets_reg1655 static bfd_boolean sh_insn_sets_reg 1641 1656 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); 1642 static b oolean sh_insn_uses_or_sets_reg1657 static bfd_boolean sh_insn_uses_or_sets_reg 1643 1658 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); 1644 static b oolean sh_insn_uses_freg1659 static bfd_boolean sh_insn_uses_freg 1645 1660 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); 1646 static b oolean sh_insn_sets_freg1661 static bfd_boolean sh_insn_sets_freg 1647 1662 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); 1648 static b oolean sh_insn_uses_or_sets_freg1663 static bfd_boolean sh_insn_uses_or_sets_freg 1649 1664 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); 1650 static b oolean sh_insns_conflict1665 static bfd_boolean sh_insns_conflict 1651 1666 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, 1652 1667 const struct sh_opcode *)); 1653 static b oolean sh_load_use1668 static bfd_boolean sh_load_use 1654 1669 PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, 1655 1670 const struct sh_opcode *)); … … 2077 2092 }; 2078 2093 2094 #ifndef COFF_IMAGE_WITH_PE 2079 2095 static struct sh_major_opcode sh_opcodes[] = 2080 2096 { … … 2096 2112 { MAP (sh_opcodef) } 2097 2113 }; 2114 #endif 2098 2115 2099 2116 /* The double data transfer / parallel processing insns are not … … 2153 2170 /* See whether an instruction uses or sets a general purpose register */ 2154 2171 2155 static b oolean2172 static bfd_boolean 2156 2173 sh_insn_uses_or_sets_reg (insn, op, reg) 2157 2174 unsigned int insn; … … 2160 2177 { 2161 2178 if (sh_insn_uses_reg (insn, op, reg)) 2162 return true;2179 return TRUE; 2163 2180 2164 2181 return sh_insn_sets_reg (insn, op, reg); … … 2167 2184 /* See whether an instruction uses a general purpose register. */ 2168 2185 2169 static b oolean2186 static bfd_boolean 2170 2187 sh_insn_uses_reg (insn, op, reg) 2171 2188 unsigned int insn; … … 2179 2196 if ((f & USES1) != 0 2180 2197 && USES1_REG (insn) == reg) 2181 return true;2198 return TRUE; 2182 2199 if ((f & USES2) != 0 2183 2200 && USES2_REG (insn) == reg) 2184 return true;2201 return TRUE; 2185 2202 if ((f & USESR0) != 0 2186 2203 && reg == 0) 2187 return true;2204 return TRUE; 2188 2205 if ((f & USESAS) && reg == USESAS_REG (insn)) 2189 return true;2206 return TRUE; 2190 2207 if ((f & USESR8) && reg == 8) 2191 return true;2192 2193 return false;2208 return TRUE; 2209 2210 return FALSE; 2194 2211 } 2195 2212 2196 2213 /* See whether an instruction sets a general purpose register. */ 2197 2214 2198 static b oolean2215 static bfd_boolean 2199 2216 sh_insn_sets_reg (insn, op, reg) 2200 2217 unsigned int insn; … … 2208 2225 if ((f & SETS1) != 0 2209 2226 && SETS1_REG (insn) == reg) 2210 return true;2227 return TRUE; 2211 2228 if ((f & SETS2) != 0 2212 2229 && SETS2_REG (insn) == reg) 2213 return true;2230 return TRUE; 2214 2231 if ((f & SETSR0) != 0 2215 2232 && reg == 0) 2216 return true;2233 return TRUE; 2217 2234 if ((f & SETSAS) && reg == SETSAS_REG (insn)) 2218 return true;2219 2220 return false;2235 return TRUE; 2236 2237 return FALSE; 2221 2238 } 2222 2239 2223 2240 /* See whether an instruction uses or sets a floating point register */ 2224 2241 2225 static b oolean2242 static bfd_boolean 2226 2243 sh_insn_uses_or_sets_freg (insn, op, reg) 2227 2244 unsigned int insn; … … 2230 2247 { 2231 2248 if (sh_insn_uses_freg (insn, op, reg)) 2232 return true;2249 return TRUE; 2233 2250 2234 2251 return sh_insn_sets_freg (insn, op, reg); … … 2237 2254 /* See whether an instruction uses a floating point register. */ 2238 2255 2239 static b oolean2256 static bfd_boolean 2240 2257 sh_insn_uses_freg (insn, op, freg) 2241 2258 unsigned int insn; … … 2258 2275 if ((f & USESF1) != 0 2259 2276 && (USESF1_REG (insn) & 0xe) == (freg & 0xe)) 2260 return true;2277 return TRUE; 2261 2278 if ((f & USESF2) != 0 2262 2279 && (USESF2_REG (insn) & 0xe) == (freg & 0xe)) 2263 return true;2280 return TRUE; 2264 2281 if ((f & USESF0) != 0 2265 2282 && freg == 0) 2266 return true;2267 2268 return false;2283 return TRUE; 2284 2285 return FALSE; 2269 2286 } 2270 2287 2271 2288 /* See whether an instruction sets a floating point register. */ 2272 2289 2273 static b oolean2290 static bfd_boolean 2274 2291 sh_insn_sets_freg (insn, op, freg) 2275 2292 unsigned int insn; … … 2292 2309 if ((f & SETSF1) != 0 2293 2310 && (SETSF1_REG (insn) & 0xe) == (freg & 0xe)) 2294 return true;2295 2296 return false;2311 return TRUE; 2312 2313 return FALSE; 2297 2314 } 2298 2315 2299 2316 /* See whether instructions I1 and I2 conflict, assuming I1 comes 2300 2317 before I2. OP1 and OP2 are the corresponding sh_opcode structures. 2301 This should return true if there is a conflict, or falseif the2318 This should return TRUE if there is a conflict, or FALSE if the 2302 2319 instructions can be swapped safely. */ 2303 2320 2304 static b oolean2321 static bfd_boolean 2305 2322 sh_insns_conflict (i1, op1, i2, op2) 2306 2323 unsigned int i1; … … 2318 2335 if (((i1 & 0xf0ff) == 0x4066 && (i2 & 0xf000) == 0xf000) 2319 2336 || ((i2 & 0xf0ff) == 0x4066 && (i1 & 0xf000) == 0xf000)) 2320 return true;2337 return TRUE; 2321 2338 2322 2339 if ((f1 & (BRANCH | DELAY)) != 0 2323 2340 || (f2 & (BRANCH | DELAY)) != 0) 2324 return true;2341 return TRUE; 2325 2342 2326 2343 if (((f1 | f2) & SETSSP) 2327 2344 && (f1 & (SETSSP | USESSP)) 2328 2345 && (f2 & (SETSSP | USESSP))) 2329 return true;2346 return TRUE; 2330 2347 2331 2348 if ((f1 & SETS1) != 0 2332 2349 && sh_insn_uses_or_sets_reg (i2, op2, SETS1_REG (i1))) 2333 return true;2350 return TRUE; 2334 2351 if ((f1 & SETS2) != 0 2335 2352 && sh_insn_uses_or_sets_reg (i2, op2, SETS2_REG (i1))) 2336 return true;2353 return TRUE; 2337 2354 if ((f1 & SETSR0) != 0 2338 2355 && sh_insn_uses_or_sets_reg (i2, op2, 0)) 2339 return true;2356 return TRUE; 2340 2357 if ((f1 & SETSAS) 2341 2358 && sh_insn_uses_or_sets_reg (i2, op2, SETSAS_REG (i1))) 2342 return true;2359 return TRUE; 2343 2360 if ((f1 & SETSF1) != 0 2344 2361 && sh_insn_uses_or_sets_freg (i2, op2, SETSF1_REG (i1))) 2345 return true;2362 return TRUE; 2346 2363 2347 2364 if ((f2 & SETS1) != 0 2348 2365 && sh_insn_uses_or_sets_reg (i1, op1, SETS1_REG (i2))) 2349 return true;2366 return TRUE; 2350 2367 if ((f2 & SETS2) != 0 2351 2368 && sh_insn_uses_or_sets_reg (i1, op1, SETS2_REG (i2))) 2352 return true;2369 return TRUE; 2353 2370 if ((f2 & SETSR0) != 0 2354 2371 && sh_insn_uses_or_sets_reg (i1, op1, 0)) 2355 return true;2372 return TRUE; 2356 2373 if ((f2 & SETSAS) 2357 2374 && sh_insn_uses_or_sets_reg (i1, op1, SETSAS_REG (i2))) 2358 return true;2375 return TRUE; 2359 2376 if ((f2 & SETSF1) != 0 2360 2377 && sh_insn_uses_or_sets_freg (i1, op1, SETSF1_REG (i2))) 2361 return true;2378 return TRUE; 2362 2379 2363 2380 /* The instructions do not conflict. */ 2364 return false;2381 return FALSE; 2365 2382 } 2366 2383 2367 2384 /* I1 is a load instruction, and I2 is some other instruction. Return 2368 trueif I1 loads a register which I2 uses. */2369 2370 static b oolean2385 TRUE if I1 loads a register which I2 uses. */ 2386 2387 static bfd_boolean 2371 2388 sh_load_use (i1, op1, i2, op2) 2372 2389 unsigned int i1; … … 2380 2397 2381 2398 if ((f1 & LOAD) == 0) 2382 return false;2399 return FALSE; 2383 2400 2384 2401 /* If both SETS1 and SETSSP are set, that means a load to a special … … 2388 2405 && (f1 & SETSSP) == 0 2389 2406 && sh_insn_uses_reg (i2, op2, (i1 & 0x0f00) >> 8)) 2390 return true;2407 return TRUE; 2391 2408 2392 2409 if ((f1 & SETSR0) != 0 2393 2410 && sh_insn_uses_reg (i2, op2, 0)) 2394 return true;2411 return TRUE; 2395 2412 2396 2413 if ((f1 & SETSF1) != 0 2397 2414 && sh_insn_uses_freg (i2, op2, (i1 & 0x0f00) >> 8)) 2398 return true;2399 2400 return false;2415 return TRUE; 2416 2417 return FALSE; 2401 2418 } 2402 2419 … … 2409 2426 sorted list of labels; LABEL_END is the end of the list. START and 2410 2427 STOP are the range of memory to examine. If a swap is made, 2411 *PSWAPPED is set to true. */2428 *PSWAPPED is set to TRUE. */ 2412 2429 2413 2430 #ifdef COFF_WITH_PE 2414 2431 static 2415 2432 #endif 2416 b oolean2433 bfd_boolean 2417 2434 _bfd_sh_align_load_span (abfd, sec, contents, swap, relocs, 2418 2435 plabel, label_end, start, stop, pswapped) … … 2420 2437 asection *sec; 2421 2438 bfd_byte *contents; 2422 b oolean (*swap) PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma));2439 bfd_boolean (*swap) PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); 2423 2440 PTR relocs; 2424 2441 bfd_vma **plabel; … … 2426 2443 bfd_vma start; 2427 2444 bfd_vma stop; 2428 b oolean *pswapped;2445 bfd_boolean *pswapped; 2429 2446 { 2430 2447 int dsp = (abfd->arch_info->mach == bfd_mach_sh_dsp … … 2436 2453 with the schedules generated by the compiler. */ 2437 2454 if (abfd->arch_info->mach == bfd_mach_sh4) 2438 return true;2455 return TRUE; 2439 2456 2440 2457 /* If we are linking sh[3]-dsp code, swap the FPU instructions for DSP … … 2510 2527 && ! sh_insns_conflict (prev_insn, prev_op, insn, op)) 2511 2528 { 2512 b oolean ok;2529 bfd_boolean ok; 2513 2530 2514 2531 /* The load/store instruction does not have a label, and … … 2517 2534 INSN do not conflict. */ 2518 2535 2519 ok = true;2536 ok = TRUE; 2520 2537 2521 2538 if (i >= start + 4) … … 2532 2549 if (prev2_op == NULL 2533 2550 || (prev2_op->flags & DELAY) != 0) 2534 ok = false;2551 ok = FALSE; 2535 2552 2536 2553 /* If the instruction before PREV_INSN is a load, … … 2542 2559 && (prev2_op->flags & LOAD) != 0 2543 2560 && sh_load_use (prev2_insn, prev2_op, insn, op)) 2544 ok = false;2561 ok = FALSE; 2545 2562 } 2546 2563 … … 2548 2565 { 2549 2566 if (! (*swap) (abfd, sec, relocs, contents, i - 2)) 2550 return false;2551 *pswapped = true;2567 return FALSE; 2568 *pswapped = TRUE; 2552 2569 continue; 2553 2570 } … … 2571 2588 && ! sh_insns_conflict (insn, op, next_insn, next_op)) 2572 2589 { 2573 b oolean ok;2590 bfd_boolean ok; 2574 2591 2575 2592 /* NEXT_INSN is not itself a load/store instruction, 2576 2593 and it does not conflict with INSN. */ 2577 2594 2578 ok = true;2595 ok = TRUE; 2579 2596 2580 2597 /* If PREV_INSN is a load, and it sets a register … … 2585 2602 && (prev_op->flags & LOAD) != 0 2586 2603 && sh_load_use (prev_insn, prev_op, next_insn, next_op)) 2587 ok = false;2604 ok = FALSE; 2588 2605 2589 2606 /* If INSN is a load, and it sets a register which … … 2607 2624 if ((next2_op->flags & (LOAD | STORE)) == 0 2608 2625 && sh_load_use (insn, op, next2_insn, next2_op)) 2609 ok = false;2626 ok = FALSE; 2610 2627 } 2611 2628 … … 2613 2630 { 2614 2631 if (! (*swap) (abfd, sec, relocs, contents, i)) 2615 return false;2616 *pswapped = true;2632 return FALSE; 2633 *pswapped = TRUE; 2617 2634 continue; 2618 2635 } … … 2621 2638 } 2622 2639 2623 return true;2640 return TRUE; 2624 2641 } 2625 2642 #endif /* not COFF_IMAGE_WITH_PE */ … … 2630 2647 swapped. */ 2631 2648 2632 static b oolean2649 static bfd_boolean 2633 2650 sh_align_loads (abfd, sec, internal_relocs, contents, pswapped) 2634 2651 bfd *abfd; … … 2636 2653 struct internal_reloc *internal_relocs; 2637 2654 bfd_byte *contents; 2638 b oolean *pswapped;2655 bfd_boolean *pswapped; 2639 2656 { 2640 2657 struct internal_reloc *irel, *irelend; 2641 2658 bfd_vma *labels = NULL; 2642 2659 bfd_vma *label, *label_end; 2643 2644 *pswapped = false; 2660 bfd_size_type amt; 2661 2662 *pswapped = FALSE; 2645 2663 2646 2664 irelend = internal_relocs + sec->reloc_count; 2647 2665 2648 2666 /* Get all the addresses with labels on them. */ 2649 labels = (bfd_vma *) bfd_malloc (sec->reloc_count * sizeof (bfd_vma)); 2667 amt = (bfd_size_type) sec->reloc_count * sizeof (bfd_vma); 2668 labels = (bfd_vma *) bfd_malloc (amt); 2650 2669 if (labels == NULL) 2651 2670 goto error_return; … … 2691 2710 free (labels); 2692 2711 2693 return true;2712 return TRUE; 2694 2713 2695 2714 error_return: 2696 2715 if (labels != NULL) 2697 2716 free (labels); 2698 return false;2717 return FALSE; 2699 2718 } 2700 2719 2701 2720 /* Swap two SH instructions. */ 2702 2721 2703 static b oolean2722 static bfd_boolean 2704 2723 sh_swap_insns (abfd, sec, relocs, contents, addr) 2705 2724 bfd *abfd; … … 2716 2735 i1 = bfd_get_16 (abfd, contents + addr); 2717 2736 i2 = bfd_get_16 (abfd, contents + addr + 2); 2718 bfd_put_16 (abfd, i2, contents + addr);2719 bfd_put_16 (abfd, i1, contents + addr + 2);2737 bfd_put_16 (abfd, (bfd_vma) i2, contents + addr); 2738 bfd_put_16 (abfd, (bfd_vma) i1, contents + addr + 2); 2720 2739 2721 2740 /* Adjust all reloc addresses. */ … … 2769 2788 bfd_byte *loc; 2770 2789 unsigned short insn, oinsn; 2771 b oolean overflow;2790 bfd_boolean overflow; 2772 2791 2773 2792 loc = contents + irel->r_vaddr - sec->vma; 2774 overflow = false;2793 overflow = FALSE; 2775 2794 switch (type) 2776 2795 { … … 2784 2803 insn += add / 2; 2785 2804 if ((oinsn & 0xff00) != (insn & 0xff00)) 2786 overflow = true;2787 bfd_put_16 (abfd, insn, loc);2805 overflow = TRUE; 2806 bfd_put_16 (abfd, (bfd_vma) insn, loc); 2788 2807 break; 2789 2808 … … 2793 2812 insn += add / 2; 2794 2813 if ((oinsn & 0xf000) != (insn & 0xf000)) 2795 overflow = true;2796 bfd_put_16 (abfd, insn, loc);2814 overflow = TRUE; 2815 bfd_put_16 (abfd, (bfd_vma) insn, loc); 2797 2816 break; 2798 2817 … … 2810 2829 insn += add / 2; 2811 2830 if ((oinsn & 0xff00) != (insn & 0xff00)) 2812 overflow = true;2813 bfd_put_16 (abfd, insn, loc);2831 overflow = TRUE; 2832 bfd_put_16 (abfd, (bfd_vma) insn, loc); 2814 2833 } 2815 2834 … … 2821 2840 ((*_bfd_error_handler) 2822 2841 ("%s: 0x%lx: fatal: reloc overflow while relaxing", 2823 bfd_ get_filename (abfd), (unsigned long) irel->r_vaddr));2842 bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); 2824 2843 bfd_set_error (bfd_error_bad_value); 2825 return false;2844 return FALSE; 2826 2845 } 2827 2846 } 2828 2847 } 2829 2848 2830 return true;2849 return TRUE; 2831 2850 } 2832 2851 … … 2835 2854 will handle SH relaxing. */ 2836 2855 2837 static b oolean2856 static bfd_boolean 2838 2857 sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, 2839 2858 relocs, syms, sections) … … 2886 2905 (*_bfd_error_handler) 2887 2906 ("%s: illegal symbol index %ld in relocs", 2888 bfd_ get_filename (input_bfd), symndx);2907 bfd_archive_filename (input_bfd), symndx); 2889 2908 bfd_set_error (bfd_error_bad_value); 2890 return false;2909 return FALSE; 2891 2910 } 2892 2911 h = obj_coff_sym_hashes (input_bfd)[symndx]; … … 2910 2929 { 2911 2930 bfd_set_error (bfd_error_bad_value); 2912 return false;2931 return FALSE; 2913 2932 } 2914 2933 … … 2958 2977 if (! ((*info->callbacks->undefined_symbol) 2959 2978 (info, h->root.root.string, input_bfd, input_section, 2960 rel->r_vaddr - input_section->vma, true)))2961 return false;2979 rel->r_vaddr - input_section->vma, TRUE))) 2980 return FALSE; 2962 2981 } 2963 2982 } … … 2996 3015 (info, name, howto->name, (bfd_vma) 0, input_bfd, 2997 3016 input_section, rel->r_vaddr - input_section->vma))) 2998 return false;3017 return FALSE; 2999 3018 } 3000 3019 } 3001 3020 } 3002 3021 3003 return true;3022 return TRUE; 3004 3023 } 3005 3024 … … 3014 3033 struct bfd_link_order *link_order; 3015 3034 bfd_byte *data; 3016 b oolean relocateable;3035 bfd_boolean relocateable; 3017 3036 asymbol **symbols; 3018 3037 { … … 3034 3053 3035 3054 memcpy (data, coff_section_data (input_bfd, input_section)->contents, 3036 input_section->_raw_size);3055 (size_t) input_section->_raw_size); 3037 3056 3038 3057 if ((input_section->flags & SEC_RELOC) != 0 … … 3043 3062 struct internal_syment *isymp; 3044 3063 asection **secpp; 3064 bfd_size_type amt; 3045 3065 3046 3066 if (! _bfd_coff_get_external_symbols (input_bfd)) … … 3048 3068 3049 3069 internal_relocs = (_bfd_coff_read_internal_relocs 3050 (input_bfd, input_section, false, (bfd_byte *) NULL,3051 false, (struct internal_reloc *) NULL));3070 (input_bfd, input_section, FALSE, (bfd_byte *) NULL, 3071 FALSE, (struct internal_reloc *) NULL)); 3052 3072 if (internal_relocs == NULL) 3053 3073 goto error_return; 3054 3074 3055 internal_syms = ((struct internal_syment *)3056 bfd_malloc (obj_raw_syment_count (input_bfd) 3057 * sizeof (struct internal_syment)));3075 amt = obj_raw_syment_count (input_bfd); 3076 amt *= sizeof (struct internal_syment); 3077 internal_syms = (struct internal_syment *) bfd_malloc (amt); 3058 3078 if (internal_syms == NULL) 3059 3079 goto error_return; 3060 3080 3061 sections = (asection **) bfd_malloc (obj_raw_syment_count (input_bfd) 3062 * sizeof (asection *)); 3081 amt = obj_raw_syment_count (input_bfd); 3082 amt *= sizeof (asection *); 3083 sections = (asection **) bfd_malloc (amt); 3063 3084 if (sections == NULL) 3064 3085 goto error_return; … … 3137 3158 3138 3159 #ifndef TARGET_SHL_SYM 3160 static const bfd_target * coff_small_object_p PARAMS ((bfd *)); 3161 static bfd_boolean coff_small_new_section_hook PARAMS ((bfd *, asection *)); 3139 3162 /* Some people want versions of the SH COFF target which do not align 3140 3163 to 16 byte boundaries. We implement that by adding a couple of new … … 3165 3188 /* Set the section alignment for the small versions. */ 3166 3189 3167 static b oolean3190 static bfd_boolean 3168 3191 coff_small_new_section_hook (abfd, section) 3169 3192 bfd *abfd; … … 3171 3194 { 3172 3195 if (! coff_new_section_hook (abfd, section)) 3173 return false;3196 return FALSE; 3174 3197 3175 3198 /* We must align to at least a four byte boundary, because longword … … 3178 3201 section->alignment_power = 2; 3179 3202 3180 return true;3203 return TRUE; 3181 3204 } 3182 3205 … … 3193 3216 FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, 3194 3217 #ifdef COFF_LONG_FILENAMES 3195 true,3218 TRUE, 3196 3219 #else 3197 false,3220 FALSE, 3198 3221 #endif 3199 3222 #ifdef COFF_LONG_SECTION_NAMES 3200 true,3223 TRUE, 3201 3224 #else 3202 false,3225 FALSE, 3203 3226 #endif 3204 3227 2, 3205 3228 #ifdef COFF_FORCE_SYMBOLS_IN_STRINGS 3206 true,3229 TRUE, 3207 3230 #else 3208 false,3231 FALSE, 3209 3232 #endif 3210 3233 #ifdef COFF_DEBUG_STRING_WIDE_PREFIX -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.