/[gcl]/gcl/binutils/bfd/coff-alpha.c
ViewVC logotype

Diff of /gcl/binutils/bfd/coff-alpha.c

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

revision 1.1.1.1 by camm, Fri Aug 9 05:34:49 2002 UTC revision 1.2 by camm, Fri Sep 9 23:32:07 2005 UTC
# Line 1  Line 1 
1  /* BFD back-end for ALPHA Extended-Coff files.  /* BFD back-end for ALPHA Extended-Coff files.
2     Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002     Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3     Free Software Foundation, Inc.     2003, 2004, 2005 Free Software Foundation, Inc.
4     Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and     Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
5     Ian Lance Taylor <ian@cygnus.com>.     Ian Lance Taylor <ian@cygnus.com>.
6    
# Line 35  Foundation, Inc., 59 Temple Place - Suit Line 35  Foundation, Inc., 59 Temple Place - Suit
35    
36  /* Prototypes for static functions.  */  /* Prototypes for static functions.  */
37    
38  static const bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));  static const bfd_target *alpha_ecoff_object_p
39  static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));    PARAMS ((bfd *));
40  static PTR alpha_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));  static bfd_boolean alpha_ecoff_bad_format_hook
41  static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,    PARAMS ((bfd *abfd, PTR filehdr));
42                                                struct internal_reloc *));  static PTR alpha_ecoff_mkobject_hook
43  static void alpha_ecoff_swap_reloc_out PARAMS ((bfd *,    PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
44                                                 const struct internal_reloc *,  static void alpha_ecoff_swap_reloc_in
45                                                 PTR));    PARAMS ((bfd *, PTR, struct internal_reloc *));
46  static void alpha_adjust_reloc_in PARAMS ((bfd *,  static void alpha_ecoff_swap_reloc_out
47                                             const struct internal_reloc *,    PARAMS ((bfd *, const struct internal_reloc *, PTR));
48                                             arelent *));  static void alpha_adjust_reloc_in
49  static void alpha_adjust_reloc_out PARAMS ((bfd *, const arelent *,    PARAMS ((bfd *, const struct internal_reloc *, arelent *));
50                                              struct internal_reloc *));  static void alpha_adjust_reloc_out
51      PARAMS ((bfd *, const arelent *, struct internal_reloc *));
52  static reloc_howto_type *alpha_bfd_reloc_type_lookup  static reloc_howto_type *alpha_bfd_reloc_type_lookup
53   PARAMS ((bfd *, bfd_reloc_code_real_type));    PARAMS ((bfd *, bfd_reloc_code_real_type));
54  static bfd_byte *alpha_ecoff_get_relocated_section_contents  static bfd_byte *alpha_ecoff_get_relocated_section_contents
55    PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *,    PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *,
56             bfd_byte *data, boolean relocateable, asymbol **symbols));             bfd_byte *data, bfd_boolean relocatable, asymbol **symbols));
57  static bfd_vma alpha_convert_external_reloc  static bfd_vma alpha_convert_external_reloc
58    PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *,    PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *,
59             struct ecoff_link_hash_entry *));             struct ecoff_link_hash_entry *));
60  static boolean alpha_relocate_section PARAMS ((bfd *, struct bfd_link_info *,  static bfd_boolean alpha_relocate_section
61                                                 bfd *, asection *,    PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, PTR));
62                                                 bfd_byte *, PTR));  static bfd_boolean alpha_adjust_headers
 static boolean alpha_adjust_headers  
63    PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));    PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *));
64  static PTR alpha_ecoff_read_ar_hdr PARAMS ((bfd *));  static PTR alpha_ecoff_read_ar_hdr
65  static bfd *alpha_ecoff_get_elt_at_filepos PARAMS ((bfd *, file_ptr));    PARAMS ((bfd *));
66  static bfd *alpha_ecoff_openr_next_archived_file PARAMS ((bfd *, bfd *));  static bfd *alpha_ecoff_get_elt_at_filepos
67  static bfd *alpha_ecoff_get_elt_at_index PARAMS ((bfd *, symindex));    PARAMS ((bfd *, file_ptr));
68    static bfd *alpha_ecoff_openr_next_archived_file
69      PARAMS ((bfd *, bfd *));
70    static bfd *alpha_ecoff_get_elt_at_index
71      PARAMS ((bfd *, symindex));
72    
73  /* ECOFF has COFF sections, but the debugging information is stored in  /* ECOFF has COFF sections, but the debugging information is stored in
74     a completely different format.  ECOFF targets use some of the     a completely different format.  ECOFF targets use some of the
# Line 122  static bfd *alpha_ecoff_get_elt_at_index Line 126  static bfd *alpha_ecoff_get_elt_at_index
126    
127  /* How to process the various reloc types.  */  /* How to process the various reloc types.  */
128    
129  static bfd_reloc_status_type  static bfd_reloc_status_type reloc_nil
130  reloc_nil PARAMS ((bfd *, arelent *, asymbol *, PTR,    PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
                    asection *, bfd *, char **));  
