/[gcl]/gcl/binutils/bfd/elf32-d30v.c
ViewVC logotype

Diff of /gcl/binutils/bfd/elf32-d30v.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by camm, Fri Aug 9 05:35:12 2002 UTC revision 1.1.1.1.20.1 by camm, Fri Sep 30 02:08:57 2005 UTC
# Line 1  Line 1 
1  /* D30V-specific support for 32-bit ELF  /* D30V-specific support for 32-bit ELF
2     Copyright 1997, 1998, 1999, 2000, 2001, 2002     Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3     Free Software Foundation, Inc.     Free Software Foundation, Inc.
4     Contributed by Martin Hunt (hunt@cygnus.com).     Contributed by Martin Hunt (hunt@cygnus.com).
5    
# Line 28  Foundation, Inc., 59 Temple Place - Suit Line 28  Foundation, Inc., 59 Temple Place - Suit
28  static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup  static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
29    PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));    PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
30  static void d30v_info_to_howto_rel  static void d30v_info_to_howto_rel
31    PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));    PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
32  static void d30v_info_to_howto_rela  static void d30v_info_to_howto_rela
33    PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));    PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
34  static bfd_reloc_status_type bfd_elf_d30v_reloc PARAMS ((  static bfd_reloc_status_type bfd_elf_d30v_reloc PARAMS ((
35       bfd *abfd,       bfd *abfd,
36       arelent *reloc_entry,       arelent *reloc_entry,
# Line 55  static reloc_howto_type elf_d30v_howto_t Line 55  static reloc_howto_type elf_d30v_howto_t
55           0,                     /* rightshift */           0,                     /* rightshift */
56           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
57           32,                    /* bitsize */           32,                    /* bitsize */
58           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
59           0,                     /* bitpos */           0,                     /* bitpos */
60           complain_overflow_bitfield, /* complain_on_overflow */           complain_overflow_bitfield, /* complain_on_overflow */
61           bfd_elf_generic_reloc, /* special_function */           bfd_elf_generic_reloc, /* special_function */
62           "R_D30V_NONE",         /* name */           "R_D30V_NONE",         /* name */
63           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
64           0,                     /* src_mask */           0,                     /* src_mask */
65           0,                     /* dst_mask */           0,                     /* dst_mask */
66           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
67    
68    /* A 6 bit absolute relocation */    /* A 6 bit absolute relocation */
69    HOWTO (R_D30V_6,              /* type */    HOWTO (R_D30V_6,              /* type */
70           0,                     /* rightshift */           0,                     /* rightshift */
71           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
72           6,                     /* bitsize */           6,                     /* bitsize */
73           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
74           0,                     /* bitpos */           0,                     /* bitpos */
75           complain_overflow_bitfield, /* complain_on_overflow */           complain_overflow_bitfield, /* complain_on_overflow */
76           bfd_elf_generic_reloc, /* special_function */           bfd_elf_generic_reloc, /* special_function */
77           "R_D30V_6",            /* name */           "R_D30V_6",            /* name */
78           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
79           0x3f,                  /* src_mask */           0x3f,                  /* src_mask */
80           0x3f,                  /* dst_mask */           0x3f,                  /* dst_mask */
81           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
82    
83    /* A relative 9 bit relocation, right shifted by 3 */    /* A relative 9 bit relocation, right shifted by 3 */
84    HOWTO (R_D30V_9_PCREL,        /* type */    HOWTO (R_D30V_9_PCREL,        /* type */
85           3,                     /* rightshift */           3,                     /* rightshift */
86           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
87           6,                     /* bitsize */           6,                     /* bitsize */
88           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
89           0,                     /* bitpos */           0,                     /* bitpos */
90           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
91           bfd_elf_d30v_reloc_21, /* special_function */           bfd_elf_d30v_reloc_21, /* special_function */
92           "R_D30V_9_PCREL",      /* name */           "R_D30V_9_PCREL",      /* name */
93           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
94           0x3f,                  /* src_mask */           0x3f,                  /* src_mask */
95           0x3f,                  /* dst_mask */           0x3f,                  /* dst_mask */
96           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
97    
98    /* A relative 9 bit relocation, right shifted by 3 */    /* A relative 9 bit relocation, right shifted by 3 */
99    HOWTO (R_D30V_9_PCREL_R,      /* type */    HOWTO (R_D30V_9_PCREL_R,      /* type */
100           3,                     /* rightshift */           3,                     /* rightshift */
101           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
102           6,                     /* bitsize */           6,                     /* bitsize */
103           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
104           0,                     /* bitpos */           0,                     /* bitpos */
105           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
106           bfd_elf_d30v_reloc_21, /* special_function */           bfd_elf_d30v_reloc_21, /* special_function */
107           "R_D30V_9_PCREL_R",    /* name */           "R_D30V_9_PCREL_R",    /* name */
108           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
109           0x3f,                  /* src_mask */           0x3f,                  /* src_mask */
110           0x3f,                  /* dst_mask */           0x3f,                  /* dst_mask */
111           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
112    
113    /* An absolute 15 bit relocation, right shifted by 3 */    /* An absolute 15 bit relocation, right shifted by 3 */
114    HOWTO (R_D30V_15,             /* type */    HOWTO (R_D30V_15,             /* type */
115           3,                     /* rightshift */           3,                     /* rightshift */
116           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
117           12,                    /* bitsize */           12,                    /* bitsize */
118           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
119           0,                     /* bitpos */           0,                     /* bitpos */
120           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
121           bfd_elf_generic_reloc, /* special_function */           bfd_elf_generic_reloc, /* special_function */
122           "R_D30V_15",           /* name */           "R_D30V_15",           /* name */
123           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
124           0xfff,                 /* src_mask */           0xfff,                 /* src_mask */
125           0xfff,                 /* dst_mask */           0xfff,                 /* dst_mask */
126           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
127    
128    /* A relative 15 bit relocation, right shifted by 3 */    /* A relative 15 bit relocation, right shifted by 3 */
129    HOWTO (R_D30V_15_PCREL,       /* type */    HOWTO (R_D30V_15_PCREL,       /* type */
130           3,                     /* rightshift */           3,                     /* rightshift */
131           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
132           12,                    /* bitsize */           12,                    /* bitsize */
133           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
134           0,                     /* bitpos */           0,                     /* bitpos */
135           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
136           bfd_elf_d30v_reloc_21, /* special_function */           bfd_elf_d30v_reloc_21, /* special_function */
137           "R_D30V_15_PCREL",     /* name */           "R_D30V_15_PCREL",     /* name */
138           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
139           0xfff,                 /* src_mask */           0xfff,                 /* src_mask */
140           0xfff,                 /* dst_mask */           0xfff,                 /* dst_mask */
141           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
142    
143    /* A relative 15 bit relocation, right shifted by 3 */    /* A relative 15 bit relocation, right shifted by 3 */
144    HOWTO (R_D30V_15_PCREL_R,     /* type */    HOWTO (R_D30V_15_PCREL_R,     /* type */
145           3,                     /* rightshift */           3,                     /* rightshift */
146           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
147           12,                    /* bitsize */           12,                    /* bitsize */
148           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
149           0,                     /* bitpos */           0,                     /* bitpos */
150           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
151           bfd_elf_d30v_reloc_21, /* special_function */           bfd_elf_d30v_reloc_21, /* special_function */
152           "R_D30V_15_PCREL_R",   /* name */           "R_D30V_15_PCREL_R",   /* name */
153           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
154           0xfff,                 /* src_mask */           0xfff,                 /* src_mask */
155           0xfff,                 /* dst_mask */           0xfff,                 /* dst_mask */
156           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
157    
158    /* An absolute 21 bit relocation, right shifted by 3 */    /* An absolute 21 bit relocation, right shifted by 3 */
159    HOWTO (R_D30V_21,             /* type */    HOWTO (R_D30V_21,             /* type */
160           3,                     /* rightshift */           3,                     /* rightshift */
161           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
162           18,                    /* bitsize */           18,                    /* bitsize */
163           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
164           0,                     /* bitpos */           0,                     /* bitpos */
165           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
166           bfd_elf_generic_reloc, /* special_function */           bfd_elf_generic_reloc, /* special_function */
167           "R_D30V_21",           /* name */           "R_D30V_21",           /* name */
168           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
169           0x3ffff,               /* src_mask */           0x3ffff,               /* src_mask */
170           0x3ffff,               /* dst_mask */           0x3ffff,               /* dst_mask */
171           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
172    
173    /* A relative 21 bit relocation, right shifted by 3 */    /* A relative 21 bit relocation, right shifted by 3 */
174    HOWTO (R_D30V_21_PCREL,       /* type */    HOWTO (R_D30V_21_PCREL,       /* type */
175           3,                     /* rightshift */           3,                     /* rightshift */
176           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
177           18,                    /* bitsize */           18,                    /* bitsize */
178           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
179           0,                     /* bitpos */           0,                     /* bitpos */
180           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
181           bfd_elf_d30v_reloc_21, /* special_function */           bfd_elf_d30v_reloc_21, /* special_function */
182           "R_D30V_21_PCREL",     /* name */           "R_D30V_21_PCREL",     /* name */
183           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
184           0x3ffff,               /* src_mask */           0x3ffff,               /* src_mask */
185           0x3ffff,               /* dst_mask */           0x3ffff,               /* dst_mask */
186           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
187    
188    /* A relative 21 bit relocation, right shifted by 3, in the Right container */    /* A relative 21 bit relocation, right shifted by 3, in the Right container */
189    HOWTO (R_D30V_21_PCREL_R,     /* type */    HOWTO (R_D30V_21_PCREL_R,     /* type */
190           3,                     /* rightshift */           3,                     /* rightshift */
191           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
192           18,                    /* bitsize */           18,                    /* bitsize */
193           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
194           0,                     /* bitpos */           0,                     /* bitpos */
195           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
196           bfd_elf_d30v_reloc_21, /* special_function */           bfd_elf_d30v_reloc_21, /* special_function */
197           "R_D30V_21_PCREL_R",   /* name */           "R_D30V_21_PCREL_R",   /* name */
198           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
199           0x3ffff,               /* src_mask */           0x3ffff,               /* src_mask */
200           0x3ffff,               /* dst_mask */           0x3ffff,               /* dst_mask */
201           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
202    
203    /* A D30V 32 bit absolute relocation */    /* A D30V 32 bit absolute relocation */
204    HOWTO (R_D30V_32,             /* type */    HOWTO (R_D30V_32,             /* type */
205           0,                     /* rightshift */           0,                     /* rightshift */
206           4,                     /* size (0 = byte, 1 = short, 2 = long) */           4,                     /* size (0 = byte, 1 = short, 2 = long) */
207           32,                    /* bitsize */           32,                    /* bitsize */
208           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
209           0,                     /* bitpos */           0,                     /* bitpos */
210           complain_overflow_bitfield, /* complain_on_overflow */           complain_overflow_bitfield, /* complain_on_overflow */
211           bfd_elf_d30v_reloc,    /* special_function */           bfd_elf_d30v_reloc,    /* special_function */
212           "R_D30V_32",           /* name */           "R_D30V_32",           /* name */
213           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
214           0xffffffff,            /* src_mask */           0xffffffff,            /* src_mask */
215           0xffffffff,            /* dst_mask */           0xffffffff,            /* dst_mask */
216           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
217    
218    /* A relative 32 bit relocation */    /* A relative 32 bit relocation */
219    HOWTO (R_D30V_32_PCREL,       /* type */    HOWTO (R_D30V_32_PCREL,       /* type */
220           0,                     /* rightshift */           0,                     /* rightshift */
221           4,                     /* size (0 = byte, 1 = short, 2 = long) */           4,                     /* size (0 = byte, 1 = short, 2 = long) */
222           32,                    /* bitsize */           32,                    /* bitsize */
223           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
224           0,                     /* bitpos */           0,                     /* bitpos */
225           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
226           bfd_elf_d30v_reloc,    /* special_function */           bfd_elf_d30v_reloc,    /* special_function */
227           "R_D30V_32_PCREL",     /* name */           "R_D30V_32_PCREL",     /* name */
228           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
229           0xffffffff,            /* src_mask */           0xffffffff,            /* src_mask */
230           0xffffffff,            /* dst_mask */           0xffffffff,            /* dst_mask */
231           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
232    
233    /* A regular 32 bit absolute relocation */    /* A regular 32 bit absolute relocation */
234    HOWTO (R_D30V_32_NORMAL,              /* type */    HOWTO (R_D30V_32_NORMAL,              /* type */
235           0,                     /* rightshift */           0,                     /* rightshift */
236           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
237           32,                    /* bitsize */           32,                    /* bitsize */
238           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
239           0,                     /* bitpos */           0,                     /* bitpos */
240           complain_overflow_bitfield, /* complain_on_overflow */           complain_overflow_bitfield, /* complain_on_overflow */
241           bfd_elf_generic_reloc, /* special_function */           bfd_elf_generic_reloc, /* special_function */
242           "R_D30V_32_NORMAL",            /* name */           "R_D30V_32_NORMAL",    /* name */
243           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
244           0xffffffff,            /* src_mask */           0xffffffff,            /* src_mask */
245           0xffffffff,            /* dst_mask */           0xffffffff,            /* dst_mask */
246           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
247    
248  };  };
249    
# Line 290  bfd_elf_d30v_reloc (abfd, reloc_entry, s Line 290  bfd_elf_d30v_reloc (abfd, reloc_entry, s
290      flag = bfd_reloc_undefined;      flag = bfd_reloc_undefined;
291    
292    /* Is the address of the relocation really within the section?  */    /* Is the address of the relocation really within the section?  */
293    if (reloc_entry->address > input_section->_cooked_size)    if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
294      return bfd_reloc_outofrange;      return bfd_reloc_outofrange;
295    
296    /* Work out which section the relocation is targetted at and the    /* Work out which section the relocation is targeted at and the
297       initial relocation command value.  */       initial relocation command value.  */
298    
299    /* Get symbol value.  (Common symbols are special.)  */    /* Get symbol value.  (Common symbols are special.)  */
# Line 399  bfd_elf_d30v_reloc_21 (abfd, reloc_entry Line 399  bfd_elf_d30v_reloc_21 (abfd, reloc_entry
399      flag = bfd_reloc_undefined;      flag = bfd_reloc_undefined;
400    
401    /* Is the address of the relocation really within the section?  */    /* Is the address of the relocation really within the section?  */
402    if (reloc_entry->address > input_section->_cooked_size)    if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
403      return bfd_reloc_outofrange;      return bfd_reloc_outofrange;
404    
405    /* Work out which section the relocation is targetted at and the    /* Work out which section the relocation is targeted at and the
406       initial relocation command value.  */       initial relocation command value.  */
407    
408    /* Get symbol value.  (Common symbols are special.)  */    /* Get symbol value.  (Common symbols are special.)  */
# Line 522  static void Line 522  static void
522  d30v_info_to_howto_rel (abfd, cache_ptr, dst)  d30v_info_to_howto_rel (abfd, cache_ptr, dst)
523       bfd *abfd ATTRIBUTE_UNUSED;       bfd *abfd ATTRIBUTE_UNUSED;
524       arelent *cache_ptr;       arelent *cache_ptr;
525       Elf32_Internal_Rel *dst;       Elf_Internal_Rela *dst;
526  {  {
527    unsigned int r_type;    unsigned int r_type;
528    
# Line 537  static void Line 537  static void
537  d30v_info_to_howto_rela (abfd, cache_ptr, dst)  d30v_info_to_howto_rela (abfd, cache_ptr, dst)
538       bfd *abfd ATTRIBUTE_UNUSED;       bfd *abfd ATTRIBUTE_UNUSED;
539       arelent *cache_ptr;       arelent *cache_ptr;
540       Elf32_Internal_Rela *dst;       Elf_Internal_Rela *dst;
541  {  {
542    unsigned int r_type;    unsigned int r_type;
543    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.1.20.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26