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/nlm32-i386.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Support for 32-bit i386 NLM (NetWare Loadable Module)
    2    Copyright 1993, 1994, 2000 Free Software Foundation, Inc.
     2   Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
    33
    44This file is part of BFD, the Binary File Descriptor library.
     
    2929#include "libnlm.h"
    3030
    31 static boolean nlm_i386_read_reloc
     31static bfd_boolean nlm_i386_read_reloc
    3232  PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
    33 static boolean nlm_i386_write_import
     33static bfd_boolean nlm_i386_write_import
    3434  PARAMS ((bfd *, asection *, arelent *));
    35 static boolean nlm_i386_mangle_relocs
     35static bfd_boolean nlm_i386_mangle_relocs
    3636  PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type));
    37 static boolean nlm_i386_read_import
     37static bfd_boolean nlm_i386_read_import
    3838  PARAMS ((bfd *, nlmNAME(symbol_type) *));
    39 static boolean nlm_i386_write_external
     39static bfd_boolean nlm_i386_write_external
    4040  PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
    4141
     
    4747         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    4848         32,                    /* bitsize */
    49          false,                 /* pc_relative */
     49         FALSE,                 /* pc_relative */
    5050         0,                     /* bitpos */
    5151         complain_overflow_bitfield, /* complain_on_overflow */
    5252         0,                     /* special_function */
    5353         "32",                  /* name */
    54          true,                  /* partial_inplace */
     54         TRUE,                  /* partial_inplace */
    5555         0xffffffff,            /* src_mask */
    5656         0xffffffff,            /* dst_mask */
    57          false);                /* pcrel_offset */
     57         FALSE);                /* pcrel_offset */
    5858
    5959/* Adjust the reloc location by a PC relative displacement.  */
     
    6464         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    6565         32,                    /* bitsize */
    66          true,                  /* pc_relative */
     66         TRUE,                  /* pc_relative */
    6767         0,                     /* bitpos */
    6868         complain_overflow_signed, /* complain_on_overflow */
    6969         0,                     /* special_function */
    7070         "DISP32",              /* name */
    71          true,                  /* partial_inplace */
     71         TRUE,                  /* partial_inplace */
    7272         0xffffffff,            /* src_mask */
    7373         0xffffffff,            /* dst_mask */
    74          true);                 /* pcrel_offset */
     74         TRUE);                 /* pcrel_offset */
    7575
    7676/* Read a NetWare i386 reloc.  */
    7777
    78 static boolean
     78static bfd_boolean
    7979nlm_i386_read_reloc (abfd, sym, secp, rel)
    8080     bfd *abfd;
     
    8787  const char *name;
    8888
    89   if (bfd_read (temp, sizeof (temp), 1, abfd) != sizeof (temp))
    90     return false;
     89  if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
     90    return FALSE;
    9191
    9292  val = bfd_get_32 (abfd, temp);
     
    146146  rel->addend = 0;
    147147
    148   return true;
     148  return TRUE;
    149149}
    150150
    151151/* Write a NetWare i386 reloc.  */
    152152
    153 static boolean
     153static bfd_boolean
    154154nlm_i386_write_import (abfd, sec, rel)
    155155     bfd *abfd;
     
    175175    {
    176176      bfd_set_error (bfd_error_invalid_operation);
    177       return false;
     177      return FALSE;
    178178    }
    179179
     
    203203        {
    204204          bfd_set_error (bfd_error_invalid_operation);
    205           return false;
     205          return FALSE;
    206206        }
    207207
     
    223223            {
    224224              bfd_set_error (bfd_error_invalid_operation);
    225               return false;
     225              return FALSE;
    226226            }
    227227        }
     
    229229
    230230  bfd_put_32 (abfd, val, temp);
    231   if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
    232     return false;
    233 
    234   return true;
     231  if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
     232    return FALSE;
     233
     234  return TRUE;
    235235}
    236236
    237 /* I want to be able to use objcopy to turn a i386 a.out or COFF file
     237/* I want to be able to use objcopy to turn an i386 a.out or COFF file
    238238   into a NetWare i386 module.  That means that the relocs from the
    239239   source file have to be mapped into relocs that apply to the target
     
    244244   general implementation.  */
    245245
    246 static boolean
     246static bfd_boolean
    247247nlm_i386_mangle_relocs (abfd, sec, data, offset, count)
    248248     bfd *abfd;
     
    336336    }
    337337
    338   return true;
     338  return TRUE;
    339339}
    340340
    341341/* Read a NetWare i386 import record */
    342 static boolean
     342static bfd_boolean
    343343nlm_i386_read_import (abfd, sym)
    344344     bfd *abfd;
     
    351351  char *name;
    352352
    353   if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
     353  if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd)
    354354      != sizeof (symlength))
    355     return false;
     355    return FALSE;
    356356  sym -> symbol.the_bfd = abfd;
    357   name = bfd_alloc (abfd, symlength + 1);
     357  name = bfd_alloc (abfd, (bfd_size_type) symlength + 1);
    358358  if (name == NULL)
    359     return false;
    360   if (bfd_read (name, symlength, 1, abfd) != symlength)
    361     return false;
     359    return FALSE;
     360  if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
     361    return FALSE;
    362362  name[symlength] = '\0';
    363363  sym -> symbol.name = name;
     
    365365  sym -> symbol.value = 0;
    366366  sym -> symbol.section = bfd_und_section_ptr;
    367   if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
    368     return false;
    369   rcount = bfd_h_get_32 (abfd, temp);
     367  if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd)
     368      != sizeof (temp))
     369    return FALSE;
     370  rcount = H_GET_32 (abfd, temp);
    370371  nlm_relocs = ((struct nlm_relent *)
    371372                bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
    372373  if (!nlm_relocs)
    373     return false;
     374    return FALSE;
    374375  sym -> relocs = nlm_relocs;
    375376  sym -> rcnt = 0;
     
    378379      asection *section;
    379380
    380       if (nlm_i386_read_reloc (abfd, sym, &section,
    381                                &nlm_relocs -> reloc)
    382           == false)
    383         return false;
     381      if (! nlm_i386_read_reloc (abfd, sym, &section, &nlm_relocs -> reloc))
     382        return FALSE;
    384383      nlm_relocs -> section = section;
    385384      nlm_relocs++;
    386385      sym -> rcnt++;
    387386    }
    388   return true;
     387  return TRUE;
    389388}
    390389
    391390/* Write out an external reference.  */
    392391
    393 static boolean
     392static bfd_boolean
    394393nlm_i386_write_external (abfd, count, sym, relocs)
    395394     bfd *abfd;
     
    403402
    404403  len = strlen (sym->name);
    405   if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
    406       || bfd_write (sym->name, len, 1, abfd) != len)
    407     return false;
     404  if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
     405       != sizeof (bfd_byte))
     406      || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
     407    return FALSE;
    408408
    409409  bfd_put_32 (abfd, count, temp);
    410   if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
    411     return false;
     410  if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
     411    return FALSE;
    412412
    413413  for (i = 0; i < count; i++)
    414414    {
    415       if (nlm_i386_write_import (abfd, relocs[i].sec,
    416                                  relocs[i].rel) == false)
    417         return false;
    418     }
    419 
    420   return true;
     415      if (! nlm_i386_write_import (abfd, relocs[i].sec, relocs[i].rel))
     416        return FALSE;
     417    }
     418
     419  return TRUE;
    421420}
    422421
     
    430429  bfd_arch_i386,
    431430  0,
    432   false,
     431  FALSE,
    433432  0,    /* backend_object_p */
    434433  0,    /* write_prefix_func */
Note: See TracChangeset for help on using the changeset viewer.