/[gcl]/gcl/binutils/bfd/riscix.c
ViewVC logotype

Diff of /gcl/binutils/bfd/riscix.c

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

revision 1.1.1.1 by camm, Fri Aug 9 05:35:43 2002 UTC revision 1.1.1.1.20.1 by camm, Fri Sep 30 02:09:06 2005 UTC
# Line 1  Line 1 
1  /* BFD back-end for RISC iX (Acorn, arm) binaries.  /* BFD back-end for RISC iX (Acorn, arm) binaries.
2     Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001     Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004,
3     Free Software Foundation, Inc.     2005 Free Software Foundation, Inc.
4     Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)     Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
5    
6  This file is part of BFD, the Binary File Descriptor library.  This file is part of BFD, the Binary File Descriptor library.
# Line 116  Foundation, Inc., 59 Temple Place - Suit Line 116  Foundation, Inc., 59 Temple Place - Suit
116      if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0                        \      if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0                        \
117          || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE,   \          || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE,   \
118                        abfd) != EXEC_BYTES_SIZE)                             \                        abfd) != EXEC_BYTES_SIZE)                             \
119        return false;                                                         \        return FALSE;                                                         \
120      /* Now write out reloc info, followed by syms and strings */            \      /* Now write out reloc info, followed by syms and strings */            \
121                                                                              \                                                                              \
122      if (bfd_get_outsymbols (abfd) != (asymbol **) NULL                      \      if (bfd_get_outsymbols (abfd) != (asymbol **) NULL                      \
123          && bfd_get_symcount (abfd) != 0)                                    \          && bfd_get_symcount (abfd) != 0)                                    \
124        {                                                                     \        {                                                                     \
125          if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)  \          if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)  \
126            return false;                                                     \            return FALSE;                                                     \
127                                                                              \                                                                              \
128          if (! NAME(aout,write_syms) (abfd)) return false;                   \          if (! NAME(aout,write_syms) (abfd)) return FALSE;                   \
129                                                                              \                                                                              \
130          if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \          if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
131            return false;                                                     \            return FALSE;                                                     \
132                                                                              \                                                                              \
133          if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd)))          \          if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd)))          \
134            return false;                                                     \            return FALSE;                                                     \
135          if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \          if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
136            return false;                                                     \            return FALSE;                                                     \
137                                                                              \                                                                              \
138          if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))       \          if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))       \
139            return false;                                                     \            return FALSE;                                                     \
140        }                                                                     \        }                                                                     \
141    }    }
142    
# Line 159  riscix_reloc_type_lookup PARAMS ((bfd *, Line 159  riscix_reloc_type_lookup PARAMS ((bfd *,
159  void  void
160  riscix_swap_std_reloc_out PARAMS ((bfd *, arelent *, struct reloc_std_external *));  riscix_swap_std_reloc_out PARAMS ((bfd *, arelent *, struct reloc_std_external *));
161    
162  boolean  bfd_boolean
163  riscix_squirt_out_relocs PARAMS ((bfd *, asection *));  riscix_squirt_out_relocs PARAMS ((bfd *, asection *));
164    
165  long  long
# Line 171  riscix_some_aout_object_p PARAMS ((bfd * Line 171  riscix_some_aout_object_p PARAMS ((bfd *
171    
172  static reloc_howto_type riscix_std_reloc_howto[] = {  static reloc_howto_type riscix_std_reloc_howto[] = {
173    /* type              rs size bsz  pcrel bitpos ovrf                     sf name     part_inpl readmask  setmask    pcdone */    /* type              rs size bsz  pcrel bitpos ovrf                     sf name     part_inpl readmask  setmask    pcdone */
174    HOWTO( 0,              0,  0,   8,  false, 0, complain_overflow_bitfield,0,"8",        true, 0x000000ff,0x000000ff, false),    HOWTO( 0,              0,  0,   8,  FALSE, 0, complain_overflow_bitfield,0,"8",        TRUE, 0x000000ff,0x000000ff, FALSE),
175    HOWTO( 1,              0,  1,   16, false, 0, complain_overflow_bitfield,0,"16",        true, 0x0000ffff,0x0000ffff, false),    HOWTO( 1,              0,  1,   16, FALSE, 0, complain_overflow_bitfield,0,"16",        TRUE, 0x0000ffff,0x0000ffff, FALSE),
176    HOWTO( 2,              0,  2,   32, false, 0, complain_overflow_bitfield,0,"32",        true, 0xffffffff,0xffffffff, false),    HOWTO( 2,              0,  2,   32, FALSE, 0, complain_overflow_bitfield,0,"32",        TRUE, 0xffffffff,0xffffffff, FALSE),
177    HOWTO( 3,              2,  3,   26, true, 0, complain_overflow_signed,  riscix_fix_pcrel_26 , "ARM26",      true, 0x00ffffff,0x00ffffff, false),    HOWTO( 3,              2,  3,   26, TRUE, 0, complain_overflow_signed,  riscix_fix_pcrel_26 , "ARM26",      TRUE, 0x00ffffff,0x00ffffff, FALSE),
178    HOWTO( 4,              0,  0,   8,  true,  0, complain_overflow_signed,  0,"DISP8",     true, 0x000000ff,0x000000ff, true),    HOWTO( 4,              0,  0,   8,  TRUE,  0, complain_overflow_signed,  0,"DISP8",     TRUE, 0x000000ff,0x000000ff, TRUE),
179    HOWTO( 5,              0,  1,   16, true,  0, complain_overflow_signed,  0,"DISP16",    true, 0x0000ffff,0x0000ffff, true),    HOWTO( 5,              0,  1,   16, TRUE,  0, complain_overflow_signed,  0,"DISP16",    TRUE, 0x0000ffff,0x0000ffff, TRUE),
180    HOWTO( 6,              0,  2,   32, true,  0, complain_overflow_signed,  0,"DISP32",    true, 0xffffffff,0xffffffff, true),    HOWTO( 6,              0,  2,   32, TRUE,  0, complain_overflow_signed,  0,"DISP32",    TRUE, 0xffffffff,0xffffffff, TRUE),
181    HOWTO( 7,              2,  3,   26, false, 0, complain_overflow_signed,  riscix_fix_pcrel_26_done, "ARM26D",true,0x00ffffff,0x00ffffff, false),    HOWTO( 7,              2,  3,   26, FALSE, 0, complain_overflow_signed,  riscix_fix_pcrel_26_done, "ARM26D",TRUE,0x00ffffff,0x00ffffff, FALSE),
182    EMPTY_HOWTO (-1),    EMPTY_HOWTO (-1),
183    HOWTO( 9,              0, -1,   16, false, 0, complain_overflow_bitfield,0,"NEG16",        true, 0x0000ffff,0x0000ffff, false),    HOWTO( 9,              0, -1,   16, FALSE, 0, complain_overflow_bitfield,0,"NEG16",        TRUE, 0x0000ffff,0x0000ffff, FALSE),
184    HOWTO( 10,              0, -2,   32, false, 0, complain_overflow_bitfield,0,"NEG32",        true, 0xffffffff,0xffffffff, false)    HOWTO( 10,              0, -2,   32, FALSE, 0, complain_overflow_bitfield,0,"NEG32",        TRUE, 0xffffffff,0xffffffff, FALSE)
185  };  };
186    
187  #define RISCIX_TABLE_SIZE \  #define RISCIX_TABLE_SIZE \
# Line 331  riscix_swap_std_reloc_out (abfd, g, natp Line 331  riscix_swap_std_reloc_out (abfd, g, natp
331    if (r_length == 3)    if (r_length == 3)
332      r_pcrel = r_pcrel ? 0 : 1;      r_pcrel = r_pcrel ? 0 : 1;
333    
 #if 0  
   /* For a standard reloc, the addend is in the object file.  */  
   r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;  
 #endif  
   