131    
132  static bfd_reloc_status_type  static bfd_reloc_status_type
133  reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)  reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
# Line 152  static reloc_howto_type alpha_howto_tabl Line 155  static reloc_howto_type alpha_howto_tabl
155           0,                     /* rightshift */           0,                     /* rightshift */
156           0,                     /* size (0 = byte, 1 = short, 2 = long) */           0,                     /* size (0 = byte, 1 = short, 2 = long) */
157           8,                     /* bitsize */           8,                     /* bitsize */
158           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
159           0,                     /* bitpos */           0,                     /* bitpos */
160           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
161           reloc_nil,             /* special_function */           reloc_nil,             /* special_function */
162           "IGNORE",              /* name */           "IGNORE",              /* name */
163           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
164           0,                     /* src_mask */           0,                     /* src_mask */
165           0,                     /* dst_mask */           0,                     /* dst_mask */
166           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
167    
168    /* A 32 bit reference to a symbol.  */    /* A 32 bit reference to a symbol.  */
169    HOWTO (ALPHA_R_REFLONG,       /* type */    HOWTO (ALPHA_R_REFLONG,       /* type */
170           0,                     /* rightshift */           0,                     /* rightshift */
171           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
172           32,                    /* bitsize */           32,                    /* bitsize */
173           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
174           0,                     /* bitpos */           0,                     /* bitpos */
175           complain_overflow_bitfield, /* complain_on_overflow */           complain_overflow_bitfield, /* complain_on_overflow */
176           0,                     /* special_function */           0,                     /* special_function */
177           "REFLONG",             /* name */           "REFLONG",             /* name */
178           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
179           0xffffffff,            /* src_mask */           0xffffffff,            /* src_mask */
180           0xffffffff,            /* dst_mask */           0xffffffff,            /* dst_mask */
181           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
182    
183    /* A 64 bit reference to a symbol.  */    /* A 64 bit reference to a symbol.  */
184    HOWTO (ALPHA_R_REFQUAD,       /* type */    HOWTO (ALPHA_R_REFQUAD,       /* type */
185           0,                     /* rightshift */           0,                     /* rightshift */
186           4,                     /* size (0 = byte, 1 = short, 2 = long) */           4,                     /* size (0 = byte, 1 = short, 2 = long) */
187           64,                    /* bitsize */           64,                    /* bitsize */
188           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
189           0,                     /* bitpos */           0,                     /* bitpos */
190           complain_overflow_bitfield, /* complain_on_overflow */           complain_overflow_bitfield, /* complain_on_overflow */
191           0,                     /* special_function */           0,                     /* special_function */
192           "REFQUAD",             /* name */           "REFQUAD",             /* name */
193           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
194           MINUS_ONE,             /* src_mask */           MINUS_ONE,             /* src_mask */
195           MINUS_ONE,             /* dst_mask */           MINUS_ONE,             /* dst_mask */
196           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
197    
198    /* A 32 bit GP relative offset.  This is just like REFLONG except    /* A 32 bit GP relative offset.  This is just like REFLONG except
199       that when the value is used the value of the gp register will be       that when the value is used the value of the gp register will be
# Line 199  static reloc_howto_type alpha_howto_tabl Line 202  static reloc_howto_type alpha_howto_tabl
202           0,                     /* rightshift */           0,                     /* rightshift */
203           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
204           32,                    /* bitsize */           32,                    /* bitsize */
205           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
206           0,                     /* bitpos */           0,                     /* bitpos */
207           complain_overflow_bitfield, /* complain_on_overflow */           complain_overflow_bitfield, /* complain_on_overflow */
208           0,                     /* special_function */           0,                     /* special_function */
209           "GPREL32",             /* name */           "GPREL32",             /* name */
210           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
211           0xffffffff,            /* src_mask */           0xffffffff,            /* src_mask */
212           0xffffffff,            /* dst_mask */           0xffffffff,            /* dst_mask */
213           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
214    
215    /* Used for an instruction that refers to memory off the GP    /* Used for an instruction that refers to memory off the GP
216       register.  The offset is 16 bits of the 32 bit instruction.  This       register.  The offset is 16 bits of the 32 bit instruction.  This
# Line 216  static reloc_howto_type alpha_howto_tabl Line 219  static reloc_howto_type alpha_howto_tabl
219           0,                     /* rightshift */           0,                     /* rightshift */
220           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
221           16,                    /* bitsize */           16,                    /* bitsize */
222           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
223           0,                     /* bitpos */           0,                     /* bitpos */
224           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
225           0,                     /* special_function */           0,                     /* special_function */
226           "LITERAL",             /* name */           "LITERAL",             /* name */
227           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
228           0xffff,                /* src_mask */           0xffff,                /* src_mask */
229           0xffff,                /* dst_mask */           0xffff,                /* dst_mask */
230           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
231    
232    /* This reloc only appears immediately following a LITERAL reloc.    /* This reloc only appears immediately following a LITERAL reloc.
233       It identifies a use of the literal.  It seems that the linker can       It identifies a use of the literal.  It seems that the linker can
# Line 239  static reloc_howto_type alpha_howto_tabl Line 242  static reloc_howto_type alpha_howto_tabl
242           0,                     /* rightshift */           0,                     /* rightshift */
243           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
244           32,                    /* bitsize */           32,                    /* bitsize */
245           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
246           0,                     /* bitpos */           0,                     /* bitpos */
247           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
248           reloc_nil,             /* special_function */           reloc_nil,             /* special_function */
249           "LITUSE",              /* name */           "LITUSE",              /* name */
250           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
251           0,                     /* src_mask */           0,                     /* src_mask */
252           0,                     /* dst_mask */           0,                     /* dst_mask */
253           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
254    
255    /* Load the gp register.  This is always used for a ldah instruction    /* Load the gp register.  This is always used for a ldah instruction
256       which loads the upper 16 bits of the gp register.  The next reloc       which loads the upper 16 bits of the gp register.  The next reloc
# Line 264  static reloc_howto_type alpha_howto_tabl Line 267  static reloc_howto_type alpha_howto_tabl
267           16,                    /* rightshift */           16,                    /* rightshift */
268           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
269           16,                    /* bitsize */           16,                    /* bitsize */
270           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
271           0,                     /* bitpos */           0,                     /* bitpos */
272           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
273           reloc_nil,             /* special_function */           reloc_nil,             /* special_function */
274           "GPDISP",              /* name */           "GPDISP",              /* name */
275           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
276           0xffff,                /* src_mask */           0xffff,                /* src_mask */
277           0xffff,                /* dst_mask */           0xffff,                /* dst_mask */
278           true),                 /* pcrel_offset */           TRUE),                 /* pcrel_offset */
279    
280    /* A 21 bit branch.  The native assembler generates these for    /* A 21 bit branch.  The native assembler generates these for
281       branches within the text segment, and also fills in the PC       branches within the text segment, and also fills in the PC
# Line 281  static reloc_howto_type alpha_howto_tabl Line 284  static reloc_howto_type alpha_howto_tabl
284           2,                     /* rightshift */           2,                     /* rightshift */
285           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
286           21,                    /* bitsize */           21,                    /* bitsize */
287           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
288           0,                     /* bitpos */           0,                     /* bitpos */
289           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
290           0,                     /* special_function */           0,                     /* special_function */
291           "BRADDR",              /* name */           "BRADDR",              /* name */
292           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
293           0x1fffff,              /* src_mask */           0x1fffff,              /* src_mask */
294           0x1fffff,              /* dst_mask */           0x1fffff,              /* dst_mask */
295           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
296    
297    /* A hint for a jump to a register.  */    /* A hint for a jump to a register.  */
298    HOWTO (ALPHA_R_HINT,          /* type */    HOWTO (ALPHA_R_HINT,          /* type */
299           2,                     /* rightshift */           2,                     /* rightshift */
300           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
301           14,                    /* bitsize */           14,                    /* bitsize */
302           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
303           0,                     /* bitpos */           0,                     /* bitpos */
304           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
305           0,                     /* special_function */           0,                     /* special_function */
306           "HINT",                /* name */           "HINT",                /* name */
307           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
308           0x3fff,                /* src_mask */           0x3fff,                /* src_mask */
309           0x3fff,                /* dst_mask */           0x3fff,                /* dst_mask */
310           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
311    
312    /* 16 bit PC relative offset.  */    /* 16 bit PC relative offset.  */
313    HOWTO (ALPHA_R_SREL16,        /* type */    HOWTO (ALPHA_R_SREL16,        /* type */
314           0,                     /* rightshift */           0,                     /* rightshift */
315           1,                     /* size (0 = byte, 1 = short, 2 = long) */           1,                     /* size (0 = byte, 1 = short, 2 = long) */
316           16,                    /* bitsize */           16,                    /* bitsize */
317           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
318           0,                     /* bitpos */           0,                     /* bitpos */
319           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
320           0,                     /* special_function */           0,                     /* special_function */
321           "SREL16",              /* name */           "SREL16",              /* name */
322           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
323           0xffff,                /* src_mask */           0xffff,                /* src_mask */
324           0xffff,                /* dst_mask */           0xffff,                /* dst_mask */
325           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
326    
327    /* 32 bit PC relative offset.  */    /* 32 bit PC relative offset.  */
328    HOWTO (ALPHA_R_SREL32,        /* type */    HOWTO (ALPHA_R_SREL32,        /* type */
329           0,                     /* rightshift */           0,                     /* rightshift */
330           2,                     /* size (0 = byte, 1 = short, 2 = long) */           2,                     /* size (0 = byte, 1 = short, 2 = long) */
331           32,                    /* bitsize */           32,                    /* bitsize */
332           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
333           0,                     /* bitpos */           0,                     /* bitpos */
334           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
335           0,                     /* special_function */           0,                     /* special_function */
336           "SREL32",              /* name */           "SREL32",              /* name */
337           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
338           0xffffffff,            /* src_mask */           0xffffffff,            /* src_mask */
339           0xffffffff,            /* dst_mask */           0xffffffff,            /* dst_mask */
340           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
341    
342    /* A 64 bit PC relative offset.  */    /* A 64 bit PC relative offset.  */
343    HOWTO (ALPHA_R_SREL64,        /* type */    HOWTO (ALPHA_R_SREL64,        /* type */
344           0,                     /* rightshift */           0,                     /* rightshift */
345           4,                     /* size (0 = byte, 1 = short, 2 = long) */           4,                     /* size (0 = byte, 1 = short, 2 = long) */
346           64,                    /* bitsize */           64,                    /* bitsize */
347           true,                  /* pc_relative */           TRUE,                  /* pc_relative */
348           0,                     /* bitpos */           0,                     /* bitpos */
349           complain_overflow_signed, /* complain_on_overflow */           complain_overflow_signed, /* complain_on_overflow */
350           0,                     /* special_function */           0,                     /* special_function */
351           "SREL64",              /* name */           "SREL64",              /* name */
352           true,                  /* partial_inplace */           TRUE,                  /* partial_inplace */
353           MINUS_ONE,             /* src_mask */           MINUS_ONE,             /* src_mask */
354           MINUS_ONE,             /* dst_mask */           MINUS_ONE,             /* dst_mask */
355           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
356    
357    /* Push a value on the reloc evaluation stack.  */    /* Push a value on the reloc evaluation stack.  */
358    HOWTO (ALPHA_R_OP_PUSH,       /* type */    HOWTO (ALPHA_R_OP_PUSH,       /* type */
359           0,                     /* rightshift */           0,                     /* rightshift */
360           0,                     /* size (0 = byte, 1 = short, 2 = long) */           0,                     /* size (0 = byte, 1 = short, 2 = long) */
361           0,                     /* bitsize */           0,                     /* bitsize */
362           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
363           0,                     /* bitpos */           0,                     /* bitpos */
364           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
365           0,                     /* special_function */           0,                     /* special_function */
366           "OP_PUSH",             /* name */           "OP_PUSH",             /* name */
367           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
368           0,                     /* src_mask */           0,                     /* src_mask */
369           0,                     /* dst_mask */           0,                     /* dst_mask */
370           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
371    
372    /* Store the value from the stack at the given address.  Store it in    /* Store the value from the stack at the given address.  Store it in
373       a bitfield of size r_size starting at bit position r_offset.  */       a bitfield of size r_size starting at bit position r_offset.  */
# Line 372  static reloc_howto_type alpha_howto_tabl Line 375  static reloc_howto_type alpha_howto_tabl
375           0,                     /* rightshift */           0,                     /* rightshift */
376           4,                     /* size (0 = byte, 1 = short, 2 = long) */           4,                     /* size (0 = byte, 1 = short, 2 = long) */
377           64,                    /* bitsize */           64,                    /* bitsize */
378           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
379           0,                     /* bitpos */           0,                     /* bitpos */
380           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
381           0,                     /* special_function */           0,                     /* special_function */
382           "OP_STORE",            /* name */           "OP_STORE",            /* name */
383           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
384           0,                     /* src_mask */           0,                     /* src_mask */
385           MINUS_ONE,             /* dst_mask */           MINUS_ONE,             /* dst_mask */
386           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
387    
388    /* Subtract the reloc address from the value on the top of the    /* Subtract the reloc address from the value on the top of the
389       relocation stack.  */       relocation stack.  */
# Line 388  static reloc_howto_type alpha_howto_tabl Line 391  static reloc_howto_type alpha_howto_tabl
391           0,                     /* rightshift */           0,                     /* rightshift */
392           0,                     /* size (0 = byte, 1 = short, 2 = long) */           0,                     /* size (0 = byte, 1 = short, 2 = long) */
393           0,                     /* bitsize */           0,                     /* bitsize */
394           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
395           0,                     /* bitpos */           0,                     /* bitpos */
396           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
397           0,                     /* special_function */           0,                     /* special_function */
398           "OP_PSUB",             /* name */           "OP_PSUB",             /* name */
399           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
400           0,                     /* src_mask */           0,                     /* src_mask */
401           0,                     /* dst_mask */           0,                     /* dst_mask */
402           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
403    
404    /* Shift the value on the top of the relocation stack right by the    /* Shift the value on the top of the relocation stack right by the
405       given value.  */       given value.  */
# Line 404  static reloc_howto_type alpha_howto_tabl Line 407  static reloc_howto_type alpha_howto_tabl
407           0,                     /* rightshift */           0,                     /* rightshift */
408           0,                     /* size (0 = byte, 1 = short, 2 = long) */           0,                     /* size (0 = byte, 1 = short, 2 = long) */
409           0,                     /* bitsize */           0,                     /* bitsize */
410           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
411           0,                     /* bitpos */           0,                     /* bitpos */
412           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
413           0,                     /* special_function */           0,                     /* special_function */
414           "OP_PRSHIFT",          /* name */           "OP_PRSHIFT",          /* name */
415           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
416           0,                     /* src_mask */           0,                     /* src_mask */
417           0,                     /* dst_mask */           0,                     /* dst_mask */
418           false),                /* pcrel_offset */           FALSE),                /* pcrel_offset */
419    
420    /* Adjust the GP value for a new range in the object file.  */    /* Adjust the GP value for a new range in the object file.  */
421    HOWTO (ALPHA_R_GPVALUE,       /* type */    HOWTO (ALPHA_R_GPVALUE,       /* type */
422           0,                     /* rightshift */           0,                     /* rightshift */
423           0,                     /* size (0 = byte, 1 = short, 2 = long) */           0,                     /* size (0 = byte, 1 = short, 2 = long) */
424           0,                     /* bitsize */           0,                     /* bitsize */
425           false,                 /* pc_relative */           FALSE,                 /* pc_relative */
426           0,                     /* bitpos */           0,                     /* bitpos */
427           complain_overflow_dont, /* complain_on_overflow */           complain_overflow_dont, /* complain_on_overflow */
428           0,                     /* special_function */           0,                     /* special_function */
429           "GPVALUE",             /* name */           "GPVALUE",             /* name */
430           false,                 /* partial_inplace */           FALSE,                 /* partial_inplace */
431           0,                     /* src_mask */           0,                     /* src_mask */
432           0,                     /* dst_mask */           0,                     /* dst_mask */
433           false)                 /* pcrel_offset */           FALSE)                 /* pcrel_offset */
434  };  };
435    
436  /* Recognize an Alpha ECOFF file.  */  /* Recognize an Alpha ECOFF file.  */
# Line 459  alpha_ecoff_object_p (abfd) Line 462  alpha_ecoff_object_p (abfd)
462            bfd_size_type size;            bfd_size_type size;
463    
464            size = sec->line_filepos * 8;            size = sec->line_filepos * 8;
465            BFD_ASSERT (size == bfd_section_size (abfd, sec)            BFD_ASSERT (size == sec->size
466                        || size + 8 == bfd_section_size (abfd, sec));                        || size + 8 == sec->size);
467            if (! bfd_set_section_size (abfd, sec, size))            if (! bfd_set_section_size (abfd, sec, size))
468              return NULL;              return NULL;
469          }          }
# Line 471  alpha_ecoff_object_p (abfd) Line 474  alpha_ecoff_object_p (abfd)
474    
475  /* See whether the magic number matches.  */  /* See whether the magic number matches.  */
476    
477  static boolean  static bfd_boolean
478  alpha_ecoff_bad_format_hook (abfd, filehdr)  alpha_ecoff_bad_format_hook (abfd, filehdr)
479       bfd *abfd ATTRIBUTE_UNUSED;       bfd *abfd ATTRIBUTE_UNUSED;
480       PTR filehdr;       PTR filehdr;
# Line 479  alpha_ecoff_bad_format_hook (abfd, fileh Line 482  alpha_ecoff_bad_format_hook (abfd, fileh
482    struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;    struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
483    
484    if (ALPHA_ECOFF_BADMAG (*internal_f))    if (ALPHA_ECOFF_BADMAG (*internal_f))
485      return false;      return FALSE;
486    
487    return true;    return TRUE;
488  }  }
489    
490  /* This is a hook called by coff_real_object_p to create any backend  /* This is a hook called by coff_real_object_p to create any backend
# Line 665  alpha_adjust_reloc_in (abfd, intern, rpt Line 668  alpha_adjust_reloc_in (abfd, intern, rpt
668      case ALPHA_R_OP_STORE:      case ALPHA_R_OP_STORE:
669        /* The STORE reloc needs the size and offset fields.  We store        /* The STORE reloc needs the size and offset fields.  We store
670           them in the addend.  */           them in the addend.  */
671        BFD_ASSERT (intern->r_offset <= 256 && intern->r_size <= 256);        BFD_ASSERT (intern->r_offset <= 256);
672        rptr->addend = (intern->r_offset << 8) + intern->r_size;        rptr->addend = (intern->r_offset << 8) + intern->r_size;
673        break;        break;
674    
# Line 750  alpha_adjust_reloc_out (abfd, rel, inter Line 753  alpha_adjust_reloc_out (abfd, rel, inter
753    
754  static bfd_byte *  static bfd_byte *
755  alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,  alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
756                                              data, relocateable, symbols)                                              data, relocatable, symbols)
757       bfd *abfd;       bfd *abfd;
758       struct bfd_link_info *link_info;       struct bfd_link_info *link_info;
759       struct bfd_link_order *link_order;       struct bfd_link_order *link_order;
760       bfd_byte *data;       bfd_byte *data;
761       boolean relocateable;       bfd_boolean relocatable;
762       asymbol **symbols;       asymbol **symbols;
763  {  {
764    bfd *input_bfd = link_order->u.indirect.section->owner;    bfd *input_bfd = link_order->u.indirect.section->owner;
# Line 763  alpha_ecoff_get_relocated_section_conten Line 766  alpha_ecoff_get_relocated_section_conten
766    long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);    long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
767    arelent **reloc_vector = NULL;    arelent **reloc_vector = NULL;
768    long reloc_count;    long reloc_count;
769    bfd *output_bfd = relocateable ? abfd : (bfd *) NULL;    bfd *output_bfd = relocatable ? abfd : (bfd *) NULL;
770    bfd_vma gp;    bfd_vma gp;
771    boolean gp_undefined;    bfd_size_type sz;
772      bfd_boolean gp_undefined;
773    bfd_vma stack[RELOC_STACKSIZE];    bfd_vma stack[RELOC_STACKSIZE];
774    int tos = 0;    int tos = 0;
775    
# Line 775  alpha_ecoff_get_relocated_section_conten Line 779  alpha_ecoff_get_relocated_section_conten
779    if (reloc_vector == NULL && reloc_size != 0)    if (reloc_vector == NULL && reloc_size != 0)
780      goto error_return;      goto error_return;
781    
782    if (! bfd_get_section_contents (input_bfd, input_section, data,    sz = input_section->rawsize ? input_section->rawsize : input_section->size;
783                                    (file_ptr) 0, input_section->_raw_size))    if (! bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
784      goto error_return;      goto error_return;
785    
   /* The section size is not going to change.  */  
   input_section->_cooked_size = input_section->_raw_size;  
   input_section->reloc_done = true;  
   
786    reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,    reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
787                                          reloc_vector, symbols);                                          reloc_vector, symbols);
788    if (reloc_count < 0)    if (reloc_count < 0)
# Line 791  alpha_ecoff_get_relocated_section_conten Line 791  alpha_ecoff_get_relocated_section_conten
791      goto successful_return;      goto successful_return;
792    
793    /* Get the GP value for the output BFD.  */    /* Get the GP value for the output BFD.  */
794    gp_undefined = false;    gp_undefined = FALSE;
795    gp = _bfd_get_gp_value (abfd);    gp = _bfd_get_gp_value (abfd);
796    if (gp == 0)    if (gp == 0)
797      {      {
798        if (relocateable)        if (relocatable)
799          {          {
800            asection *sec;            asection *sec;
801            bfd_vma lo;            bfd_vma lo;
# Line 819  alpha_ecoff_get_relocated_section_conten Line 819  alpha_ecoff_get_relocated_section_conten
819          {          {
820            struct bfd_link_hash_entry *h;            struct bfd_link_hash_entry *h;
821    
822            h = bfd_link_hash_lookup (link_info->hash, "_gp", false, false,            h = bfd_link_hash_lookup (link_info->hash, "_gp", FALSE, FALSE,
823                                      true);                                      TRUE);
824            if (h == (struct bfd_link_hash_entry *) NULL            if (h == (struct bfd_link_hash_entry *) NULL
825                || h->type != bfd_link_hash_defined)                || h->type != bfd_link_hash_defined)
826              gp_undefined = true;              gp_undefined = TRUE;
827            else            else
828              {              {
829                gp = (h->u.def.value                gp = (h->u.def.value
# Line 855  alpha_ecoff_get_relocated_section_conten Line 855  alpha_ecoff_get_relocated_section_conten
855          case ALPHA_R_SREL16:          case ALPHA_R_SREL16:
856          case ALPHA_R_SREL32:          case ALPHA_R_SREL32:
857          case ALPHA_R_SREL64:          case ALPHA_R_SREL64:
858            if (relocateable            if (relocatable
859                && ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)                && ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)
860              {              {
861                rel->address += input_section->output_offset;                rel->address += input_section->output_offset;
# Line 988  alpha_ecoff_get_relocated_section_conten Line 988  alpha_ecoff_get_relocated_section_conten
988              asymbol *symbol;              asymbol *symbol;
989              bfd_vma relocation;              bfd_vma relocation;
990    
991              if (relocateable)              if (relocatable)
992                {                {
993                  rel->address += input_section->output_offset;                  rel->address += input_section->output_offset;
994                  break;                  break;
# Line 1021  alpha_ecoff_get_relocated_section_conten Line 1021  alpha_ecoff_get_relocated_section_conten
1021              bfd_vma val;              bfd_vma val;
1022              int offset, size;              int offset, size;
1023    
1024              if (relocateable)              if (relocatable)
1025                {                {
1026                  rel->address += input_section->output_offset;                  rel->address += input_section->output_offset;
1027                  break;                  break;
# Line 1048  alpha_ecoff_get_relocated_section_conten Line 1048  alpha_ecoff_get_relocated_section_conten
1048              asymbol *symbol;              asymbol *symbol;
1049              bfd_vma relocation;              bfd_vma relocation;
1050    
1051              if (relocateable)              if (relocatable)
1052                {                {
1053                  rel->address += input_section->output_offset;                  rel->address += input_section->output_offset;
1054                  break;                  break;
# Line 1081  alpha_ecoff_get_relocated_section_conten Line 1081  alpha_ecoff_get_relocated_section_conten
1081              asymbol *symbol;              asymbol *symbol;
1082              bfd_vma relocation;              bfd_vma relocation;
1083    
1084              if (relocateable)              if (relocatable)
1085                {                {
1086                  rel->address += input_section->output_offset;                  rel->address += input_section->output_offset;
1087                  break;                  break;
# Line 1111  alpha_ecoff_get_relocated_section_conten Line 1111  alpha_ecoff_get_relocated_section_conten
1111          case ALPHA_R_GPVALUE:          case ALPHA_R_GPVALUE:
1112            /* I really don't know if this does the right thing.  */            /* I really don't know if this does the right thing.  */
1113            gp = rel->addend;            gp = rel->addend;
1114            gp_undefined = false;            gp_undefined = FALSE;
1115            break;            break;
1116    
1117          default:          default:
1118            abort ();            abort ();
1119          }          }
1120    
1121        if (relocateable)        if (relocatable)
1122          {          {
1123            asection *os = input_section->output_section;            asection *os = input_section->output_section;
1124    
# Line 1134  alpha_ecoff_get_relocated_section_conten Line 1134  alpha_ecoff_get_relocated_section_conten
1134              case bfd_reloc_undefined:              case bfd_reloc_undefined:
1135                if (! ((*link_info->callbacks->undefined_symbol)                if (! ((*link_info->callbacks->undefined_symbol)
1136                       (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),                       (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
1137                        input_bfd, input_section, rel->address, true)))                        input_bfd, input_section, rel->address, TRUE)))
1138                  goto error_return;                  goto error_return;
1139                break;                break;
1140              case bfd_reloc_dangerous:              case bfd_reloc_dangerous:
# Line 1145  alpha_ecoff_get_relocated_section_conten Line 1145  alpha_ecoff_get_relocated_section_conten
1145                break;                break;
1146              case bfd_reloc_overflow:              case bfd_reloc_overflow:
1147                if (! ((*link_info->callbacks->reloc_overflow)                if (! ((*link_info->callbacks->reloc_overflow)
1148                       (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),                       (link_info, NULL,
1149                          bfd_asymbol_name (*rel->sym_ptr_ptr),
1150                        rel->howto->name, rel->addend, input_bfd,                        rel->howto->name, rel->addend, input_bfd,
1151                        input_section, rel->address)))                        input_section, rel->address)))
1152                  goto error_return;                  goto error_return;
# Line 1220  alpha_bfd_reloc_type_lookup (abfd, code) Line 1221  alpha_bfd_reloc_type_lookup (abfd, code)
1221      case BFD_RELOC_64_PCREL:      case BFD_RELOC_64_PCREL:
1222        alpha_type = ALPHA_R_SREL64;        alpha_type = ALPHA_R_SREL64;
1223        break;        break;
 #if 0  
     case ???:  
       alpha_type = ALPHA_R_OP_PUSH;  
       break;  
     case ???:  
       alpha_type = ALPHA_R_OP_STORE;  
       break;  
     case ???:  
       alpha_type = ALPHA_R_OP_PSUB;  
       break;  
     case ???:  
       alpha_type = ALPHA_R_OP_PRSHIFT;  
       break;  
     case ???:  
       alpha_type = ALPHA_R_GPVALUE;  
       break;  
 #endif  
1224      default:      default:
1225        return (reloc_howto_type *) NULL;        return (reloc_howto_type *) NULL;
1226      }      }
# Line 1245  alpha_bfd_reloc_type_lookup (abfd, code) Line 1229  alpha_bfd_reloc_type_lookup (abfd, code)
1229  }  }
1230    
1231  /* A helper routine for alpha_relocate_section which converts an  /* A helper routine for alpha_relocate_section which converts an
1232     external reloc when generating relocateable output.  Returns the     external reloc when generating relocatable output.  Returns the
1233     relocation amount.  */     relocation amount.  */
1234    
1235  static bfd_vma  static bfd_vma
# Line 1259  alpha_convert_external_reloc (output_bfd Line 1243  alpha_convert_external_reloc (output_bfd
1243    unsigned long r_symndx;    unsigned long r_symndx;
1244    bfd_vma relocation;    bfd_vma relocation;
1245    
1246    BFD_ASSERT (info->relocateable);    BFD_ASSERT (info->relocatable);
1247    
1248    if (h->root.type == bfd_link_hash_defined    if (h->root.type == bfd_link_hash_defined
1249        || h->root.type == bfd_link_hash_defweak)        || h->root.type == bfd_link_hash_defweak)
# Line 1365  alpha_convert_external_reloc (output_bfd Line 1349  alpha_convert_external_reloc (output_bfd
1349     quite similar to get_relocated_section_contents.  Perhaps they     quite similar to get_relocated_section_contents.  Perhaps they
1350     could be combined somehow.  */     could be combined somehow.  */
1351    
1352  static boolean  static bfd_boolean
1353  alpha_relocate_section (output_bfd, info, input_bfd, input_section,  alpha_relocate_section (output_bfd, info, input_bfd, input_section,
1354                          contents, external_relocs)                          contents, external_relocs)
1355       bfd *output_bfd;       bfd *output_bfd;
# Line 1378  alpha_relocate_section (output_bfd, info Line 1362  alpha_relocate_section (output_bfd, info
1362    asection **symndx_to_section, *lita_sec;    asection **symndx_to_section, *lita_sec;
1363    struct ecoff_link_hash_entry **sym_hashes;    struct ecoff_link_hash_entry **sym_hashes;
1364    bfd_vma gp;    bfd_vma gp;
1365    boolean gp_undefined;    bfd_boolean gp_undefined;
1366    bfd_vma stack[RELOC_STACKSIZE];    bfd_vma stack[RELOC_STACKSIZE];
1367    int tos = 0;    int tos = 0;
1368    struct external_reloc *ext_rel;    struct external_reloc *ext_rel;
# Line 1394  alpha_relocate_section (output_bfd, info Line 1378  alpha_relocate_section (output_bfd, info
1378        amt = NUM_RELOC_SECTIONS * sizeof (asection *);        amt = NUM_RELOC_SECTIONS * sizeof (asection *);
1379        symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);        symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
1380        if (!symndx_to_section)        if (!symndx_to_section)
1381          return false;          return FALSE;
1382    
1383        symndx_to_section[RELOC_SECTION_NONE] = NULL;        symndx_to_section[RELOC_SECTION_NONE] = NULL;
1384        symndx_to_section[RELOC_SECTION_TEXT] =        symndx_to_section[RELOC_SECTION_TEXT] =
# Line 1440  alpha_relocate_section (output_bfd, info Line 1424  alpha_relocate_section (output_bfd, info
1424    
1425    lita_sec = symndx_to_section[RELOC_SECTION_LITA];    lita_sec = symndx_to_section[RELOC_SECTION_LITA];
1426    gp = _bfd_get_gp_value (output_bfd);    gp = _bfd_get_gp_value (output_bfd);
1427    if (! info->relocateable && lita_sec != NULL)    if (! info->relocatable && lita_sec != NULL)
1428      {      {
1429        struct ecoff_section_tdata *lita_sec_data;        struct ecoff_section_tdata *lita_sec_data;
1430    
# Line 1452  alpha_relocate_section (output_bfd, info Line 1436  alpha_relocate_section (output_bfd, info
1436            amt = sizeof (struct ecoff_section_tdata);            amt = sizeof (struct ecoff_section_tdata);
1437            lita_sec_data = ((struct ecoff_section_tdata *)            lita_sec_data = ((struct ecoff_section_tdata *)
1438                             bfd_zalloc (input_bfd, amt));                             bfd_zalloc (input_bfd, amt));
1439            ecoff_section_data (input_bfd, lita_sec) = lita_sec_data;            lita_sec->used_by_bfd = lita_sec_data;
1440          }          }
1441    
1442        if (lita_sec_data->gp != 0)        if (lita_sec_data->gp != 0)
# Line 1467  alpha_relocate_section (output_bfd, info Line 1451  alpha_relocate_section (output_bfd, info
1451            bfd_size_type lita_size;            bfd_size_type lita_size;
1452    
1453            lita_vma = lita_sec->output_offset + lita_sec->output_section->vma;            lita_vma = lita_sec->output_offset + lita_sec->output_section->vma;
1454            lita_size = lita_sec->_cooked_size;            lita_size = lita_sec->size;
           if (lita_size == 0)  
             lita_size = lita_sec->_raw_size;  
1455    
1456            if (gp == 0            if (gp == 0
1457                || lita_vma <  gp - 0x8000                || lita_vma <  gp - 0x8000
# Line 1485  alpha_relocate_section (output_bfd, info Line 1467  alpha_relocate_section (output_bfd, info
1467                                                 _("using multiple gp values"),                                                 _("using multiple gp values"),
1468                                                 (char *) NULL, output_bfd,                                                 (char *) NULL, output_bfd,
1469                                                 (asection *) NULL, (bfd_vma) 0);                                                 (asection *) NULL, (bfd_vma) 0);
1470                    ecoff_data (output_bfd)->issued_multiple_gp_warning = true;                    ecoff_data (output_bfd)->issued_multiple_gp_warning = TRUE;
1471                  }                  }
1472                if (lita_vma < gp - 0x8000)                if (lita_vma < gp - 0x8000)
1473                  gp = lita_vma + lita_size - 0x8000;                  gp = lita_vma + lita_size - 0x8000;
# Line 1515  alpha_relocate_section (output_bfd, info Line 1497  alpha_relocate_section (output_bfd, info
1497        int r_extern;        int r_extern;
1498        int r_offset;        int r_offset;
1499        int r_size;        int r_size;
1500        boolean relocatep;        bfd_boolean relocatep;
1501        boolean adjust_addrp;        bfd_boolean adjust_addrp;
1502        boolean gp_usedp;        bfd_boolean gp_usedp;
1503        bfd_vma addend;        bfd_vma addend;
1504    
1505        r_vaddr = H_GET_64 (input_bfd, ext_rel->r_vaddr);        r_vaddr = H_GET_64 (input_bfd, ext_rel->r_vaddr);
# Line 1532  alpha_relocate_section (output_bfd, info Line 1514  alpha_relocate_section (output_bfd, info
1514        r_size = ((ext_rel->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)        r_size = ((ext_rel->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
1515                  >> RELOC_BITS3_SIZE_SH_LITTLE);                  >> RELOC_BITS3_SIZE_SH_LITTLE);
1516    
1517        relocatep = false;        relocatep = FALSE;
1518        adjust_addrp = true;        adjust_addrp = TRUE;
1519        gp_usedp = false;        gp_usedp = FALSE;
1520        addend = 0;        addend = 0;
1521    
1522        switch (r_type)        switch (r_type)
# Line 1549  alpha_relocate_section (output_bfd, info Line 1531  alpha_relocate_section (output_bfd, info
1531               not otherwise used for anything.  For some reason, the               not otherwise used for anything.  For some reason, the
1532               address of the relocation does not appear to include the               address of the relocation does not appear to include the
1533               section VMA, unlike the other relocation types.  */               section VMA, unlike the other relocation types.  */
1534            if (info->relocateable)            if (info->relocatable)
1535              H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,              H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
1536                        ext_rel->r_vaddr);                        ext_rel->r_vaddr);
1537            adjust_addrp = false;            adjust_addrp = FALSE;
1538            break;            break;
1539    
1540          case ALPHA_R_REFLONG:          case ALPHA_R_REFLONG:
1541          case ALPHA_R_REFQUAD:          case ALPHA_R_REFQUAD:
1542          case ALPHA_R_HINT:          case ALPHA_R_HINT:
1543            relocatep = true;            relocatep = TRUE;
1544            break;            break;
1545    
1546          case ALPHA_R_BRADDR:          case ALPHA_R_BRADDR:
# Line 1567  alpha_relocate_section (output_bfd, info Line 1549  alpha_relocate_section (output_bfd, info
1549          case ALPHA_R_SREL64:          case ALPHA_R_SREL64:
1550            if (r_extern)            if (r_extern)
1551              addend += - (r_vaddr + 4);              addend += - (r_vaddr + 4);
1552            relocatep = true;            relocatep = TRUE;
1553            break;            break;
1554    
1555          case ALPHA_R_GPREL32:          case ALPHA_R_GPREL32:
# Line 1575  alpha_relocate_section (output_bfd, info Line 1557  alpha_relocate_section (output_bfd, info
1557               bit offset from the current GP value.  We must adjust it               bit offset from the current GP value.  We must adjust it
1558               by the different between the original GP value and the               by the different between the original GP value and the
1559               current GP value.  */               current GP value.  */
1560            relocatep = true;            relocatep = TRUE;
1561            addend = ecoff_data (input_bfd)->gp - gp;            addend = ecoff_data (input_bfd)->gp - gp;
1562            gp_usedp = true;            gp_usedp = TRUE;
1563            break;            break;
1564    
1565          case ALPHA_R_LITERAL:          case ALPHA_R_LITERAL:
# Line 1608  alpha_relocate_section (output_bfd, info Line 1590  alpha_relocate_section (output_bfd, info
1590                          || ((insn >> 26) & 0x3f) == 0x28);                          || ((insn >> 26) & 0x3f) == 0x28);
1591            }            }
1592    
1593            relocatep = true;            relocatep = TRUE;
1594            addend = ecoff_data (input_bfd)->gp - gp;            addend = ecoff_data (input_bfd)->gp - gp;
1595            gp_usedp = true;            gp_usedp = TRUE;
1596            break;            break;
1597    
1598          case ALPHA_R_LITUSE:          case ALPHA_R_LITUSE:
# Line 1674  alpha_relocate_section (output_bfd, info Line 1656  alpha_relocate_section (output_bfd, info
1656              bfd_put_32 (input_bfd, (bfd_vma) insn2,              bfd_put_32 (input_bfd, (bfd_vma) insn2,
1657                          contents + r_vaddr - input_section->vma + r_symndx);                          contents + r_vaddr - input_section->vma + r_symndx);
1658    
1659              gp_usedp = true;              gp_usedp = TRUE;
1660            }            }
1661            break;            break;
1662    
# Line 1702  alpha_relocate_section (output_bfd, info Line 1684  alpha_relocate_section (output_bfd, info
1684                if (h == (struct ecoff_link_hash_entry *) NULL)                if (h == (struct ecoff_link_hash_entry *) NULL)
1685                  abort ();                  abort ();
1686    
1687                if (! info->relocateable)                if (! info->relocatable)
1688                  {                  {
1689                    if (h->root.type == bfd_link_hash_defined                    if (h->root.type == bfd_link_hash_defined
1690                        || h->root.type == bfd_link_hash_defweak)                        || h->root.type == bfd_link_hash_defweak)
# Line 1717  alpha_relocate_section (output_bfd, info Line 1699  alpha_relocate_section (output_bfd, info
1699                           relocated.  */                           relocated.  */
1700                        if (! ((*info->callbacks->undefined_symbol)                        if (! ((*info->callbacks->undefined_symbol)
1701                               (info, h->root.root.string, input_bfd,                               (info, h->root.root.string, input_bfd,
1702                                input_section, (bfd_vma) 0, true)))                                input_section, (bfd_vma) 0, TRUE)))
1703                          return false;                          return FALSE;
1704                        addend = 0;                        addend = 0;
1705                      }                      }
1706                  }                  }
# Line 1734  alpha_relocate_section (output_bfd, info Line 1716  alpha_relocate_section (output_bfd, info
1716                        if (! ((*info->callbacks->unattached_reloc)                        if (! ((*info->callbacks->unattached_reloc)
1717                               (info, h->root.root.string, input_bfd,                               (info, h->root.root.string, input_bfd,
1718                                input_section, (bfd_vma) 0)))                                input_section, (bfd_vma) 0)))
1719                          return false;                          return FALSE;
1720                      }                      }
1721    
1722                    addend = alpha_convert_external_reloc (output_bfd, info,                    addend = alpha_convert_external_reloc (output_bfd, info,
# Line 1745  alpha_relocate_section (output_bfd, info Line 1727  alpha_relocate_section (output_bfd, info
1727    
1728            addend += r_vaddr;            addend += r_vaddr;
1729    
1730            if (info->relocateable)            if (info->relocatable)
1731              {              {
1732                /* Adjust r_vaddr by the addend.  */                /* Adjust r_vaddr by the addend.  */
1733                H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);                H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
# Line 1774  alpha_relocate_section (output_bfd, info Line 1756  alpha_relocate_section (output_bfd, info
1756                  }                  }
1757              }              }
1758    
1759            adjust_addrp = false;            adjust_addrp = FALSE;
1760            break;            break;
1761    
1762          case ALPHA_R_OP_STORE:          case ALPHA_R_OP_STORE:
1763            /* Store a value from the reloc stack into a bitfield.  If            /* Store a value from the reloc stack into a bitfield.  If
1764               we are generating relocateable output, all we do is               we are generating relocatable output, all we do is
1765               adjust the address of the reloc.  */               adjust the address of the reloc.  */
1766            if (! info->relocateable)            if (! info->relocatable)
1767              {              {
1768                bfd_vma mask;                bfd_vma mask;
1769                bfd_vma val;                bfd_vma val;
# Line 1811  alpha_relocate_section (output_bfd, info Line 1793  alpha_relocate_section (output_bfd, info
1793          case ALPHA_R_GPVALUE:          case ALPHA_R_GPVALUE:
1794            /* I really don't know if this does the right thing.  */            /* I really don't know if this does the right thing.  */
1795            gp = ecoff_data (input_bfd)->gp + r_symndx;            gp = ecoff_data (input_bfd)->gp + r_symndx;
1796            gp_undefined = false;            gp_undefined = FALSE;
1797            break;            break;
1798          }          }
1799    
# Line 1847  alpha_relocate_section (output_bfd, info Line 1829  alpha_relocate_section (output_bfd, info
1829                  abort ();                  abort ();
1830              }              }
1831    
1832            if (info->relocateable)            if (info->relocatable)
1833              {              {
1834                /* We are generating relocateable output, and must                /* We are generating relocatable output, and must
1835                   convert the existing reloc.  */                   convert the existing reloc.  */
1836                if (r_extern)                if (r_extern)
1837                  {                  {
# Line 1861  alpha_relocate_section (output_bfd, info Line 1843  alpha_relocate_section (output_bfd, info
1843                        if (! ((*info->callbacks->unattached_reloc)                        if (! ((*info->callbacks->unattached_reloc)
1844                               (info, h->root.root.string, input_bfd,                               (info, h->root.root.string, input_bfd,
1845                                input_section, r_vaddr - input_section->vma)))                                input_section, r_vaddr - input_section->vma)))
1846                          return false;                          return FALSE;
1847                      }                      }
1848    
1849                    relocation = alpha_convert_external_reloc (output_bfd,                    relocation = alpha_convert_external_reloc (output_bfd,
# Line 1918  alpha_relocate_section (output_bfd, info Line 1900  alpha_relocate_section (output_bfd, info
1900                        if (! ((*info->callbacks->undefined_symbol)                        if (! ((*info->callbacks->undefined_symbol)
1901                               (info, h->root.root.string, input_bfd,                               (info, h->root.root.string, input_bfd,
1902                                input_section,                                input_section,
1903                                r_vaddr - input_section->vma, true)))                                r_vaddr - input_section->vma, TRUE)))
1904                          return false;                          return FALSE;
1905                        relocation = 0;                        relocation = 0;
1906                      }                      }
1907                  }                  }
# Line 1962  alpha_relocate_section (output_bfd, info Line 1944  alpha_relocate_section (output_bfd, info
1944                        name = bfd_section_name (input_bfd,                        name = bfd_section_name (input_bfd,
1945                                                 symndx_to_section[r_symndx]);                                                 symndx_to_section[r_symndx]);
1946                      if (! ((*info->callbacks->reloc_overflow)                      if (! ((*info->callbacks->reloc_overflow)
1947                             (info, name, alpha_howto_table[r_type].name,                             (info, NULL, name,
1948                                alpha_howto_table[r_type].name,
1949                              (bfd_vma) 0, input_bfd, input_section,                              (bfd_vma) 0, input_bfd, input_section,
1950                              r_vaddr - input_section->vma)))                              r_vaddr - input_section->vma)))
1951                        return false;                        return FALSE;
1952                    }                    }
1953                    break;                    break;
1954                  }                  }
1955              }              }
1956          }          }
1957    
1958        if (info->relocateable && adjust_addrp)        if (info->relocatable && adjust_addrp)
1959          {          {
1960            /* Change the address of the relocation.  */            /* Change the address of the relocation.  */
1961            H_PUT_64 (input_bfd,            H_PUT_64 (input_bfd,
# Line 1988  alpha_relocate_section (output_bfd, info Line 1971  alpha_relocate_section (output_bfd, info
1971            if (! ((*info->callbacks->reloc_dangerous)            if (! ((*info->callbacks->reloc_dangerous)
1972                   (info, _("GP relative relocation used when GP not defined"),                   (info, _("GP relative relocation used when GP not defined"),
1973                    input_bfd, input_section, r_vaddr - input_section->vma)))                    input_bfd, input_section, r_vaddr - input_section->vma)))
1974              return false;              return FALSE;
1975            /* Only give the error once per link.  */            /* Only give the error once per link.  */
1976            gp = 4;            gp = 4;
1977            _bfd_set_gp_value (output_bfd, gp);            _bfd_set_gp_value (output_bfd, gp);
1978            gp_undefined = false;            gp_undefined = FALSE;
1979          }          }
1980      }      }
1981    
1982    if (tos != 0)    if (tos != 0)
1983      abort ();      abort ();
1984    
1985    return true;    return TRUE;
1986  }  }
1987    
1988  /* Do final adjustments to the filehdr and the aouthdr.  This routine  /* Do final adjustments to the filehdr and the aouthdr.  This routine
1989     sets the dynamic bits in the file header.  */     sets the dynamic bits in the file header.  */
1990    
1991  static boolean  static bfd_boolean
1992  alpha_adjust_headers (abfd, fhdr, ahdr)  alpha_adjust_headers (abfd, fhdr, ahdr)
1993       bfd *abfd;       bfd *abfd;
1994       struct internal_filehdr *fhdr;       struct internal_filehdr *fhdr;
# Line 2015  alpha_adjust_headers (abfd, fhdr, ahdr) Line 1998  alpha_adjust_headers (abfd, fhdr, ahdr)
1998      fhdr->f_flags |= F_ALPHA_CALL_SHARED;      fhdr->f_flags |= F_ALPHA_CALL_SHARED;
1999    else if ((abfd->flags & DYNAMIC) != 0)    else if ((abfd->flags & DYNAMIC) != 0)
2000      fhdr->f_flags |= F_ALPHA_SHARABLE;      fhdr->f_flags |= F_ALPHA_SHARABLE;
2001    return true;    return TRUE;
2002  }  }
2003    
2004  /* Archive handling.  In OSF/1 (or Digital Unix) v3.2, Digital  /* Archive handling.  In OSF/1 (or Digital Unix) v3.2, Digital
# Line 2185  alpha_ecoff_get_elt_at_filepos (archive, Line 2168  alpha_ecoff_get_elt_at_filepos (archive,
2168    bim->size = size;    bim->size = size;
2169    bim->buffer = buf;    bim->buffer = buf;
2170    
2171    nbfd->mtime_set = true;    nbfd->mtime_set = TRUE;
2172    nbfd->mtime = strtol (hdr->ar_date, (char **) NULL, 10);    nbfd->mtime = strtol (hdr->ar_date, (char **) NULL, 10);
2173    
2174    nbfd->flags |= BFD_IN_MEMORY;    nbfd->flags |= BFD_IN_MEMORY;
# Line 2262  static const struct ecoff_backend_data a Line 2245  static const struct ecoff_backend_data a
2245      (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */      (unsigned (*) PARAMS ((bfd *,PTR,PTR))) bfd_void, /* reloc_out */
2246      alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,      alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
2247      alpha_ecoff_swap_scnhdr_out,      alpha_ecoff_swap_scnhdr_out,
2248      FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, false, 2,      FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, FALSE, 4, FALSE, 2,
2249      alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,      alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
2250      alpha_ecoff_swap_scnhdr_in, NULL,      alpha_ecoff_swap_scnhdr_in, NULL,
2251      alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,      alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
# Line 2278  static const struct ecoff_backend_data a Line 2261  static const struct ecoff_backend_data a
2261    /* The page boundary used to align sections in a demand-paged    /* The page boundary used to align sections in a demand-paged
2262       executable file.  E.g., 0x1000.  */       executable file.  E.g., 0x1000.  */
2263    0x2000,    0x2000,
2264    /* True if the .rdata section is part of the text segment, as on the    /* TRUE if the .rdata section is part of the text segment, as on the
2265       Alpha.  False if .rdata is part of the data segment, as on the       Alpha.  FALSE if .rdata is part of the data segment, as on the
2266       MIPS.  */       MIPS.  */
2267    true,    TRUE,
2268    /* Bitsize of constructor entries.  */    /* Bitsize of constructor entries.  */
2269    64,    64,
2270    /* Reloc to use for constructor entries.  */    /* Reloc to use for constructor entries.  */
# Line 2356  static const struct ecoff_backend_data a Line 2339  static const struct ecoff_backend_data a
2339  #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section  #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
2340  #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections  #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
2341  #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections  #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
2342    #define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section
2343  #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group  #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
2344    #define _bfd_ecoff_section_already_linked \
2345      _bfd_generic_section_already_linked
2346    
2347  const bfd_target ecoffalpha_little_vec =  const bfd_target ecoffalpha_little_vec =
2348  {  {

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

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