Changeset 609 for branches/GNU/src/binutils/bfd/elf32-m32r.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/elf32-m32r.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* M32R-specific support for 32-bit ELF. 2 Copyright 1996, 1997, 1998, 1999, 2000, 2001 2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 3 3 Free Software Foundation, Inc. 4 4 … … 44 44 PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); 45 45 static void m32r_info_to_howto_rel 46 PARAMS ((bfd *, arelent *, Elf 32_Internal_Rel*));47 b oolean _bfd_m32r_elf_section_from_bfd_section48 PARAMS ((bfd *, Elf32_Internal_Shdr *,asection *, int *));46 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); 47 bfd_boolean _bfd_m32r_elf_section_from_bfd_section 48 PARAMS ((bfd *, asection *, int *)); 49 49 void _bfd_m32r_elf_symbol_processing 50 50 PARAMS ((bfd *, asymbol *)); 51 static b oolean m32r_elf_add_symbol_hook51 static bfd_boolean m32r_elf_add_symbol_hook 52 52 PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, 53 53 const char **, flagword *, asection **, bfd_vma *)); 54 static b oolean m32r_elf_relocate_section54 static bfd_boolean m32r_elf_relocate_section 55 55 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 56 56 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); 57 57 #if 0 /* not yet */ 58 static b oolean m32r_elf_relax_delete_bytes58 static bfd_boolean m32r_elf_relax_delete_bytes 59 59 PARAMS ((bfd *, asection *, bfd_vma, int)); 60 60 #endif 61 62 61 static bfd_reloc_status_type m32r_elf_final_sda_base 63 62 PARAMS ((bfd *, struct bfd_link_info *, const char **, bfd_vma *)); 64 static b oolean m32r_elf_object_p63 static bfd_boolean m32r_elf_object_p 65 64 PARAMS ((bfd *)); 66 65 static void m32r_elf_final_write_processing 67 PARAMS ((bfd *, b oolean));68 static b oolean m32r_elf_set_private_flags66 PARAMS ((bfd *, bfd_boolean)); 67 static bfd_boolean m32r_elf_set_private_flags 69 68 PARAMS ((bfd *, flagword)); 70 static b oolean m32r_elf_copy_private_bfd_data69 static bfd_boolean m32r_elf_merge_private_bfd_data 71 70 PARAMS ((bfd *, bfd *)); 72 static boolean m32r_elf_merge_private_bfd_data 73 PARAMS ((bfd *, bfd *)); 74 static boolean m32r_elf_print_private_bfd_data 71 static bfd_boolean m32r_elf_print_private_bfd_data 75 72 PARAMS ((bfd *, PTR)); 73 static bfd_boolean m32r_elf_gc_sweep_hook 74 PARAMS ((bfd *, struct bfd_link_info *, asection *, 75 const Elf_Internal_Rela *)); 76 static bfd_boolean m32r_elf_check_relocs 77 PARAMS ((bfd *, struct bfd_link_info *, asection *, 78 const Elf_Internal_Rela *)); 79 80 asection * m32r_elf_gc_mark_hook 81 PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, 82 struct elf_link_hash_entry *, Elf_Internal_Sym *)); 76 83 77 84 #define NOP_INSN 0x7000 … … 82 89 relocs will be put in ROM? All in all though, REL relocs are a pain 83 90 to work with. */ 84 #define USE_REL 91 #define USE_REL 1 92 93 #ifndef USE_REL 94 #define USE_REL 0 95 #endif 85 96 86 97 static reloc_howto_type m32r_elf_howto_table[] = … … 91 102 2, /* size (0 = byte, 1 = short, 2 = long) */ 92 103 32, /* bitsize */ 93 false, /* pc_relative */104 FALSE, /* pc_relative */ 94 105 0, /* bitpos */ 95 106 complain_overflow_bitfield, /* complain_on_overflow */ 96 107 bfd_elf_generic_reloc, /* special_function */ 97 108 "R_M32R_NONE", /* name */ 98 false, /* partial_inplace */109 FALSE, /* partial_inplace */ 99 110 0, /* src_mask */ 100 111 0, /* dst_mask */ 101 false), /* pcrel_offset */112 FALSE), /* pcrel_offset */ 102 113 103 114 /* A 16 bit absolute relocation. */ … … 106 117 1, /* size (0 = byte, 1 = short, 2 = long) */ 107 118 16, /* bitsize */ 108 false, /* pc_relative */119 FALSE, /* pc_relative */ 109 120 0, /* bitpos */ 110 121 complain_overflow_bitfield, /* complain_on_overflow */ 111 122 m32r_elf_generic_reloc,/* special_function */ 112 123 "R_M32R_16", /* name */ 113 true, /* partial_inplace */124 TRUE, /* partial_inplace */ 114 125 0xffff, /* src_mask */ 115 126 0xffff, /* dst_mask */ 116 false), /* pcrel_offset */127 FALSE), /* pcrel_offset */ 117 128 118 129 /* A 32 bit absolute relocation. */ … … 121 132 2, /* size (0 = byte, 1 = short, 2 = long) */ 122 133 32, /* bitsize */ 123 false, /* pc_relative */134 FALSE, /* pc_relative */ 124 135 0, /* bitpos */ 125 136 complain_overflow_bitfield, /* complain_on_overflow */ 126 137 m32r_elf_generic_reloc,/* special_function */ 127 138 "R_M32R_32", /* name */ 128 true, /* partial_inplace */139 TRUE, /* partial_inplace */ 129 140 0xffffffff, /* src_mask */ 130 141 0xffffffff, /* dst_mask */ 131 false), /* pcrel_offset */142 FALSE), /* pcrel_offset */ 132 143 133 144 /* A 24 bit address. */ … … 136 147 2, /* size (0 = byte, 1 = short, 2 = long) */ 137 148 24, /* bitsize */ 138 false, /* pc_relative */149 FALSE, /* pc_relative */ 139 150 0, /* bitpos */ 140 151 complain_overflow_unsigned, /* complain_on_overflow */ 141 152 m32r_elf_generic_reloc,/* special_function */ 142 153 "R_M32R_24", /* name */ 143 true, /* partial_inplace */154 TRUE, /* partial_inplace */ 144 155 0xffffff, /* src_mask */ 145 156 0xffffff, /* dst_mask */ 146 false), /* pcrel_offset */157 FALSE), /* pcrel_offset */ 147 158 148 159 /* An PC Relative 10-bit relocation, shifted by 2. … … 158 169 1, /* size (0 = byte, 1 = short, 2 = long) */ 159 170 10, /* bitsize */ 160 true, /* pc_relative */171 TRUE, /* pc_relative */ 161 172 0, /* bitpos */ 162 173 complain_overflow_signed, /* complain_on_overflow */ 163 174 m32r_elf_10_pcrel_reloc, /* special_function */ 164 175 "R_M32R_10_PCREL", /* name */ 165 false, /* partial_inplace */176 FALSE, /* partial_inplace */ 166 177 0xff, /* src_mask */ 167 178 0xff, /* dst_mask */ 168 true), /* pcrel_offset */179 TRUE), /* pcrel_offset */ 169 180 170 181 /* A relative 18 bit relocation, right shifted by 2. */ … … 173 184 2, /* size (0 = byte, 1 = short, 2 = long) */ 174 185 16, /* bitsize */ 175 true, /* pc_relative */186 TRUE, /* pc_relative */ 176 187 0, /* bitpos */ 177 188 complain_overflow_signed, /* complain_on_overflow */ 178 189 bfd_elf_generic_reloc, /* special_function */ 179 190 "R_M32R_18_PCREL", /* name */ 180 false, /* partial_inplace */191 FALSE, /* partial_inplace */ 181 192 0xffff, /* src_mask */ 182 193 0xffff, /* dst_mask */ 183 true), /* pcrel_offset */194 TRUE), /* pcrel_offset */ 184 195 185 196 /* A relative 26 bit relocation, right shifted by 2. */ … … 192 203 2, /* size (0 = byte, 1 = short, 2 = long) */ 193 204 26, /* bitsize */ 194 true, /* pc_relative */205 TRUE, /* pc_relative */ 195 206 0, /* bitpos */ 196 207 complain_overflow_signed, /* complain_on_overflow */ 197 208 bfd_elf_generic_reloc, /* special_function */ 198 209 "R_M32R_26_PCREL", /* name */ 199 false, /* partial_inplace */210 FALSE, /* partial_inplace */ 200 211 0xffffff, /* src_mask */ 201 212 0xffffff, /* dst_mask */ 202 true), /* pcrel_offset */213 TRUE), /* pcrel_offset */ 203 214 204 215 /* High 16 bits of address when lower 16 is or'd in. */ … … 207 218 2, /* size (0 = byte, 1 = short, 2 = long) */ 208 219 16, /* bitsize */ 209 false, /* pc_relative */220 FALSE, /* pc_relative */ 210 221 0, /* bitpos */ 211 222 complain_overflow_dont, /* complain_on_overflow */ 212 223 m32r_elf_hi16_reloc, /* special_function */ 213 224 "R_M32R_HI16_ULO", /* name */ 214 true, /* partial_inplace */225 TRUE, /* partial_inplace */ 215 226 0x0000ffff, /* src_mask */ 216 227 0x0000ffff, /* dst_mask */ 217 false), /* pcrel_offset */228 FALSE), /* pcrel_offset */ 218 229 219 230 /* High 16 bits of address when lower 16 is added in. */ … … 222 233 2, /* size (0 = byte, 1 = short, 2 = long) */ 223 234 16, /* bitsize */ 224 false, /* pc_relative */235 FALSE, /* pc_relative */ 225 236 0, /* bitpos */ 226 237 complain_overflow_dont, /* complain_on_overflow */ 227 238 m32r_elf_hi16_reloc, /* special_function */ 228 239 "R_M32R_HI16_SLO", /* name */ 229 true, /* partial_inplace */240 TRUE, /* partial_inplace */ 230 241 0x0000ffff, /* src_mask */ 231 242 0x0000ffff, /* dst_mask */ 232 false), /* pcrel_offset */243 FALSE), /* pcrel_offset */ 233 244 234 245 /* Lower 16 bits of address. */ … … 237 248 2, /* size (0 = byte, 1 = short, 2 = long) */ 238 249 16, /* bitsize */ 239 false, /* pc_relative */250 FALSE, /* pc_relative */ 240 251 0, /* bitpos */ 241 252 complain_overflow_dont, /* complain_on_overflow */ 242 253 m32r_elf_lo16_reloc, /* special_function */ 243 254 "R_M32R_LO16", /* name */ 244 true, /* partial_inplace */255 TRUE, /* partial_inplace */ 245 256 0x0000ffff, /* src_mask */ 246 257 0x0000ffff, /* dst_mask */ 247 false), /* pcrel_offset */258 FALSE), /* pcrel_offset */ 248 259 249 260 /* Small data area 16 bits offset. */ … … 252 263 2, /* size (0 = byte, 1 = short, 2 = long) */ 253 264 16, /* bitsize */ 254 false, /* pc_relative */265 FALSE, /* pc_relative */ 255 266 0, /* bitpos */ 256 267 complain_overflow_signed, /* complain_on_overflow */ 257 268 m32r_elf_sda16_reloc, /* special_function */ 258 269 "R_M32R_SDA16", /* name */ 259 true, /* partial_inplace */ /* FIXME: correct? */270 TRUE, /* partial_inplace */ /* FIXME: correct? */ 260 271 0x0000ffff, /* src_mask */ 261 272 0x0000ffff, /* dst_mask */ 262 false), /* pcrel_offset */273 FALSE), /* pcrel_offset */ 263 274 264 275 /* GNU extension to record C++ vtable hierarchy */ … … 267 278 2, /* size (0 = byte, 1 = short, 2 = long) */ 268 279 0, /* bitsize */ 269 false, /* pc_relative */280 FALSE, /* pc_relative */ 270 281 0, /* bitpos */ 271 282 complain_overflow_dont, /* complain_on_overflow */ 272 283 NULL, /* special_function */ 273 284 "R_M32R_GNU_VTINHERIT", /* name */ 274 false, /* partial_inplace */285 FALSE, /* partial_inplace */ 275 286 0, /* src_mask */ 276 287 0, /* dst_mask */ 277 false), /* pcrel_offset */288 FALSE), /* pcrel_offset */ 278 289 279 290 /* GNU extension to record C++ vtable member usage */ … … 282 293 2, /* size (0 = byte, 1 = short, 2 = long) */ 283 294 0, /* bitsize */ 284 false, /* pc_relative */295 FALSE, /* pc_relative */ 285 296 0, /* bitpos */ 286 297 complain_overflow_dont, /* complain_on_overflow */ 287 298 _bfd_elf_rel_vtable_reloc_fn, /* special_function */ 288 299 "R_M32R_GNU_VTENTRY", /* name */ 289 false, /* partial_inplace */300 FALSE, /* partial_inplace */ 290 301 0, /* src_mask */ 291 302 0, /* dst_mask */ 292 false), /* pcrel_offset */303 FALSE), /* pcrel_offset */ 293 304 294 305 }; … … 362 373 /* These jumps mask off the lower two bits of the current address 363 374 before doing pcrel calculations. */ 364 relocation -= (offset & - 4L);375 relocation -= (offset & -(bfd_vma) 4); 365 376 366 377 if (relocation < -0x200 || relocation > 0x1ff) … … 373 384 relocation <<= howto->bitpos; 374 385 x = (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask); 375 bfd_put_16 (abfd, x, data + offset);386 bfd_put_16 (abfd, (bfd_vma) x, data + offset); 376 387 377 388 return status; … … 450 461 451 462 /* Save the information, and let LO16 do the actual relocation. */ 452 n = (struct m32r_hi16 *) bfd_malloc ( sizeof *n);463 n = (struct m32r_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); 453 464 if (n == NULL) 454 465 return bfd_reloc_outofrange; … … 549 560 val += 0x10000; 550 561 551 insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);552 bfd_put_32 (input_bfd, insn, l->addr);562 insn = (insn &~ (bfd_vma) 0xffff) | ((val >> 16) & 0xffff); 563 bfd_put_32 (input_bfd, (bfd_vma) insn, l->addr); 553 564 554 565 next = l->next; … … 562 573 /* Now do the LO16 reloc in the usual way. 563 574 ??? It would be nice to call bfd_elf_generic_reloc here, 564 but we have partial_inplace == TRUE. bfd_elf_generic_reloc will575 but we have partial_inplace set. bfd_elf_generic_reloc will 565 576 pass the handling back to bfd_install_relocation which will install 566 577 a section relative addend which is wrong. */ … … 598 609 } 599 610 600 /* Now do the thereloc in the usual way.611 /* Now do the reloc in the usual way. 601 612 ??? It would be nice to call bfd_elf_generic_reloc here, 602 but we have partial_inplace == TRUE. bfd_elf_generic_reloc will613 but we have partial_inplace set. bfd_elf_generic_reloc will 603 614 pass the handling back to bfd_install_relocation which will install 604 615 a section relative addend which is wrong. */ … … 640 651 short x = bfd_get_16 (input_bfd, inplace_address); 641 652 DOIT (x); 642 bfd_put_16 (input_bfd, x, inplace_address);653 bfd_put_16 (input_bfd, (bfd_vma) x, inplace_address); 643 654 } 644 655 break; … … 647 658 unsigned long x = bfd_get_32 (input_bfd, inplace_address); 648 659 DOIT (x); 649 bfd_put_32 (input_bfd, x, inplace_address);660 bfd_put_32 (input_bfd, (bfd_vma)x , inplace_address); 650 661 } 651 662 break; … … 748 759 bfd *abfd ATTRIBUTE_UNUSED; 749 760 arelent *cache_ptr; 750 Elf 32_Internal_Rel*dst;761 Elf_Internal_Rela *dst; 751 762 { 752 763 unsigned int r_type; … … 761 772 index. */ 762 773 763 b oolean764 _bfd_m32r_elf_section_from_bfd_section (abfd, hdr,sec, retval)774 bfd_boolean 775 _bfd_m32r_elf_section_from_bfd_section (abfd, sec, retval) 765 776 bfd *abfd ATTRIBUTE_UNUSED; 766 Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;767 777 asection *sec; 768 778 int *retval; … … 771 781 { 772 782 *retval = SHN_M32R_SCOMMON; 773 return true;774 } 775 return false;783 return TRUE; 784 } 785 return FALSE; 776 786 } 777 787 … … 824 834 linker sections. */ 825 835 826 static b oolean836 static bfd_boolean 827 837 m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) 828 838 bfd *abfd; … … 836 846 if (! info->relocateable 837 847 && (*namep)[0] == '_' && (*namep)[1] == 'S' 838 && strcmp (*namep, "_SDA_BASE_") == 0) 848 && strcmp (*namep, "_SDA_BASE_") == 0 849 && info->hash->creator->flavour == bfd_target_elf_flavour) 839 850 { 840 851 /* This is simpler than using _bfd_elf_create_linker_section … … 844 855 screws of _SDA_BASE_ address calcs because output_offset != 0. */ 845 856 struct elf_link_hash_entry *h; 857 struct bfd_link_hash_entry *bh; 846 858 asection *s = bfd_get_section_by_name (abfd, ".sdata"); 847 859 … … 850 862 if (s == NULL) 851 863 { 852 intflags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS853 864 flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS 865 | SEC_IN_MEMORY | SEC_LINKER_CREATED); 854 866 855 867 s = bfd_make_section_anyway (abfd, ".sdata"); 856 868 if (s == NULL) 857 return false;869 return FALSE; 858 870 bfd_set_section_flags (abfd, s, flags); 859 871 bfd_set_section_alignment (abfd, s, 2); 860 872 } 861 873 862 h = (struct elf_link_hash_entry *)863 bfd_link_hash_lookup (info->hash, "_SDA_BASE_", false, false, false);864 865 if (( h == NULL || h->root.type == bfd_link_hash_undefined)874 bh = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", 875 FALSE, FALSE, FALSE); 876 877 if ((bh == NULL || bh->type == bfd_link_hash_undefined) 866 878 && !(_bfd_generic_link_add_one_symbol (info, 867 879 abfd, … … 869 881 BSF_GLOBAL, 870 882 s, 871 32768,883 (bfd_vma) 32768, 872 884 (const char *) NULL, 873 false,885 FALSE, 874 886 get_elf_backend_data (abfd)->collect, 875 (struct bfd_link_hash_entry **) &h))) 876 return false; 887 &bh))) 888 return FALSE; 889 h = (struct elf_link_hash_entry *) bh; 877 890 h->type = STT_OBJECT; 878 891 } … … 887 900 } 888 901 889 return true;902 return TRUE; 890 903 } 891 904 … … 907 920 struct bfd_link_hash_entry *h; 908 921 909 h = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", false, false, true);922 h = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", FALSE, FALSE, TRUE); 910 923 if (h != (struct bfd_link_hash_entry *) NULL 911 924 && h->type == bfd_link_hash_defined) … … 929 942 /* Relocate an M32R/D ELF section. 930 943 There is some attempt to make this function usable for many architectures, 931 both USE_REL and USE_RELA ['twould be nice if such a critter existed], 932 if only to serve as a learning tool. 944 both for RELA and REL type relocs, if only to serve as a learning tool. 933 945 934 946 The RELOCATE_SECTION function is called by the new ELF backend linker … … 961 973 accordingly. */ 962 974 963 static b oolean975 static bfd_boolean 964 976 m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, 965 977 contents, relocs, local_syms, local_sections) … … 977 989 Elf_Internal_Rela *rel, *relend; 978 990 /* Assume success. */ 979 boolean ret = true; 991 bfd_boolean ret = TRUE; 992 993 #if !USE_REL 994 if (info->relocateable) 995 return TRUE; 996 #endif 980 997 981 998 rel = relocs; … … 1004 1021 { 1005 1022 (*_bfd_error_handler) (_("%s: unknown relocation type %d"), 1006 bfd_ get_filename (input_bfd),1023 bfd_archive_filename (input_bfd), 1007 1024 (int) r_type); 1008 1025 bfd_set_error (bfd_error_bad_value); 1009 ret = false;1026 ret = FALSE; 1010 1027 continue; 1011 1028 } … … 1018 1035 r_symndx = ELF32_R_SYM (rel->r_info); 1019 1036 1037 #if USE_REL 1020 1038 if (info->relocateable) 1021 1039 { … … 1043 1061 sec = local_sections[r_symndx]; 1044 1062 addend += sec->output_offset + sym->st_value; 1045 #ifndef USE_REL 1046 /* This can't be done for USE_REL because it doesn't mean anything 1047 and elf_link_input_bfd asserts this stays zero. */ 1048 rel->r_addend = addend; 1049 #endif 1050 1051 #ifndef USE_REL 1052 /* Addends are stored with relocs. We're done. */ 1053 continue; 1054 #else /* USE_REL */ 1063 1055 1064 /* If partial_inplace, we need to store any additional addend 1056 1065 back in the section. */ … … 1086 1095 addend, contents + offset); 1087 1096 } 1088 #endif /* USE_REL */1089 1097 } 1090 1098 else 1099 #endif /* USE_REL */ 1091 1100 { 1092 1101 bfd_vma relocation; … … 1102 1111 sec = local_sections[r_symndx]; 1103 1112 sym_name = "<local symbol>"; 1113 #if !USE_REL 1114 relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); 1115 addend = rel->r_addend; 1116 #else 1117 /* FIXME: This won't handle local relocations against SEC_MERGE 1118 symbols. See elf32-i386.c for how to do this. */ 1104 1119 relocation = (sec->output_section->vma 1105 1120 + sec->output_offset 1106 1121 + sym->st_value); 1122 #endif 1107 1123 } 1108 1124 else … … 1132 1148 if (! ((*info->callbacks->undefined_symbol) 1133 1149 (info, h->root.root.string, input_bfd, 1134 input_section, offset, true)))1135 return false;1150 input_section, offset, TRUE))) 1151 return FALSE; 1136 1152 relocation = 0; 1137 1153 } … … 1200 1216 if (r != bfd_reloc_ok) 1201 1217 { 1202 ret = false;1218 ret = FALSE; 1203 1219 goto check_reloc; 1204 1220 } … … 1211 1227 else 1212 1228 { 1213 (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), 1214 bfd_get_filename (input_bfd), 1215 sym_name, 1216 m32r_elf_howto_table[(int) r_type].name, 1217 bfd_get_section_name (abfd, sec)); 1229 (*_bfd_error_handler) 1230 (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), 1231 bfd_archive_filename (input_bfd), 1232 sym_name, 1233 m32r_elf_howto_table[(int) r_type].name, 1234 bfd_get_section_name (abfd, sec)); 1218 1235 /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1219 ret = false;1236 ret = FALSE; 1220 1237 continue; 1221 1238 } … … 1257 1274 (info, name, howto->name, (bfd_vma) 0, 1258 1275 input_bfd, input_section, offset))) 1259 return false;1276 return FALSE; 1260 1277 break; 1261 1278 … … 1263 1280 if (! ((*info->callbacks->undefined_symbol) 1264 1281 (info, name, input_bfd, input_section, 1265 offset, true)))1266 return false;1282 offset, TRUE))) 1283 return FALSE; 1267 1284 break; 1268 1285 … … 1287 1304 (info, errmsg, name, input_bfd, input_section, 1288 1305 offset))) 1289 return false;1306 return FALSE; 1290 1307 break; 1291 1308 } … … 1320 1337 */ 1321 1338 1322 static b oolean1339 static bfd_boolean 1323 1340 m32r_elf_relax_section (abfd, sec, link_info, again) 1324 1341 bfd *abfd; 1325 1342 asection *sec; 1326 1343 struct bfd_link_info *link_info; 1327 b oolean *again;1344 bfd_boolean *again; 1328 1345 { 1329 1346 Elf_Internal_Shdr *symtab_hdr; … … 1331 1348 _bfd_elf32_link_read_relocs uses [for convenience - it sets the addend 1332 1349 field to 0]. */ 1333 Elf_Internal_Rela *internal_relocs; 1334 Elf_Internal_Rela *free_relocs = NULL; 1350 Elf_Internal_Rela *internal_relocs = NULL; 1335 1351 Elf_Internal_Rela *irel, *irelend; 1336 1352 bfd_byte *contents = NULL; 1337 bfd_byte *free_contents = NULL; 1338 Elf32_External_Sym *extsyms = NULL; 1339 Elf32_External_Sym *free_extsyms = NULL; 1353 Elf_Internal_Sym *isymbuf = NULL; 1340 1354 1341 1355 /* Assume nothing changes. */ 1342 *again = false;1356 *again = FALSE; 1343 1357 1344 1358 /* We don't have to do anything for a relocateable link, if … … 1350 1364 || (sec->flags & SEC_CODE) == 0 1351 1365 || 0 /* FIXME: check SHF_M32R_CAN_RELAX */) 1352 return true;1366 return TRUE; 1353 1367 1354 1368 /* If this is the first time we have been called for this section, … … 1365 1379 if (internal_relocs == NULL) 1366 1380 goto error_return; 1367 if (! link_info->keep_memory)1368 free_relocs = internal_relocs;1369 1381 1370 1382 /* Walk through them looking for relaxing opportunities. */ … … 1391 1403 if (contents == NULL) 1392 1404 goto error_return; 1393 free_contents = contents;1394 1405 1395 1406 if (! bfd_get_section_contents (abfd, sec, contents, … … 1399 1410 } 1400 1411 1401 /* Read this BFD's symbols if we haven't done so already. */1402 if ( extsyms == NULL)1412 /* Read this BFD's local symbols if we haven't done so already. */ 1413 if (isymbuf == NULL && symtab_hdr->sh_info != 0) 1403 1414 { 1404 /* Get cached copy if it exists. */ 1405 if (symtab_hdr->contents != NULL) 1406 extsyms = (Elf32_External_Sym *) symtab_hdr->contents; 1407 else 1408 { 1409 /* Go get them off disk. */ 1410 extsyms = ((Elf32_External_Sym *) 1411 bfd_malloc (symtab_hdr->sh_size)); 1412 if (extsyms == NULL) 1413 goto error_return; 1414 free_extsyms = extsyms; 1415 if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 1416 || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) 1417 != symtab_hdr->sh_size)) 1418 goto error_return; 1419 } 1415 isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; 1416 if (isymbuf == NULL) 1417 isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, 1418 symtab_hdr->sh_info, 0, 1419 NULL, NULL, NULL); 1420 if (isymbuf == NULL) 1421 goto error_return; 1420 1422 } 1421 1423 … … 1423 1425 if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) 1424 1426 { 1425 Elf_Internal_Sym isym; 1427 /* A local symbol. */ 1428 Elf_Internal_Sym *isym; 1426 1429 asection *sym_sec; 1427 1430 1428 /* A local symbol. */ 1429 bfd_elf32_swap_symbol_in (abfd, 1430 extsyms + ELF32_R_SYM (irel->r_info), 1431 &isym); 1432 1433 sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); 1434 symval = (isym.st_value 1431 isym = isymbuf + ELF32_R_SYM (irel->r_info), 1432 sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); 1433 symval = (isym->st_value 1435 1434 + sym_sec->output_section->vma 1436 1435 + sym_sec->output_offset); … … 1518 1517 be 4 or 8 bytes closer, but we don't know which just yet and 1519 1518 the difference isn't significant enough to worry about. */ 1520 #if ndefUSE_REL /* put in for learning purposes */1519 #if !USE_REL /* put in for learning purposes */ 1521 1520 pcrel_value += irel->r_addend; 1522 1521 #else … … 1547 1546 CODE currently must be a nop, but for cleanness we 1548 1547 allow it to be anything). */ 1549 #if ndefUSE_REL /* put in for learning purposes */1548 #if !USE_REL /* put in for learning purposes */ 1550 1549 code = 0x7e000000 | MAKE_PARALLEL (code); 1551 1550 #else … … 1557 1556 { 1558 1557 /* Change the seth rN,foo to a bl24 foo. */ 1559 #if ndefUSE_REL /* put in for learning purposes */1558 #if !USE_REL /* put in for learning purposes */ 1560 1559 code = 0xfe000000; 1561 1560 #else … … 1594 1593 /* Note that we've changed the relocs, section contents, etc. */ 1595 1594 elf_section_data (sec)->relocs = internal_relocs; 1596 free_relocs = NULL;1597 1598 1595 elf_section_data (sec)->this_hdr.contents = contents; 1599 free_contents = NULL; 1600 1601 symtab_hdr->contents = (bfd_byte *) extsyms; 1602 free_extsyms = NULL; 1596 symtab_hdr->contents = (unsigned char *) isymbuf; 1603 1597 1604 1598 /* Delete TO_DELETE bytes of data. */ … … 1620 1614 /* That will change things, so we should relax again. 1621 1615 Note that this is not required, and it may be slow. */ 1622 *again = true;1616 *again = TRUE; 1623 1617 1624 1618 continue; … … 1628 1622 } 1629 1623 1630 if (free_relocs != NULL) 1631 { 1632 free (free_relocs); 1633 free_relocs = NULL; 1634 } 1635 1636 if (free_contents != NULL) 1624 if (isymbuf != NULL 1625 && symtab_hdr->contents != (unsigned char *) isymbuf) 1637 1626 { 1638 1627 if (! link_info->keep_memory) 1639 free (free_contents); 1628 free (isymbuf); 1629 else 1630 { 1631 /* Cache the symbols for elf_link_input_bfd. */ 1632 symtab_hdr->contents = (unsigned char *) isymbuf; 1633 } 1634 } 1635 1636 if (contents != NULL 1637 && elf_section_data (sec)->this_hdr.contents != contents) 1638 { 1639 if (! link_info->keep_memory) 1640 free (contents); 1640 1641 else 1641 1642 { … … 1643 1644 elf_section_data (sec)->this_hdr.contents = contents; 1644 1645 } 1645 free_contents = NULL; 1646 } 1647 1648 if (free_extsyms != NULL) 1649 { 1650 if (! link_info->keep_memory) 1651 free (free_extsyms); 1652 else 1653 { 1654 /* Cache the symbols for elf_link_input_bfd. */ 1655 symtab_hdr->contents = extsyms; 1656 } 1657 free_extsyms = NULL; 1658 } 1659 1660 return true; 1646 } 1647 1648 if (internal_relocs != NULL 1649 && elf_section_data (sec)->relocs != internal_relocs) 1650 free (internal_relocs); 1651 1652 return TRUE; 1661 1653 1662 1654 error_return: 1663 if (free_relocs != NULL) 1664 free (free_relocs); 1665 if (free_contents != NULL) 1666 free (free_contents); 1667 if (free_extsyms != NULL) 1668 free (free_extsyms); 1669 return false; 1655 if (isymbuf != NULL 1656 && symtab_hdr->contents != (unsigned char *) isymbuf) 1657 free (isymbuf); 1658 if (contents != NULL 1659 && elf_section_data (sec)->this_hdr.contents != contents) 1660 free (contents); 1661 if (internal_relocs != NULL 1662 && elf_section_data (sec)->relocs != internal_relocs) 1663 free (internal_relocs); 1664 1665 return FALSE; 1670 1666 } 1671 1667 1672 1668 /* Delete some bytes from a section while relaxing. */ 1673 1669 1674 static b oolean1670 static bfd_boolean 1675 1671 m32r_elf_relax_delete_bytes (abfd, sec, addr, count) 1676 1672 bfd *abfd; … … 1680 1676 { 1681 1677 Elf_Internal_Shdr *symtab_hdr; 1682 Elf32_External_Sym *extsyms; 1683 int shndx, index; 1678 int shndx; 1684 1679 bfd_byte *contents; 1685 1680 Elf_Internal_Rela *irel, *irelend; 1686 1681 Elf_Internal_Rela *irelalign; 1687 1682 bfd_vma toaddr; 1688 Elf32_External_Sym *esym, *esymend; 1689 struct elf_link_hash_entry *sym_hash; 1690 1691 symtab_hdr = &elf_tdata (abfd)->symtab_hdr; 1692 extsyms = (Elf32_External_Sym *) symtab_hdr->contents; 1683 Elf_Internal_Sym *isym, *isymend; 1684 struct elf_link_hash_entry **sym_hashes; 1685 struct elf_link_hash_entry **end_hashes; 1686 unsigned int symcount; 1693 1687 1694 1688 shndx = _bfd_elf_section_from_bfd_section (abfd, sec); … … 1719 1713 1720 1714 /* Adjust the local symbols defined in this section. */ 1721 esym = extsyms; 1722 esymend = esym + symtab_hdr->sh_info; 1723 for (; esym < esymend; esym++) 1724 { 1725 Elf_Internal_Sym isym; 1726 1727 bfd_elf32_swap_symbol_in (abfd, esym, &isym); 1728 1729 if (isym.st_shndx == shndx 1730 && isym.st_value > addr 1731 && isym.st_value < toaddr) 1715 symtab_hdr = &elf_tdata (abfd)->symtab_hdr; 1716 isym = (Elf_Internal_Sym *) symtab_hdr->contents; 1717 for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) 1718 { 1719 if (isym->st_shndx == shndx 1720 && isym->st_value > addr 1721 && isym->st_value < toaddr) 1722 isym->st_value -= count; 1723 } 1724 1725 /* Now adjust the global symbols defined in this section. */ 1726 symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) 1727 - symtab_hdr->sh_info); 1728 sym_hashes = elf_sym_hashes (abfd); 1729 end_hashes = sym_hashes + symcount; 1730 for (; sym_hashes < end_hashes; sym_hashes++) 1731 { 1732 struct elf_link_hash_entry *sym_hash = *sym_hashes; 1733 1734 if ((sym_hash->root.type == bfd_link_hash_defined 1735 || sym_hash->root.type == bfd_link_hash_defweak) 1736 && sym_hash->root.u.def.section == sec 1737 && sym_hash->root.u.def.value > addr 1738 && sym_hash->root.u.def.value < toaddr) 1732 1739 { 1733 isym.st_value -= count; 1734 bfd_elf32_swap_symbol_out (abfd, &isym, esym); 1740 sym_hash->root.u.def.value -= count; 1735 1741 } 1736 1742 } 1737 1743 1738 /* Now adjust the global symbols defined in this section. */ 1739 esym = extsyms + symtab_hdr->sh_info; 1740 esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)); 1741 for (index = 0; esym < esymend; esym++, index++) 1742 { 1743 Elf_Internal_Sym isym; 1744 1745 bfd_elf32_swap_symbol_in (abfd, esym, &isym); 1746 sym_hash = elf_sym_hashes (abfd)[index]; 1747 if (isym.st_shndx == shndx 1748 && ((sym_hash)->root.type == bfd_link_hash_defined 1749 || (sym_hash)->root.type == bfd_link_hash_defweak) 1750 && (sym_hash)->root.u.def.section == sec 1751 && (sym_hash)->root.u.def.value > addr 1752 && (sym_hash)->root.u.def.value < toaddr) 1753 { 1754 (sym_hash)->root.u.def.value -= count; 1755 } 1756 } 1757 1758 return true; 1744 return TRUE; 1759 1745 } 1760 1746 … … 1769 1755 struct bfd_link_order *link_order; 1770 1756 bfd_byte *data; 1771 b oolean relocateable;1757 bfd_boolean relocateable; 1772 1758 asymbol **symbols; 1773 1759 { … … 1777 1763 asection **sections = NULL; 1778 1764 Elf_Internal_Rela *internal_relocs = NULL; 1779 Elf 32_External_Sym *external_syms= NULL;1780 Elf_Internal_Sym *internal_syms = NULL;1765 Elf_Internal_Sym *isymbuf = NULL; 1766 bfd_size_type amt; 1781 1767 1782 1768 /* We only need to handle the case of relaxing, or of having a … … 1801 1787 Elf32_External_Sym *esym, *esymend; 1802 1788 1803 if (symtab_hdr->contents != NULL) 1804 external_syms = (Elf32_External_Sym *) symtab_hdr->contents; 1805 else 1789 internal_relocs = (_bfd_elf32_link_read_relocs 1790 (input_bfd, input_section, (PTR) NULL, 1791 (Elf_Internal_Rela *) NULL, FALSE)); 1792 if (internal_relocs == NULL) 1793 goto error_return; 1794 1795 if (symtab_hdr->sh_info != 0) 1806 1796 { 1807 external_syms = ((Elf32_External_Sym *) 1808 bfd_malloc (symtab_hdr->sh_info 1809 * sizeof (Elf32_External_Sym))); 1810 if (external_syms == NULL && symtab_hdr->sh_info > 0) 1811 goto error_return; 1812 if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 1813 || (bfd_read (external_syms, sizeof (Elf32_External_Sym), 1814 symtab_hdr->sh_info, input_bfd) 1815 != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym)))) 1797 isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; 1798 if (isymbuf == NULL) 1799 isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, 1800 symtab_hdr->sh_info, 0, 1801 NULL, NULL, NULL); 1802 if (isymbuf == NULL) 1816 1803 goto error_return; 1817 1804 } 1818 1805 1819 internal_relocs = (_bfd_elf32_link_read_relocs 1820 (input_bfd, input_section, (PTR) NULL, 1821 (Elf_Internal_Rela *) NULL, false)); 1822 if (internal_relocs == NULL) 1823 goto error_return; 1824 1825 internal_syms = ((Elf_Internal_Sym *) 1826 bfd_malloc (symtab_hdr->sh_info 1827 * sizeof (Elf_Internal_Sym))); 1828 if (internal_syms == NULL && symtab_hdr->sh_info > 0) 1829 goto error_return; 1830 1831 sections = (asection **) bfd_malloc (symtab_hdr->sh_info 1832 * sizeof (asection *)); 1806 amt = symtab_hdr->sh_info; 1807 amt *= sizeof (asection *); 1808 sections = (asection **) bfd_malloc (amt); 1833 1809 if (sections == NULL && symtab_hdr->sh_info > 0) 1834 1810 goto error_return; 1835 1811 1836 isymp = internal_syms; 1837 secpp = sections; 1838 esym = external_syms; 1839 esymend = esym + symtab_hdr->sh_info; 1840 for (; esym < esymend; ++esym, ++isymp, ++secpp) 1812 isymend = isymbuf + symtab_hdr->sh_info; 1813 for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) 1841 1814 { 1842 1815 asection *isec; 1843 1816 1844 bfd_elf32_swap_symbol_in (input_bfd, esym, isymp); 1845 1846 if (isymp->st_shndx == SHN_UNDEF) 1817 if (isym->st_shndx == SHN_UNDEF) 1847 1818 isec = bfd_und_section_ptr; 1848 else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) 1849 isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); 1850 else if (isymp->st_shndx == SHN_ABS) 1819 else if (isym->st_shndx == SHN_ABS) 1851 1820 isec = bfd_abs_section_ptr; 1852 else if (isym p->st_shndx == SHN_COMMON)1821 else if (isym->st_shndx == SHN_COMMON) 1853 1822 isec = bfd_com_section_ptr; 1854 else if (isym p->st_shndx == SHN_M32R_SCOMMON)1823 else if (isym->st_shndx == SHN_M32R_SCOMMON) 1855 1824 isec = &m32r_elf_scom_section; 1856 1825 else 1857 { 1858 /* Who knows? */ 1859 isec = NULL; 1860 } 1826 isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); 1861 1827 1862 1828 *secpp = isec; … … 1865 1831 if (! m32r_elf_relocate_section (output_bfd, link_info, input_bfd, 1866 1832 input_section, data, internal_relocs, 1867 i nternal_syms, sections))1833 isymbuf, sections)) 1868 1834 goto error_return; 1869 1835 1870 1836 if (sections != NULL) 1871 1837 free (sections); 1872 sections = NULL; 1873 if (internal_syms != NULL) 1874 free (internal_syms); 1875 internal_syms = NULL; 1876 if (external_syms != NULL && symtab_hdr->contents == NULL) 1877 free (external_syms); 1878 external_syms = NULL; 1879 if (internal_relocs != elf_section_data (input_section)->relocs) 1838 if (isymbuf != NULL 1839 && symtab_hdr->contents != (unsigned char *) isymbuf) 1840 free (isymbuf); 1841 if (elf_section_data (input_section)->relocs != internal_relocs) 1880 1842 free (internal_relocs); 1881 internal_relocs = NULL;1882 1843 } 1883 1844 … … 1885 1846 1886 1847 error_return: 1887 if (internal_relocs != NULL1888 && internal_relocs != elf_section_data (input_section)->relocs)1889 free (internal_relocs);1890 if (external_syms != NULL && symtab_hdr->contents == NULL)1891 free (external_syms);1892 if (internal_syms != NULL)1893 free (internal_syms);1894 1848 if (sections != NULL) 1895 1849 free (sections); 1850 if (isymbuf != NULL 1851 && symtab_hdr->contents != (unsigned char *) isymbuf) 1852 free (isymbuf); 1853 if (internal_relocs != NULL 1854 && elf_section_data (input_section)->relocs != internal_relocs) 1855 free (internal_relocs); 1896 1856 return NULL; 1897 1857 } … … 1901 1861 1902 1862 /* Set the right machine number. */ 1903 static b oolean1863 static bfd_boolean 1904 1864 m32r_elf_object_p (abfd) 1905 1865 bfd *abfd; … … 1911 1871 case E_M32RX_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32rx); break; 1912 1872 } 1913 return true;1873 return TRUE; 1914 1874 } 1915 1875 … … 1917 1877 static void 1918 1878 m32r_elf_final_write_processing (abfd, linker) 1919 bfd * 1920 b oolean linker ATTRIBUTE_UNUSED;1879 bfd *abfd; 1880 bfd_boolean linker ATTRIBUTE_UNUSED; 1921 1881 { 1922 1882 unsigned long val; … … 1934 1894 1935 1895 /* Function to keep M32R specific file flags. */ 1936 static b oolean1896 static bfd_boolean 1937 1897 m32r_elf_set_private_flags (abfd, flags) 1938 bfd * 1898 bfd *abfd; 1939 1899 flagword flags; 1940 1900 { … … 1943 1903 1944 1904 elf_elfheader (abfd)->e_flags = flags; 1945 elf_flags_init (abfd) = true; 1946 return true; 1947 } 1948 1949 /* Copy backend specific data from one object module to another */ 1950 static boolean 1951 m32r_elf_copy_private_bfd_data (ibfd, obfd) 1952 bfd * ibfd; 1953 bfd * obfd; 1954 { 1905 elf_flags_init (abfd) = TRUE; 1906 return TRUE; 1907 } 1908 1909 /* Merge backend specific data from an object file to the output 1910 object file when linking. */ 1911 static bfd_boolean 1912 m32r_elf_merge_private_bfd_data (ibfd, obfd) 1913 bfd *ibfd; 1914 bfd *obfd; 1915 { 1916 flagword out_flags; 1917 flagword in_flags; 1918 1955 1919 if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour 1956 1920 || bfd_get_flavour (obfd) != bfd_target_elf_flavour) 1957 return true; 1958 1959 BFD_ASSERT (!elf_flags_init (obfd) 1960 || (elf_elfheader (obfd)->e_flags 1961 == elf_elfheader (ibfd)->e_flags)); 1962 1963 elf_gp (obfd) = elf_gp (ibfd); 1964 elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; 1965 elf_flags_init (obfd) = true; 1966 return true; 1967 } 1968 1969 /* Merge backend specific data from an object file to the output 1970 object file when linking. */ 1971 static boolean 1972 m32r_elf_merge_private_bfd_data (ibfd, obfd) 1973 bfd * ibfd; 1974 bfd * obfd; 1975 { 1976 flagword out_flags; 1977 flagword in_flags; 1978 1979 if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour 1980 || bfd_get_flavour (obfd) != bfd_target_elf_flavour) 1981 return true; 1921 return TRUE; 1982 1922 1983 1923 in_flags = elf_elfheader (ibfd)->e_flags; … … 1993 1933 to the default values. */ 1994 1934 if (bfd_get_arch_info (ibfd)->the_default) 1995 return true;1996 1997 elf_flags_init (obfd) = true;1935 return TRUE; 1936 1937 elf_flags_init (obfd) = TRUE; 1998 1938 elf_elfheader (obfd)->e_flags = in_flags; 1999 1939 … … 2004 1944 } 2005 1945 2006 return true;1946 return TRUE; 2007 1947 } 2008 1948 2009 1949 /* Check flag compatibility. */ 2010 1950 if (in_flags == out_flags) 2011 return true;1951 return TRUE; 2012 1952 2013 1953 if ((in_flags & EF_M32R_ARCH) != (out_flags & EF_M32R_ARCH)) … … 2015 1955 if ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH) 2016 1956 { 2017 _bfd_error_handler (_("%s: Instruction set mismatch with previous modules"), 2018 bfd_get_filename (ibfd)); 1957 (*_bfd_error_handler) 1958 (_("%s: Instruction set mismatch with previous modules"), 1959 bfd_archive_filename (ibfd)); 2019 1960 2020 1961 bfd_set_error (bfd_error_bad_value); 2021 return false;1962 return FALSE; 2022 1963 } 2023 1964 } 2024 1965 2025 return true;1966 return TRUE; 2026 1967 } 2027 1968 2028 1969 /* Display the flags field */ 2029 static b oolean1970 static bfd_boolean 2030 1971 m32r_elf_print_private_bfd_data (abfd, ptr) 2031 bfd * 2032 PTR 1972 bfd *abfd; 1973 PTR ptr; 2033 1974 { 2034 1975 FILE * file = (FILE *) ptr; … … 2049 1990 fputc ('\n', file); 2050 1991 2051 return true;1992 return TRUE; 2052 1993 } 2053 1994 2054 1995 asection * 2055 m32r_elf_gc_mark_hook ( abfd, info, rel, h, sym)2056 bfd *abfd;2057 2058 2059 2060 1996 m32r_elf_gc_mark_hook (sec, info, rel, h, sym) 1997 asection *sec; 1998 struct bfd_link_info *info ATTRIBUTE_UNUSED; 1999 Elf_Internal_Rela *rel; 2000 struct elf_link_hash_entry *h; 2001 Elf_Internal_Sym *sym; 2061 2002 { 2062 2003 if (h != NULL) … … 2084 2025 } 2085 2026 else 2086 { 2087 if (!(elf_bad_symtab (abfd) 2088 && ELF_ST_BIND (sym->st_info) != STB_LOCAL) 2089 && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) 2090 && sym->st_shndx != SHN_COMMON)) 2091 { 2092 return bfd_section_from_elf_index (abfd, sym->st_shndx); 2093 } 2094 } 2027 return bfd_section_from_elf_index (sec->owner, sym->st_shndx); 2028 2095 2029 return NULL; 2096 2030 } 2097 2031 2098 static b oolean2032 static bfd_boolean 2099 2033 m32r_elf_gc_sweep_hook (abfd, info, sec, relocs) 2100 2034 bfd *abfd ATTRIBUTE_UNUSED; … … 2104 2038 { 2105 2039 /* we don't use got and plt entries for m32r */ 2106 return true;2040 return TRUE; 2107 2041 } 2108 2042 … … 2111 2045 virtual table relocs for gc. */ 2112 2046 2113 static b oolean2047 static bfd_boolean 2114 2048 m32r_elf_check_relocs (abfd, info, sec, relocs) 2115 2049 bfd *abfd; … … 2124 2058 2125 2059 if (info->relocateable) 2126 return true;2060 return TRUE; 2127 2061 2128 2062 symtab_hdr = &elf_tdata (abfd)->symtab_hdr; … … 2150 2084 case R_M32R_GNU_VTINHERIT: 2151 2085 if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) 2152 return false;2086 return FALSE; 2153 2087 break; 2154 2088 … … 2157 2091 case R_M32R_GNU_VTENTRY: 2158 2092 if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset)) 2159 return false;2093 return FALSE; 2160 2094 break; 2161 2095 } 2162 2096 } 2163 2097 2164 return true;2098 return TRUE; 2165 2099 } 2166 2100 2167 2101 2168 2102 #define ELF_ARCH bfd_arch_m32r 2169 #define ELF_MACHINE_CODE EM_CYGNUS_M32R 2103 #define ELF_MACHINE_CODE EM_M32R 2104 #define ELF_MACHINE_ALT1 EM_CYGNUS_M32R 2170 2105 #define ELF_MAXPAGESIZE 0x1 /* Explicitly requested by Mitsubishi. */ 2171 2106 … … 2184 2119 2185 2120 #define elf_backend_can_gc_sections 1 2121 #if !USE_REL 2122 #define elf_backend_rela_normal 1 2123 #endif 2186 2124 #if 0 /* not yet */ 2187 2125 /* relax support */ … … 2193 2131 #define elf_backend_object_p m32r_elf_object_p 2194 2132 #define elf_backend_final_write_processing m32r_elf_final_write_processing 2195 #define bfd_elf32_bfd_copy_private_bfd_data m32r_elf_copy_private_bfd_data2196 2133 #define bfd_elf32_bfd_merge_private_bfd_data m32r_elf_merge_private_bfd_data 2197 2134 #define bfd_elf32_bfd_set_private_flags m32r_elf_set_private_flags -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.