Changeset 609 for branches/GNU/src/binutils/bfd/elf32-arc.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-arc.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* ARC-specific support for 32-bit ELF 2 Copyright 1994, 1995, 1997, 1999, 2001 Free Software Foundation, Inc. 2 Copyright 1994, 1995, 1997, 1999, 2001, 2002 3 Free Software Foundation, Inc. 3 4 Contributed by Doug Evans (dje@cygnus.com). 4 5 … … 24 25 #include "elf-bfd.h" 25 26 #include "elf/arc.h" 27 #include "libiberty.h" 26 28 27 29 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup 28 30 PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); 29 31 static void arc_info_to_howto_rel 30 PARAMS ((bfd *, arelent *, Elf 32_Internal_Rel*));31 static b oolean arc_elf_object_p32 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); 33 static bfd_boolean arc_elf_object_p 32 34 PARAMS ((bfd *)); 33 35 static void arc_elf_final_write_processing 34 PARAMS ((bfd *, boolean)); 36 PARAMS ((bfd *, bfd_boolean)); 37 static bfd_reloc_status_type arc_elf_b22_pcrel 38 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); 35 39 36 40 /* Try to minimize the amount of space occupied by relocation tables 37 41 on the ROM (not that the ROM won't be swamped by other ELF overhead). */ 38 42 39 #define USE_REL 43 #define USE_REL 1 40 44 41 45 static reloc_howto_type elf_arc_howto_table[] = … … 46 50 2, /* size (0 = byte, 1 = short, 2 = long) */ 47 51 32, /* bitsize */ 48 false, /* pc_relative */52 FALSE, /* pc_relative */ 49 53 0, /* bitpos */ 50 54 complain_overflow_bitfield, /* complain_on_overflow */ 51 55 bfd_elf_generic_reloc, /* special_function */ 52 56 "R_ARC_NONE", /* name */ 53 false, /* partial_inplace */57 TRUE, /* partial_inplace */ 54 58 0, /* src_mask */ 55 59 0, /* dst_mask */ 56 false), /* pcrel_offset */60 FALSE), /* pcrel_offset */ 57 61 58 62 /* A standard 32 bit relocation. */ … … 61 65 2, /* size (0 = byte, 1 = short, 2 = long) */ 62 66 32, /* bitsize */ 63 false, /* pc_relative */67 FALSE, /* pc_relative */ 64 68 0, /* bitpos */ 65 69 complain_overflow_bitfield, /* complain_on_overflow */ 66 70 bfd_elf_generic_reloc, /* special_function */ 67 71 "R_ARC_32", /* name */ 68 false, /* partial_inplace */72 TRUE, /* partial_inplace */ 69 73 0xffffffff, /* src_mask */ 70 74 0xffffffff, /* dst_mask */ 71 false), /* pcrel_offset */75 FALSE), /* pcrel_offset */ 72 76 73 77 /* A 26 bit absolute branch, right shifted by 2. */ … … 76 80 2, /* size (0 = byte, 1 = short, 2 = long) */ 77 81 26, /* bitsize */ 78 false, /* pc_relative */82 FALSE, /* pc_relative */ 79 83 0, /* bitpos */ 80 84 complain_overflow_bitfield, /* complain_on_overflow */ 81 85 bfd_elf_generic_reloc, /* special_function */ 82 86 "R_ARC_B26", /* name */ 83 false, /* partial_inplace */87 TRUE, /* partial_inplace */ 84 88 0x00ffffff, /* src_mask */ 85 89 0x00ffffff, /* dst_mask */ 86 false), /* pcrel_offset */90 FALSE), /* pcrel_offset */ 87 91 88 92 /* A relative 22 bit branch; bits 21-2 are stored in bits 26-7. */ … … 91 95 2, /* size (0 = byte, 1 = short, 2 = long) */ 92 96 22, /* bitsize */ 93 true, /* pc_relative */97 TRUE, /* pc_relative */ 94 98 7, /* bitpos */ 95 99 complain_overflow_signed, /* complain_on_overflow */ 96 bfd_elf_generic_reloc, /* special_function */100 arc_elf_b22_pcrel, /* special_function */ 97 101 "R_ARC_B22_PCREL", /* name */ 98 false, /* partial_inplace */102 TRUE, /* partial_inplace */ 99 103 0x07ffff80, /* src_mask */ 100 104 0x07ffff80, /* dst_mask */ 101 true), /* pcrel_offset */ 102 105 FALSE), /* pcrel_offset */ 103 106 }; 104 107 … … 127 130 unsigned int i; 128 131 129 for (i = 0; i < sizeof (arc_reloc_map) / sizeof (struct arc_reloc_map); i++) 130 { 131 if (arc_reloc_map[i].bfd_reloc_val == code) 132 return &elf_arc_howto_table[arc_reloc_map[i].elf_reloc_val]; 133 } 132 for (i = ARRAY_SIZE (arc_reloc_map); i--;) 133 if (arc_reloc_map[i].bfd_reloc_val == code) 134 return elf_arc_howto_table + arc_reloc_map[i].elf_reloc_val; 135 134 136 return NULL; 135 137 } … … 141 143 bfd *abfd ATTRIBUTE_UNUSED; 142 144 arelent *cache_ptr; 143 Elf 32_Internal_Rel*dst;145 Elf_Internal_Rela *dst; 144 146 { 145 147 unsigned int r_type; … … 152 154 /* Set the right machine number for an ARC ELF file. */ 153 155 154 static b oolean156 static bfd_boolean 155 157 arc_elf_object_p (abfd) 156 158 bfd *abfd; 157 159 { 158 int mach = bfd_mach_arc_6;160 unsigned int mach = bfd_mach_arc_6; 159 161 160 162 if (elf_elfheader(abfd)->e_machine == EM_ARC) … … 188 190 arc_elf_final_write_processing (abfd, linker) 189 191 bfd *abfd; 190 b oolean linker ATTRIBUTE_UNUSED;192 bfd_boolean linker ATTRIBUTE_UNUSED; 191 193 { 192 194 unsigned long val; … … 208 210 break; 209 211 } 210 elf_elfheader (abfd)->e_machine = EM_ARC;211 212 elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH; 212 213 elf_elfheader (abfd)->e_flags |= val; 214 } 215 216 bfd_reloc_status_type 217 arc_elf_b22_pcrel (abfd, reloc_entry, symbol, data, input_section, 218 output_bfd, error_message) 219 bfd * abfd; 220 arelent * reloc_entry; 221 asymbol * symbol; 222 PTR data; 223 asection * input_section; 224 bfd * output_bfd; 225 char ** error_message; 226 { 227 /* If linking, back up the final symbol address by the address of the 228 reloc. This cannot be accomplished by setting the pcrel_offset 229 field to TRUE, as bfd_install_relocation will detect this and refuse 230 to install the offset in the first place, but bfd_perform_relocation 231 will still insist on removing it. */ 232 if (output_bfd == (bfd *) NULL) 233 reloc_entry->addend -= reloc_entry->address; 234 235 /* Fall through to the default elf reloc handler. */ 236 return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, 237 input_section, output_bfd, error_message); 213 238 } 214 239 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.