334    /* name was clobbered by aout_write_syms to be symbol index */    /* name was clobbered by aout_write_syms to be symbol index */
335    
336    /* If this relocation is relative to a symbol then set the    /* If this relocation is relative to a symbol then set the
# Line 396  riscix_swap_std_reloc_out (abfd, g, natp Line 391  riscix_swap_std_reloc_out (abfd, g, natp
391      }      }
392  }  }
393    
394  boolean  bfd_boolean
395  riscix_squirt_out_relocs (abfd, section)  riscix_squirt_out_relocs (abfd, section)
396       bfd *abfd;       bfd *abfd;
397       asection *section;       asection *section;
# Line 408  riscix_squirt_out_relocs (abfd, section) Line 403  riscix_squirt_out_relocs (abfd, section)
403    unsigned int count = section->reloc_count;    unsigned int count = section->reloc_count;
404    bfd_size_type natsize;    bfd_size_type natsize;
405    
406    if (count == 0) return true;    if (count == 0)
407        return TRUE;
408    
409    each_size = obj_reloc_entry_size (abfd);    each_size = obj_reloc_entry_size (abfd);
410    natsize = each_size;    natsize = each_size;
411    natsize *= count;    natsize *= count;
412    native = (unsigned char *) bfd_zalloc (abfd, natsize);    native = (unsigned char *) bfd_zalloc (abfd, natsize);
413    if (!native)    if (!native)
414      return false;      return FALSE;
415    
416    generic = section->orelocation;    generic = section->orelocation;
417    
# Line 428  riscix_squirt_out_relocs (abfd, section) Line 424  riscix_squirt_out_relocs (abfd, section)
424    if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)    if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
425      {      {
426        bfd_release (abfd, native);        bfd_release (abfd, native);
427        return false;        return FALSE;
428      }      }
429    
430    bfd_release (abfd, native);    bfd_release (abfd, native);
431    return true;    return TRUE;
432  }  }
433    
434  /*  /*
# Line 576  riscix_some_aout_object_p (abfd, execp, Line 572  riscix_some_aout_object_p (abfd, execp,
572    if (! NAME(aout,make_sections) (abfd))    if (! NAME(aout,make_sections) (abfd))
573      return NULL;      return NULL;
574    
575    obj_datasec (abfd)->_raw_size = execp->a_data;    obj_datasec (abfd)->size = execp->a_data;
576    obj_bsssec (abfd)->_raw_size = execp->a_bss;    obj_bsssec (abfd)->size = execp->a_bss;
577    
578    obj_textsec (abfd)->flags =    obj_textsec (abfd)->flags =
579      (execp->a_trsize != 0      (execp->a_trsize != 0
# Line 618  riscix_some_aout_object_p (abfd, execp, Line 614  riscix_some_aout_object_p (abfd, execp,
614       At some point we should probably break down and stat the file and       At some point we should probably break down and stat the file and
615       declare it executable if (one of) its 'x' bits are on...  */       declare it executable if (one of) its 'x' bits are on...  */
616    if ((execp->a_entry >= obj_textsec(abfd)->vma) &&    if ((execp->a_entry >= obj_textsec(abfd)->vma) &&
617        (execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size))        (execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->size))
618      abfd->flags |= EXEC_P;      abfd->flags |= EXEC_P;
619  #endif /* MACH */  #endif /* MACH */
620    if (result)    if (result)

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