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/reloc16.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* 8 and 16 bit COFF relocation functions, for BFD.
    2    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000
    3    Free Software Foundation, Inc.
     2   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
     3   2002 Free Software Foundation, Inc.
    44   Written by Cygnus Support.
    55
     
    3030   where coff_link_input_bfd can find them (and coff_link_input_bfd
    3131   should be changed to use this location rather than rereading the
    32    file) (unless info->keep_memory is false, in which case they should
     32   file) (unless info->keep_memory is FALSE, in which case they should
    3333   free up the relocs after dealing with them).  */
    3434
     
    6565      h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info,
    6666                                        bfd_asymbol_name (symbol),
    67                                         false, false, true);
     67                                        FALSE, FALSE, TRUE);
    6868      if (h != (struct bfd_link_hash_entry *) NULL
    6969          && (h->type == bfd_link_hash_defined
     
    8080                (link_info, bfd_asymbol_name (symbol),
    8181                 input_section->owner, input_section, reloc->address,
    82                  true)))
     82                 TRUE)))
    8383            abort ();
    8484          value = 0;
     
    137137}
    138138
    139 boolean
    140 bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
     139bfd_boolean
     140bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
    141141     bfd *abfd;
    142      asection *i;
     142     asection *input_section;
    143143     struct bfd_link_info *link_info;
    144      boolean *again;
     144     bfd_boolean *again;
    145145{
    146146  /* Get enough memory to hold the stuff.  */
    147   bfd *input_bfd = i->owner;
    148   asection *input_section = i;
    149   int *shrinks;
    150   int shrink = 0;
     147  bfd *input_bfd = input_section->owner;
     148  unsigned *shrinks;
     149  unsigned shrink = 0;
    151150  long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
    152151  arelent **reloc_vector = NULL;
     
    155154  /* We only do global relaxation once.  It is not safe to do it multiple
    156155     times (see discussion of the "shrinks" array below).  */
    157   *again = false;
     156  *again = FALSE;
    158157
    159158  if (reloc_size < 0)
    160     return false;
    161 
    162   reloc_vector = (arelent **) bfd_malloc (reloc_size);
     159    return FALSE;
     160
     161  reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
    163162  if (!reloc_vector && reloc_size > 0)
    164     return false;
     163    return FALSE;
    165164
    166165  /* Get the relocs and think about them.  */
     
    171170    {
    172171      free (reloc_vector);
    173       return false;
     172      return FALSE;
    174173    }
    175174
     
    192191    {
    193192      int another_pass = 0;
     193      bfd_size_type amt;
    194194
    195195      /* Allocate and initialize the shrinks array for this section.
    196          The last element is used as an accumlator of shrinks.  */
    197       shrinks = (int *) bfd_malloc ((reloc_count + 1) * sizeof (int));
    198       memset (shrinks, 0, (reloc_count + 1) * sizeof (int));
     196         The last element is used as an accumlator of shrinks.  */
     197      amt = reloc_count + 1;
     198      amt *= sizeof (unsigned);
     199      shrinks = (unsigned *) bfd_zmalloc (amt);
    199200
    200201      /* Loop until nothing changes in this section.  */
    201       do {
    202         arelent **parent;
    203         unsigned int i;
    204         long j;
    205 
    206         another_pass = 0;
    207 
    208         for (i = 0, parent = reloc_vector; *parent; parent++, i++)
    209           {
    210             /* Let the target/machine dependent code examine each reloc
    211                in this section and attempt to shrink it.  */
    212             shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent,
    213                                                 shrinks[i], link_info);
    214 
    215             /* If it shrunk, note it in the shrinks array and set up for
    216                another pass.  */
    217             if (shrink != shrinks[i])
    218               {
    219                 another_pass = 1;
    220                 for (j = i + 1; j <= reloc_count; j++)
    221                   shrinks[j] += shrink - shrinks[i];
    222               }
    223           }
    224       }
     202      do
     203        {
     204          arelent **parent;
     205          unsigned int i;
     206          long j;
     207
     208          another_pass = 0;
     209
     210          for (i = 0, parent = reloc_vector; *parent; parent++, i++)
     211            {
     212              /* Let the target/machine dependent code examine each reloc
     213                 in this section and attempt to shrink it.  */
     214              shrink = bfd_coff_reloc16_estimate (abfd, input_section, *parent,
     215                                                  shrinks[i], link_info);
     216
     217              /* If it shrunk, note it in the shrinks array and set up for
     218                 another pass.  */
     219              if (shrink != shrinks[i])
     220                {
     221                  another_pass = 1;
     222                  for (j = i + 1; j <= reloc_count; j++)
     223                    shrinks[j] += shrink - shrinks[i];
     224                }
     225            }
     226        }
    225227      while (another_pass);
    226228
     
    231233  input_section->_cooked_size -= shrink;
    232234  free ((char *) reloc_vector);
    233   return true;
     235  return TRUE;
    234236}
    235237
    236238bfd_byte *
    237 bfd_coff_reloc16_get_relocated_section_contents(in_abfd,
    238                                                 link_info,
    239                                                 link_order,
    240                                                 data,
    241                                                 relocateable,
    242                                                 symbols)
     239bfd_coff_reloc16_get_relocated_section_contents (in_abfd,
     240                                                 link_info,
     241                                                 link_order,
     242                                                 data,
     243                                                 relocateable,
     244                                                 symbols)
    243245     bfd *in_abfd;
    244246     struct bfd_link_info *link_info;
    245247     struct bfd_link_order *link_order;
    246248     bfd_byte *data;
    247      boolean relocateable;
     249     bfd_boolean relocateable;
    248250     asymbol **symbols;
    249251{
     
    266268
    267269  /* Read in the section.  */
    268   if (!bfd_get_section_contents(input_bfd,
    269                                 input_section,
    270                                 data,
    271                                 0,
    272                                 input_section->_raw_size))
     270  if (!bfd_get_section_contents (input_bfd,
     271                                 input_section,
     272                                 data,
     273                                 (bfd_vma) 0,
     274                                 input_section->_raw_size))
    273275    return NULL;
    274276
    275   reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size);
     277  reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
    276278  if (!reloc_vector && reloc_size != 0)
    277279    return NULL;
Note: See TracChangeset for help on using the changeset viewer.