Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/coff-mips.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* BFD back-end for MIPS Extended-Coff files.
    22   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    3    2000, 2001
     3   2000, 2001, 2002
    44   Free Software Foundation, Inc.
    55   Original version by Per Bothner.
     
    3737/* Prototypes for static functions.  */
    3838
    39 static boolean mips_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
    40 static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
    41                                               struct internal_reloc *));
    42 static void mips_ecoff_swap_reloc_out PARAMS ((bfd *,
    43                                                const struct internal_reloc *,
    44                                                PTR));
    45 static void mips_adjust_reloc_in PARAMS ((bfd *,
    46                                           const struct internal_reloc *,
    47                                           arelent *));
    48 static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *,
    49                                            struct internal_reloc *));
    50 static bfd_reloc_status_type mips_generic_reloc PARAMS ((bfd *abfd,
    51                                                          arelent *reloc,
    52                                                          asymbol *symbol,
    53                                                          PTR data,
    54                                                          asection *section,
    55                                                          bfd *output_bfd,
    56                                                          char **error));
    57 static bfd_reloc_status_type mips_refhi_reloc PARAMS ((bfd *abfd,
    58                                                        arelent *reloc,
    59                                                        asymbol *symbol,
    60                                                        PTR data,
    61                                                        asection *section,
    62                                                        bfd *output_bfd,
    63                                                        char **error));
    64 static bfd_reloc_status_type mips_reflo_reloc PARAMS ((bfd *abfd,
    65                                                        arelent *reloc,
    66                                                        asymbol *symbol,
    67                                                        PTR data,
    68                                                        asection *section,
    69                                                        bfd *output_bfd,
    70                                                        char **error));
    71 static bfd_reloc_status_type mips_gprel_reloc PARAMS ((bfd *abfd,
    72                                                        arelent *reloc,
    73                                                        asymbol *symbol,
    74                                                        PTR data,
    75                                                        asection *section,
    76                                                        bfd *output_bfd,
    77                                                        char **error));
    78 static bfd_reloc_status_type mips_relhi_reloc PARAMS ((bfd *abfd,
    79                                                        arelent *reloc,
    80                                                        asymbol *symbol,
    81                                                        PTR data,
    82                                                        asection *section,
    83                                                        bfd *output_bfd,
    84                                                        char **error));
    85 static bfd_reloc_status_type mips_rello_reloc PARAMS ((bfd *abfd,
    86                                                        arelent *reloc,
    87                                                        asymbol *symbol,
    88                                                        PTR data,
    89                                                        asection *section,
    90                                                        bfd *output_bfd,
    91                                                        char **error));
    92 static bfd_reloc_status_type mips_switch_reloc PARAMS ((bfd *abfd,
    93                                                         arelent *reloc,
    94                                                         asymbol *symbol,
    95                                                         PTR data,
    96                                                         asection *section,
    97                                                         bfd *output_bfd,
    98                                                         char **error));
    99 static void mips_relocate_hi PARAMS ((struct internal_reloc *refhi,
    100                                       struct internal_reloc *reflo,
    101                                       bfd *input_bfd,
    102                                       asection *input_section,
    103                                       bfd_byte *contents,
    104                                       size_t adjust,
    105                                       bfd_vma relocation,
    106                                       boolean pcrel));
    107 static boolean mips_relocate_section PARAMS ((bfd *, struct bfd_link_info *,
    108                                               bfd *, asection *,
    109                                               bfd_byte *, PTR));
    110 static boolean mips_read_relocs PARAMS ((bfd *, asection *));
    111 static boolean mips_relax_section PARAMS ((bfd *, asection *,
    112                                            struct bfd_link_info *,
    113                                            boolean *));
    114 static boolean mips_relax_pcrel16 PARAMS ((struct bfd_link_info *, bfd *,
    115                                            asection *,
    116                                            struct ecoff_link_hash_entry *,
    117                                            bfd_byte *, bfd_vma));
     39static bfd_boolean mips_ecoff_bad_format_hook
     40  PARAMS ((bfd *abfd, PTR filehdr));
     41static void mips_ecoff_swap_reloc_in
     42  PARAMS ((bfd *, PTR, struct internal_reloc *));
     43static void mips_ecoff_swap_reloc_out
     44  PARAMS ((bfd *, const struct internal_reloc *, PTR));
     45static void mips_adjust_reloc_in
     46  PARAMS ((bfd *, const struct internal_reloc *, arelent *));
     47static void mips_adjust_reloc_out
     48  PARAMS ((bfd *, const arelent *, struct internal_reloc *));
     49static bfd_reloc_status_type mips_generic_reloc
     50  PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
     51           asection *section, bfd *output_bfd, char **error));
     52static bfd_reloc_status_type mips_refhi_reloc
     53  PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
     54           asection *section, bfd *output_bfd, char **error));
     55static bfd_reloc_status_type mips_reflo_reloc
     56  PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
     57           asection *section, bfd *output_bfd, char **error));
     58static bfd_reloc_status_type mips_gprel_reloc
     59  PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
     60           asection *section, bfd *output_bfd, char **error));
     61static bfd_reloc_status_type mips_relhi_reloc
     62  PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
     63           asection *section, bfd *output_bfd, char **error));
     64static bfd_reloc_status_type mips_rello_reloc
     65  PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
     66           asection *section, bfd *output_bfd, char **error));
     67static bfd_reloc_status_type mips_switch_reloc
     68  PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, PTR data,
     69           asection *section, bfd *output_bfd, char **error));
     70static void mips_relocate_hi
     71  PARAMS ((struct internal_reloc *refhi, struct internal_reloc *reflo,
     72           bfd *input_bfd, asection *input_section, bfd_byte *contents,
     73           size_t adjust, bfd_vma relocation, bfd_boolean pcrel));
     74static bfd_boolean mips_relocate_section
     75  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, PTR));
     76static bfd_boolean mips_read_relocs
     77  PARAMS ((bfd *, asection *));
     78static bfd_boolean mips_relax_section
     79  PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
     80static bfd_boolean mips_relax_pcrel16
     81  PARAMS ((struct bfd_link_info *, bfd *, asection *,
     82           struct ecoff_link_hash_entry *, bfd_byte *, bfd_vma));
    11883static reloc_howto_type *mips_bfd_reloc_type_lookup
    11984  PARAMS ((bfd *, bfd_reloc_code_real_type));
     
    156121         0,                     /* size (0 = byte, 1 = short, 2 = long) */
    157122         8,                     /* bitsize */
    158          false,                 /* pc_relative */
     123         FALSE,                 /* pc_relative */
    159124         0,                     /* bitpos */
    160125         complain_overflow_dont, /* complain_on_overflow */
    161126         0,                     /* special_function */
    162127         "IGNORE",              /* name */
    163          false,                 /* partial_inplace */
     128         FALSE,                 /* partial_inplace */
    164129         0,                     /* src_mask */
    165130         0,                     /* dst_mask */
    166          false),                /* pcrel_offset */
     131         FALSE),                /* pcrel_offset */
    167132
    168133  /* A 16 bit reference to a symbol, normally from a data section.  */
     
    171136         1,                     /* size (0 = byte, 1 = short, 2 = long) */
    172137         16,                    /* bitsize */
    173          false,                 /* pc_relative */
     138         FALSE,                 /* pc_relative */
    174139         0,                     /* bitpos */
    175140         complain_overflow_bitfield, /* complain_on_overflow */
    176141         mips_generic_reloc,    /* special_function */
    177142         "REFHALF",             /* name */
    178          true,                  /* partial_inplace */
     143         TRUE,                  /* partial_inplace */
    179144         0xffff,                /* src_mask */
    180145         0xffff,                /* dst_mask */
    181          false),                /* pcrel_offset */
     146         FALSE),                /* pcrel_offset */
    182147
    183148  /* A 32 bit reference to a symbol, normally from a data section.  */
     
    186151         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    187152         32,                    /* bitsize */
    188          false,                 /* pc_relative */
     153         FALSE,                 /* pc_relative */
    189154         0,                     /* bitpos */
    190155         complain_overflow_bitfield, /* complain_on_overflow */
    191156         mips_generic_reloc,    /* special_function */
    192157         "REFWORD",             /* name */
    193          true,                  /* partial_inplace */
     158         TRUE,                  /* partial_inplace */
    194159         0xffffffff,            /* src_mask */
    195160         0xffffffff,            /* dst_mask */
    196          false),                /* pcrel_offset */
     161         FALSE),                /* pcrel_offset */
    197162
    198163  /* A 26 bit absolute jump address.  */
     
    201166         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    202167         26,                    /* bitsize */
    203          false,                 /* pc_relative */
     168         FALSE,                 /* pc_relative */
    204169         0,                     /* bitpos */
    205170         complain_overflow_dont, /* complain_on_overflow */
     
    209174         mips_generic_reloc,    /* special_function */
    210175         "JMPADDR",             /* name */
    211          true,                  /* partial_inplace */
     176         TRUE,                  /* partial_inplace */
    212177         0x3ffffff,             /* src_mask */
    213178         0x3ffffff,             /* dst_mask */
    214          false),                /* pcrel_offset */
     179         FALSE),                /* pcrel_offset */
    215180
    216181  /* The high 16 bits of a symbol value.  Handled by the function
     
    220185         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    221186         16,                    /* bitsize */
    222          false,                 /* pc_relative */
     187         FALSE,                 /* pc_relative */
    223188         0,                     /* bitpos */
    224189         complain_overflow_bitfield, /* complain_on_overflow */
    225190         mips_refhi_reloc,      /* special_function */
    226191         "REFHI",               /* name */
    227          true,                  /* partial_inplace */
     192         TRUE,                  /* partial_inplace */
    228193         0xffff,                /* src_mask */
    229194         0xffff,                /* dst_mask */
    230          false),                /* pcrel_offset */
     195         FALSE),                /* pcrel_offset */
    231196
    232197  /* The low 16 bits of a symbol value.  */
     
    235200         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    236201         16,                    /* bitsize */
    237          false,                 /* pc_relative */
     202         FALSE,                 /* pc_relative */
    238203         0,                     /* bitpos */
    239204         complain_overflow_dont, /* complain_on_overflow */
    240205         mips_reflo_reloc,      /* special_function */
    241206         "REFLO",               /* name */
    242          true,                  /* partial_inplace */
     207         TRUE,                  /* partial_inplace */
    243208         0xffff,                /* src_mask */
    244209         0xffff,                /* dst_mask */
    245          false),                /* pcrel_offset */
     210         FALSE),                /* pcrel_offset */
    246211
    247212  /* A reference to an offset from the gp register.  Handled by the
     
    251216         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    252217         16,                    /* bitsize */
    253          false,                 /* pc_relative */
     218         FALSE,                 /* pc_relative */
    254219         0,                     /* bitpos */
    255220         complain_overflow_signed, /* complain_on_overflow */
    256221         mips_gprel_reloc,      /* special_function */
    257222         "GPREL",               /* name */
    258          true,                  /* partial_inplace */
     223         TRUE,                  /* partial_inplace */
    259224         0xffff,                /* src_mask */
    260225         0xffff,                /* dst_mask */
    261          false),                /* pcrel_offset */
     226         FALSE),                /* pcrel_offset */
    262227
    263228  /* A reference to a literal using an offset from the gp register.
     
    267232         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    268233         16,                    /* bitsize */
    269          false,                 /* pc_relative */
     234         FALSE,                 /* pc_relative */
    270235         0,                     /* bitpos */
    271236         complain_overflow_signed, /* complain_on_overflow */
    272237         mips_gprel_reloc,      /* special_function */
    273238         "LITERAL",             /* name */
    274          true,                  /* partial_inplace */
     239         TRUE,                  /* partial_inplace */
    275240         0xffff,                /* src_mask */
    276241         0xffff,                /* dst_mask */
    277          false),                /* pcrel_offset */
     242         FALSE),                /* pcrel_offset */
    278243
    279244  EMPTY_HOWTO (8),
     
    290255         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    291256         16,                    /* bitsize */
    292          true,                  /* pc_relative */
     257         TRUE,                  /* pc_relative */
    293258         0,                     /* bitpos */
    294259         complain_overflow_signed, /* complain_on_overflow */
    295260         mips_generic_reloc,    /* special_function */
    296261         "PCREL16",             /* name */
    297          true,                  /* partial_inplace */
     262         TRUE,                  /* partial_inplace */
    298263         0xffff,                /* src_mask */
    299264         0xffff,                /* dst_mask */
    300          true),                 /* pcrel_offset */
     265         TRUE),                 /* pcrel_offset */
    301266
    302267  /* This reloc is a Cygnus extension used when generating position
     
    311276         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    312277         16,                    /* bitsize */
    313          true,                  /* pc_relative */
     278         TRUE,                  /* pc_relative */
    314279         0,                     /* bitpos */
    315280         complain_overflow_bitfield, /* complain_on_overflow */
    316281         mips_relhi_reloc,      /* special_function */
    317282         "RELHI",               /* name */
    318          true,                  /* partial_inplace */
     283         TRUE,                  /* partial_inplace */
    319284         0xffff,                /* src_mask */
    320285         0xffff,                /* dst_mask */
    321          true),                 /* pcrel_offset */
     286         TRUE),                 /* pcrel_offset */
    322287
    323288  /* This reloc is a Cygnus extension used when generating position
     
    328293         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    329294         16,                    /* bitsize */
    330          true,                  /* pc_relative */
     295         TRUE,                  /* pc_relative */
    331296         0,                     /* bitpos */
    332297         complain_overflow_dont, /* complain_on_overflow */
    333298         mips_rello_reloc,      /* special_function */
    334299         "RELLO",               /* name */
    335          true,                  /* partial_inplace */
     300         TRUE,                  /* partial_inplace */
    336301         0xffff,                /* src_mask */
    337302         0xffff,                /* dst_mask */
    338          true),                 /* pcrel_offset */
     303         TRUE),                 /* pcrel_offset */
    339304
    340305  EMPTY_HOWTO (15),
     
    356321         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    357322         32,                    /* bitsize */
    358          true,                  /* pc_relative */
     323         TRUE,                  /* pc_relative */
    359324         0,                     /* bitpos */
    360325         complain_overflow_dont, /* complain_on_overflow */
    361326         mips_switch_reloc,     /* special_function */
    362327         "SWITCH",              /* name */
    363          true,                  /* partial_inplace */
     328         TRUE,                  /* partial_inplace */
    364329         0xffffffff,            /* src_mask */
    365330         0xffffffff,            /* dst_mask */
    366          true)                  /* pcrel_offset */
     331         TRUE)                  /* pcrel_offset */
    367332};
    368333
     
    370335  (sizeof mips_howto_table / sizeof mips_howto_table[0])
    371336
    372 /* When the linker is doing relaxing, it may change a external PCREL16
     337/* When the linker is doing relaxing, it may change an external PCREL16
    373338   reloc.  This typically represents an instruction like
    374339       bal foo
     
    389354/* See whether the magic number matches.  */
    390355
    391 static boolean
     356static bfd_boolean
    392357mips_ecoff_bad_format_hook (abfd, filehdr)
    393358     bfd *abfd;
     
    400365    case MIPS_MAGIC_1:
    401366      /* I don't know what endianness this implies.  */
    402       return true;
     367      return TRUE;
    403368
    404369    case MIPS_MAGIC_BIG:
     
    413378
    414379    default:
    415       return false;
     380      return FALSE;
    416381    }
    417382}
     
    432397  const RELOC *ext = (RELOC *) ext_ptr;
    433398
    434   intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr);
     399  intern->r_vaddr = H_GET_32 (abfd, ext->r_vaddr);
    435400  if (bfd_header_big_endian (abfd))
    436401    {
     
    509474    }
    510475
    511   bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr);
     476  H_PUT_32 (abfd, intern->r_vaddr, ext->r_vaddr);
    512477  if (bfd_header_big_endian (abfd))
    513478    {
     
    697662
    698663  /* Save the information, and let REFLO do the actual relocation.  */
    699   n = (struct mips_hi *) bfd_malloc (sizeof *n);
     664  n = (struct mips_hi *) bfd_malloc ((bfd_size_type) sizeof *n);
    700665  if (n == NULL)
    701666    return bfd_reloc_outofrange;
     
    764729            val += 0x10000;
    765730
    766           insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
    767           bfd_put_32 (abfd, insn, l->addr);
     731          insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
     732          bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
    768733
    769734          next = l->next;
     
    799764     char **error_message;
    800765{
    801   boolean relocateable;
     766  bfd_boolean relocateable;
    802767  bfd_vma gp;
    803768  bfd_vma relocation;
     
    818783
    819784  if (output_bfd != (bfd *) NULL)
    820     relocateable = true;
     785    relocateable = TRUE;
    821786  else
    822787    {
    823       relocateable = false;
     788      relocateable = FALSE;
    824789      output_bfd = symbol->section->output_section->owner;
    825790    }
    826791
    827   if (bfd_is_und_section (symbol->section)
    828       && relocateable == false)
     792  if (bfd_is_und_section (symbol->section) && ! relocateable)
    829793    return bfd_reloc_undefined;
    830794
     
    836800  gp = _bfd_get_gp_value (output_bfd);
    837801  if (gp == 0
    838       && (relocateable == false
     802      && (! relocateable
    839803          || (symbol->flags & BSF_SECTION_SYM) != 0))
    840804    {
    841       if (relocateable != false)
     805      if (relocateable)
    842806        {
    843807          /* Make up a value.  */
     
    860824              for (i = 0; i < count; i++, sym++)
    861825                {
    862                   register CONST char *name;
     826                  register const char *name;
    863827
    864828                  name = bfd_asymbol_name (*sym);
     
    905869     are producing relocateable output, we don't want to do this for
    906870     an external symbol.  */
    907   if (relocateable == false
     871  if (! relocateable
    908872      || (symbol->flags & BSF_SECTION_SYM) != 0)
    909873    val += relocation - gp;
    910874
    911   insn = (insn &~ 0xffff) | (val & 0xffff);
    912   bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
    913 
    914   if (relocateable != false)
     875  insn = (insn &~ (unsigned) 0xffff) | (val & 0xffff);
     876  bfd_put_32 (abfd, (bfd_vma) insn, (bfd_byte *) data + reloc_entry->address);
     877
     878  if (relocateable)
    915879    reloc_entry->address += input_section->output_offset;
    916880
     
    988952
    989953  /* Save the information, and let RELLO do the actual relocation.  */
    990   n = (struct mips_hi *) bfd_malloc (sizeof *n);
     954  n = (struct mips_hi *) bfd_malloc ((bfd_size_type) sizeof *n);
    991955  if (n == NULL)
    992956    return bfd_reloc_outofrange;
     
    10651029            val += 0x10000;
    10661030
    1067           insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
    1068           bfd_put_32 (abfd, insn, l->addr);
     1031          insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
     1032          bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
    10691033
    10701034          next = l->next;
     
    11521116      mips_type = MIPS_R_REFLO;
    11531117      break;
    1154     case BFD_RELOC_MIPS_GPREL:
     1118    case BFD_RELOC_GPREL16:
    11551119      mips_type = MIPS_R_GPREL;
    11561120      break;
     
    11931157     size_t adjust;
    11941158     bfd_vma relocation;
    1195      boolean pcrel;
     1159     bfd_boolean pcrel;
    11961160{
    11971161  unsigned long insn;
     
    12301194    val += 0x10000;
    12311195
    1232   insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
     1196  insn = (insn &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff);
    12331197  bfd_put_32 (input_bfd, (bfd_vma) insn,
    12341198              contents + adjust + refhi->r_vaddr - input_section->vma);
     
    12371201/* Relocate a section while linking a MIPS ECOFF file.  */
    12381202
    1239 static boolean
     1203static bfd_boolean
    12401204mips_relocate_section (output_bfd, info, input_bfd, input_section,
    12411205                       contents, external_relocs)
     
    12501214  struct ecoff_link_hash_entry **sym_hashes;
    12511215  bfd_vma gp;
    1252   boolean gp_undefined;
     1216  bfd_boolean gp_undefined;
    12531217  size_t adjust;
    12541218  long *offsets;
     
    12561220  struct external_reloc *ext_rel_end;
    12571221  unsigned int i;
    1258   boolean got_lo;
     1222  bfd_boolean got_lo;
    12591223  struct internal_reloc lo_int_rel;
     1224  bfd_size_type amt;
    12601225
    12611226  BFD_ASSERT (input_bfd->xvec->byteorder
     
    12681233  if (symndx_to_section == (asection **) NULL)
    12691234    {
    1270       symndx_to_section = ((asection **)
    1271                            bfd_alloc (input_bfd,
    1272                                       (NUM_RELOC_SECTIONS
    1273                                        * sizeof (asection *))));
     1235      amt = NUM_RELOC_SECTIONS * sizeof (asection *);
     1236      symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
    12741237      if (!symndx_to_section)
    1275         return false;
     1238        return FALSE;
    12761239
    12771240      symndx_to_section[RELOC_SECTION_NONE] = NULL;
     
    13081271  gp = _bfd_get_gp_value (output_bfd);
    13091272  if (gp == 0)
    1310     gp_undefined = true;
     1273    gp_undefined = TRUE;
    13111274  else
    1312     gp_undefined = false;
    1313 
    1314   got_lo = false;
     1275    gp_undefined = FALSE;
     1276
     1277  got_lo = FALSE;
    13151278
    13161279  adjust = 0;
     
    13261289    {
    13271290      struct internal_reloc int_rel;
    1328       boolean use_lo = false;
     1291      bfd_boolean use_lo = FALSE;
    13291292      bfd_vma addend;
    13301293      reloc_howto_type *howto;
     
    13391302        {
    13401303          int_rel = lo_int_rel;
    1341           got_lo = false;
     1304          got_lo = FALSE;
    13421305        }
    13431306
     
    13741337              && int_rel.r_symndx == lo_int_rel.r_symndx)
    13751338            {
    1376               use_lo = true;
     1339              use_lo = TRUE;
    13771340              if (lo_ext_rel == ext_rel + 1)
    1378                 got_lo = true;
     1341                got_lo = TRUE;
    13791342            }
    13801343        }
     
    14381401            {
    14391402              if (! ((*info->callbacks->reloc_dangerous)
    1440                      (info, _("GP relative relocation when GP not defined"),
     1403                     (info, _("GP relative relocation used when GP not defined"),
    14411404                      input_bfd, input_section,
    14421405                      int_rel.r_vaddr - input_section->vma)))
    1443                 return false;
     1406                return FALSE;
    14441407              /* Only give the error once per link.  */
    14451408              gp = 4;
    14461409              _bfd_set_gp_value (output_bfd, gp);
    1447               gp_undefined = false;
     1410              gp_undefined = FALSE;
    14481411            }
    14491412          if (! int_rel.r_extern)
     
    15201483                                            - input_section->vma)
    15211484                                         + adjust)))
    1522                 return false;
     1485                return FALSE;
    15231486
    15241487              /* We must adjust everything else up a notch.  */
     
    17031666                              input_section,
    17041667                              int_rel.r_vaddr - input_section->vma)))
    1705                         return false;
     1668                        return FALSE;
    17061669                      int_rel.r_symndx = 0;
    17071670                    }
     
    17871750                         (info, h->root.root.string, input_bfd,
    17881751                          input_section,
    1789                           int_rel.r_vaddr - input_section->vma, true)))
    1790                     return false;
     1752                          int_rel.r_vaddr - input_section->vma, TRUE)))
     1753                    return FALSE;
    17911754                  relocation = 0;
    17921755                }
     
    18691832                        input_bfd, input_section,
    18701833                        int_rel.r_vaddr - input_section->vma)))
    1871                   return false;
     1834                  return FALSE;
    18721835              }
    18731836              break;
     
    18761839    }
    18771840
    1878   return true;
     1841  return TRUE;
    18791842}
    18801843
     
    18821845/* Read in the relocs for a section.  */
    18831846
    1884 static boolean
     1847static bfd_boolean
    18851848mips_read_relocs (abfd, sec)
    18861849     bfd *abfd;
     
    18881851{
    18891852  struct ecoff_section_tdata *section_tdata;
     1853  bfd_size_type amt;
    18901854
    18911855  section_tdata = ecoff_section_data (abfd, sec);
    18921856  if (section_tdata == (struct ecoff_section_tdata *) NULL)
    18931857    {
    1894       sec->used_by_bfd =
    1895         (PTR) bfd_alloc (abfd, sizeof (struct ecoff_section_tdata));
     1858      amt = sizeof (struct ecoff_section_tdata);
     1859      sec->used_by_bfd = (PTR) bfd_alloc (abfd, amt);
    18961860      if (sec->used_by_bfd == NULL)
    1897         return false;
     1861        return FALSE;
    18981862
    18991863      section_tdata = ecoff_section_data (abfd, sec);
     
    19051869  if (section_tdata->external_relocs == NULL)
    19061870    {
    1907       bfd_size_type external_relocs_size;
    1908 
    1909       external_relocs_size = (ecoff_backend (abfd)->external_reloc_size
    1910                               * sec->reloc_count);
    1911 
    1912       section_tdata->external_relocs =
    1913         (PTR) bfd_alloc (abfd, external_relocs_size);
    1914       if (section_tdata->external_relocs == NULL && external_relocs_size != 0)
    1915         return false;
     1871      amt = ecoff_backend (abfd)->external_reloc_size;
     1872      amt *= sec->reloc_count;
     1873      section_tdata->external_relocs = (PTR) bfd_alloc (abfd, amt);
     1874      if (section_tdata->external_relocs == NULL && amt != 0)
     1875        return FALSE;
    19161876
    19171877      if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
    1918           || (bfd_read (section_tdata->external_relocs, 1,
    1919                         external_relocs_size, abfd)
    1920               != external_relocs_size))
    1921         return false;
     1878          || bfd_bread (section_tdata->external_relocs, amt, abfd) != amt)
     1879        return FALSE;
    19221880    }
    19231881
    1924   return true;
     1882  return TRUE;
    19251883}
    19261884
     
    19491907   offsets.  */
    19501908
    1951 static boolean
     1909static bfd_boolean
    19521910mips_relax_section (abfd, sec, info, again)
    19531911     bfd *abfd;
    19541912     asection *sec;
    19551913     struct bfd_link_info *info;
    1956      boolean *again;
     1914     bfd_boolean *again;
    19571915{
    19581916  struct ecoff_section_tdata *section_tdata;
     
    19641922
    19651923  /* Assume we are not going to need another pass.  */
    1966   *again = false;
     1924  *again = FALSE;
    19671925
    19681926  /* If we are not generating an ECOFF file, this is much too
    19691927     confusing to deal with.  */
    19701928  if (info->hash->creator->flavour != bfd_get_flavour (abfd))
    1971     return true;
     1929    return TRUE;
    19721930
    19731931  /* If there are no relocs, there is nothing to do.  */
    19741932  if (sec->reloc_count == 0)
    1975     return true;
     1933    return TRUE;
    19761934
    19771935  /* We are only interested in PC relative relocs, and why would there
    19781936     ever be one from anything but the .text section?  */
    19791937  if (strcmp (bfd_get_section_name (abfd, sec), ".text") != 0)
    1980     return true;
     1938    return TRUE;
    19811939
    19821940  /* Read in the relocs, if we haven't already got them.  */
     
    20171975      struct ecoff_link_hash_entry **adj_h_ptr_end;
    20181976      struct ecoff_value_adjust *adjust;
     1977      bfd_size_type amt;
    20191978
    20201979      /* If we have already expanded this reloc, we certainly don't
     
    20932052            contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size);
    20942053          else
    2095             contents = (bfd_byte *) bfd_malloc ((size_t) sec->_raw_size);
     2054            contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
    20962055          if (contents == (bfd_byte *) NULL)
    20972056            goto error_return;
     
    21222081
    21232082      sec->_cooked_size += PCREL16_EXPANSION_ADJUSTMENT;
    2124       *again = true;
     2083      *again = TRUE;
    21252084
    21262085      if (offsets == (long *) NULL)
    21272086        {
    2128           size_t size;
    2129 
    2130           size = sec->reloc_count * sizeof (long);
    2131           offsets = (long *) bfd_alloc (abfd, size);
     2087          bfd_size_type size;
     2088
     2089          size = (bfd_size_type) sec->reloc_count * sizeof (long);
     2090          offsets = (long *) bfd_zalloc (abfd, size);
    21322091          if (offsets == (long *) NULL)
    21332092            goto error_return;
    2134           memset (offsets, 0, size);
    21352093          section_tdata->offsets = offsets;
    21362094        }
     
    23052263         by bfd_ecoff_debug_accumulate to adjust the values of
    23062264         internal symbols and FDR's.  */
    2307       adjust = ((struct ecoff_value_adjust *)
    2308                 bfd_alloc (abfd, sizeof (struct ecoff_value_adjust)));
     2265      amt = sizeof (struct ecoff_value_adjust);
     2266      adjust = (struct ecoff_value_adjust *) bfd_alloc (abfd, amt);
    23092267      if (adjust == (struct ecoff_value_adjust *) NULL)
    23102268        goto error_return;
     
    23212279    free (contents);
    23222280
    2323   return true;
     2281  return TRUE;
    23242282
    23252283 error_return:
    23262284  if (contents != (bfd_byte *) NULL && ! info->keep_memory)
    23272285    free (contents);
    2328   return false;
     2286  return FALSE;
    23292287}
    23302288
     
    23342292   the reloc.  */
    23352293
    2336 static boolean
     2294static bfd_boolean
    23372295mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address)
    23382296     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    23592317    relocation += 0x10000;
    23602318
    2361   bfd_put_32 (input_bfd, 0x04110001, location); /* bal .+8 */
     2319  bfd_put_32 (input_bfd, (bfd_vma) 0x04110001, location); /* bal .+8 */
    23622320  bfd_put_32 (input_bfd,
    23632321              0x3c010000 | ((relocation >> 16) & 0xffff), /* lui $at,XX */
     
    23662324              0x24210000 | (relocation & 0xffff), /* addiu $at,$at,XX */
    23672325              location + 8);
    2368   bfd_put_32 (input_bfd, 0x003f0821, location + 12); /* addu $at,$at,$ra */
    2369   bfd_put_32 (input_bfd, 0x0020f809, location + 16); /* jalr $at */
    2370 
    2371   return true;
     2326  bfd_put_32 (input_bfd,
     2327              (bfd_vma) 0x003f0821, location + 12); /* addu $at,$at,$ra */
     2328  bfd_put_32 (input_bfd,
     2329              (bfd_vma) 0x0020f809, location + 16); /* jalr $at */
     2330
     2331  return TRUE;
    23722332}
    23732333
     
    23812341   -membedded-pic.  */
    23822342
    2383 boolean
     2343bfd_boolean
    23842344bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
    23852345     bfd *abfd;
     
    23942354  struct external_reloc *ext_rel_end;
    23952355  bfd_byte *p;
     2356  bfd_size_type amt;
    23962357
    23972358  BFD_ASSERT (! info->relocateable);
     
    24002361
    24012362  if (datasec->reloc_count == 0)
    2402     return true;
     2363    return TRUE;
    24032364
    24042365  sym_hashes = ecoff_data (abfd)->sym_hashes;
    24052366
    24062367  if (! mips_read_relocs (abfd, datasec))
    2407     return false;
    2408 
    2409   relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 4);
     2368    return FALSE;
     2369
     2370  amt = (bfd_size_type) datasec->reloc_count * 4;
     2371  relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt);
    24102372  if (relsec->contents == NULL)
    2411     return false;
     2373    return FALSE;
    24122374
    24132375  p = relsec->contents;
     
    24192381    {
    24202382      struct internal_reloc int_rel;
    2421       boolean text_relative;
     2383      bfd_boolean text_relative;
    24222384
    24232385      mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel);
     
    24392401          *errmsg = _("unsupported reloc type");
    24402402          bfd_set_error (bfd_error_bad_value);
    2441           return false;
     2403          return FALSE;
    24422404        }
    24432405
     
    24552417               || h->root.type == bfd_link_hash_defweak)
    24562418              && (h->root.u.def.section->flags & SEC_CODE) != 0)
    2457             text_relative = true;
     2419            text_relative = TRUE;
    24582420          else
    2459             text_relative = false;
     2421            text_relative = FALSE;
    24602422        }
    24612423      else
     
    24642426            {
    24652427            case RELOC_SECTION_TEXT:
    2466               text_relative = true;
     2428              text_relative = TRUE;
    24672429              break;
    24682430            case RELOC_SECTION_SDATA:
    24692431            case RELOC_SECTION_SBSS:
    24702432            case RELOC_SECTION_LIT8:
    2471               text_relative = false;
     2433              text_relative = FALSE;
    24722434              break;
    24732435            default:
     
    24762438              *errmsg = _("reloc against unsupported section");
    24772439              bfd_set_error (bfd_error_bad_value);
    2478               return false;
     2440              return FALSE;
    24792441            }
    24802442        }
     
    24842446          *errmsg = _("reloc not properly aligned");
    24852447          bfd_set_error (bfd_error_bad_value);
    2486           return false;
     2448          return FALSE;
    24872449        }
    24882450
     
    24932455    }
    24942456
    2495   return true;
     2457  return TRUE;
    24962458}
    24972459
     
    25132475    mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
    25142476    mips_ecoff_swap_scnhdr_out,
    2515     FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, false, 2,
     2477    FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, FALSE, 4, FALSE, 2,
    25162478    mips_ecoff_swap_filehdr_in, mips_ecoff_swap_aouthdr_in,
    25172479    mips_ecoff_swap_scnhdr_in, NULL,
     
    25292491     executable file.  E.g., 0x1000.  */
    25302492  0x1000,
    2531   /* True if the .rdata section is part of the text segment, as on the
    2532      Alpha.  False if .rdata is part of the data segment, as on the
     2493  /* TRUE if the .rdata section is part of the text segment, as on the
     2494     Alpha.  FALSE if .rdata is part of the data segment, as on the
    25332495     MIPS.  */
    2534   false,
     2496  FALSE,
    25352497  /* Bitsize of constructor entries.  */
    25362498  32,
     
    26092571#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
    26102572
     2573/* Merging of sections is not done.  */
     2574#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
     2575
     2576#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
     2577
    26112578extern const bfd_target ecoff_big_vec;
    26122579
Note: See TracChangeset for help on using the changeset viewer.