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-ppc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Support for 32-bit PowerPC NLM (NetWare Loadable Module)
    2    Copyright 1994, 1995, 2000 Free Software Foundation, Inc.
     2   Copyright 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
    33
    44This file is part of BFD, the Binary File Descriptor library.
     
    3333
    3434#ifdef OLDFORMAT
    35 static boolean nlm_powerpc_backend_object_p
     35static bfd_boolean nlm_powerpc_backend_object_p
    3636  PARAMS ((bfd *));
    37 static boolean nlm_powerpc_write_prefix
     37static bfd_boolean nlm_powerpc_write_prefix
    3838  PARAMS ((bfd *));
    3939#endif
    4040
    41 static boolean nlm_powerpc_read_reloc
     41static bfd_boolean nlm_powerpc_read_reloc
    4242  PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
    43 static boolean nlm_powerpc_mangle_relocs
     43static bfd_boolean nlm_powerpc_mangle_relocs
    4444  PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type));
    45 static boolean nlm_powerpc_read_import
     45static bfd_boolean nlm_powerpc_read_import
    4646  PARAMS ((bfd *, nlmNAME(symbol_type) *));
    4747
    4848#ifdef OLDFORMAT
    49 static boolean nlm_powerpc_write_reloc
     49static bfd_boolean nlm_powerpc_write_reloc
    5050  PARAMS ((bfd *, asection *, arelent *, int));
    5151#endif
    5252
    53 static boolean nlm_powerpc_write_import
     53static bfd_boolean nlm_powerpc_write_import
    5454  PARAMS ((bfd *, asection *, arelent *));
    55 static boolean nlm_powerpc_write_external
     55static bfd_boolean nlm_powerpc_write_external
    5656  PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
    5757
    5858#ifndef OLDFORMAT
    59 static boolean nlm_powerpc_set_public_section
     59static bfd_boolean nlm_powerpc_set_public_section
    6060  PARAMS ((bfd *, nlmNAME(symbol_type) *));
    6161static bfd_vma nlm_powerpc_get_public_offset
     
    7272   the location before the regular NLM header.  */
    7373
    74 static boolean
     74static bfd_boolean
    7575nlm_powerpc_backend_object_p (abfd)
    7676     bfd *abfd;
     
    7878  struct nlm32_powerpc_external_prefix_header s;
    7979
    80   if (bfd_read ((PTR) &s, sizeof s, 1, abfd) != sizeof s)
    81     return false;
     80  if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s)
     81    return FALSE;
    8282
    8383  if (memcmp (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature) != 0
    84       || bfd_h_get_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION)
    85     return false;
    86 
    87   return true;
     84      || H_GET_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION)
     85    return FALSE;
     86
     87  return TRUE;
    8888}
    8989
    9090/* Write out the prefix.  */
    9191
    92 static boolean
     92static bfd_boolean
    9393nlm_powerpc_write_prefix (abfd)
    9494     bfd *abfd;
     
    9898  memset (&s, 0, sizeof s);
    9999  memcpy (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature);
    100   bfd_h_put_32 (abfd, (bfd_vma) NLM32_POWERPC_HEADER_VERSION, s.headerVersion);
    101   bfd_h_put_32 (abfd, (bfd_vma) 0, s.origins);
     100  H_PUT_32 (abfd, NLM32_POWERPC_HEADER_VERSION, s.headerVersion);
     101  H_PUT_32 (abfd, 0, s.origins);
    102102
    103103  /* FIXME: What should we do about the date?  */
    104104
    105   if (bfd_write ((PTR) &s, sizeof s, 1, abfd) != sizeof s)
    106     return false;
    107 
    108   return true;
     105  if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s)
     106    return FALSE;
     107
     108  return TRUE;
    109109}
    110110
     
    121121         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    122122         32,                    /* bitsize */
    123          false,                 /* pc_relative */
     123         FALSE,                 /* pc_relative */
    124124         0,                     /* bitpos */
    125125         complain_overflow_bitfield, /* complain_on_overflow */
    126126         0,                     /* special_function */
    127127         "32",                  /* name */
    128          true,                  /* partial_inplace */
     128         TRUE,                  /* partial_inplace */
    129129         0xffffffff,            /* src_mask */
    130130         0xffffffff,            /* dst_mask */
    131          false);                /* pcrel_offset */
     131         FALSE);                /* pcrel_offset */
    132132
    133133/* Read a PowerPC NLM reloc.  */
    134134
    135 static boolean
     135static bfd_boolean
    136136nlm_powerpc_read_reloc (abfd, sym, secp, rel)
    137137     bfd *abfd;
     
    144144  const char *name;
    145145
    146   if (bfd_read (temp, sizeof (temp), 1, abfd) != sizeof (temp))
    147     return false;
     146  if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
     147    return FALSE;
    148148
    149149  val = bfd_get_32 (abfd, temp);
     
    190190  rel->addend = 0;
    191191
    192   return true;
     192  return TRUE;
    193193}
    194194
     
    207207         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    208208         32,                    /* bitsize */
    209          false,                 /* pc_relative */
     209         FALSE,                 /* pc_relative */
    210210         0,                     /* bitpos */
    211211         complain_overflow_bitfield, /* complain_on_overflow */
    212212         0,                     /* special_function */
    213213         "R_POS",               /* name */
    214          true,                  /* partial_inplace */
     214         TRUE,                  /* partial_inplace */
    215215         0xffffffff,            /* src_mask */
    216216         0xffffffff,            /* dst_mask */
    217          false),                /* pcrel_offset */
     217         FALSE),                /* pcrel_offset */
    218218
    219219  /* 32 bit relocation, but store negative value.  */
     
    222222         -2,                    /* size (0 = byte, 1 = short, 2 = long) */
    223223         32,                    /* bitsize */
    224          false,                 /* pc_relative */
     224         FALSE,                 /* pc_relative */
    225225         0,                     /* bitpos */
    226226         complain_overflow_bitfield, /* complain_on_overflow */
    227227         0,                     /* special_function */
    228228         "R_NEG",               /* name */
    229          true,                  /* partial_inplace */
     229         TRUE,                  /* partial_inplace */
    230230         0xffffffff,            /* src_mask */
    231231         0xffffffff,            /* dst_mask */
    232          false),                /* pcrel_offset */
     232         FALSE),                /* pcrel_offset */
    233233
    234234  /* 32 bit PC relative relocation.  */
     
    237237         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    238238         32,                    /* bitsize */
    239          true,                  /* pc_relative */
     239         TRUE,                  /* pc_relative */
    240240         0,                     /* bitpos */
    241241         complain_overflow_signed, /* complain_on_overflow */
    242242         0,                     /* special_function */
    243243         "R_REL",               /* name */
    244          true,                  /* partial_inplace */
     244         TRUE,                  /* partial_inplace */
    245245         0xffffffff,            /* src_mask */
    246246         0xffffffff,            /* dst_mask */
    247          false),                /* pcrel_offset */
     247         FALSE),                /* pcrel_offset */
    248248
    249249  /* 16 bit TOC relative relocation.  */
     
    252252         1,                     /* size (0 = byte, 1 = short, 2 = long) */
    253253         16,                    /* bitsize */
    254          false,                 /* pc_relative */
     254         FALSE,                 /* pc_relative */
    255255         0,                     /* bitpos */
    256256         complain_overflow_signed, /* complain_on_overflow */
    257257         0,                     /* special_function */
    258258         "R_TOC",               /* name */
    259          true,                  /* partial_inplace */
    260          0xffff,                /* src_mask */
    261          0xffff,                /* dst_mask */
    262          false),                /* pcrel_offset */
     259         TRUE,                  /* partial_inplace */
     260         0xffff,                /* src_mask */
     261         0xffff,                /* dst_mask */
     262         FALSE),                /* pcrel_offset */
    263263
    264264  /* I don't really know what this is.  */
     
    267267         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    268268         32,                    /* bitsize */
    269          false,                 /* pc_relative */
     269         FALSE,                 /* pc_relative */
    270270         0,                     /* bitpos */
    271271         complain_overflow_bitfield, /* complain_on_overflow */
    272272         0,                     /* special_function */
    273273         "R_RTB",               /* name */
    274          true,                  /* partial_inplace */
     274         TRUE,                  /* partial_inplace */
    275275         0xffffffff,            /* src_mask */
    276276         0xffffffff,            /* dst_mask */
    277          false),                /* pcrel_offset */
     277         FALSE),                /* pcrel_offset */
    278278
    279279  /* External TOC relative symbol.  */
     
    282282         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    283283         16,                    /* bitsize */
    284          false,                 /* pc_relative */
     284         FALSE,                 /* pc_relative */
    285285         0,                     /* bitpos */
    286286         complain_overflow_bitfield, /* complain_on_overflow */
    287287         0,                     /* special_function */
    288288         "R_GL",                /* name */
    289          true,                  /* partial_inplace */
    290          0xffff,                /* src_mask */
    291          0xffff,                /* dst_mask */
    292          false),                /* pcrel_offset */
     289         TRUE,                  /* partial_inplace */
     290         0xffff,                /* src_mask */
     291         0xffff,                /* dst_mask */
     292         FALSE),                /* pcrel_offset */
    293293
    294294  /* Local TOC relative symbol.  */
     
    297297         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    298298         16,                    /* bitsize */
    299          false,                 /* pc_relative */
     299         FALSE,                 /* pc_relative */
    300300         0,                     /* bitpos */
    301301         complain_overflow_bitfield, /* complain_on_overflow */
    302302         0,                     /* special_function */
    303303         "R_TCL",               /* name */
    304          true,                  /* partial_inplace */
    305          0xffff,                /* src_mask */
    306          0xffff,                /* dst_mask */
    307          false),                /* pcrel_offset */
     304         TRUE,                  /* partial_inplace */
     305         0xffff,                /* src_mask */
     306         0xffff,                /* dst_mask */
     307         FALSE),                /* pcrel_offset */
    308308
    309309  { 7 },
     
    314314         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    315315         26,                    /* bitsize */
    316          false,                 /* pc_relative */
     316         FALSE,                 /* pc_relative */
    317317         0,                     /* bitpos */
    318318         complain_overflow_bitfield, /* complain_on_overflow */
    319319         0,                     /* special_function */
    320320         "R_BA",                /* name */
    321          true,                  /* partial_inplace */
     321         TRUE,                  /* partial_inplace */
    322322         0x3fffffc,             /* src_mask */
    323323         0x3fffffc,             /* dst_mask */
    324          false),                /* pcrel_offset */
     324         FALSE),                /* pcrel_offset */
    325325
    326326  { 9 },
     
    331331         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    332332         26,                    /* bitsize */
    333          true,                  /* pc_relative */
     333         TRUE,                  /* pc_relative */
    334334         0,                     /* bitpos */
    335335         complain_overflow_signed, /* complain_on_overflow */
    336336         0,                     /* special_function */
    337337         "R_BR",                /* name */
    338          true,                  /* partial_inplace */
     338         TRUE,                  /* partial_inplace */
    339339         0x3fffffc,             /* src_mask */
    340340         0x3fffffc,             /* dst_mask */
    341          false),                /* pcrel_offset */
     341         FALSE),                /* pcrel_offset */
    342342
    343343  { 0xb },
     
    348348         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    349349         16,                    /* bitsize */
    350          false,                 /* pc_relative */
     350         FALSE,                 /* pc_relative */
    351351         0,                     /* bitpos */
    352352         complain_overflow_bitfield, /* complain_on_overflow */
    353353         0,                     /* special_function */
    354354         "R_RL",                /* name */
    355          true,                  /* partial_inplace */
    356          0xffff,                /* src_mask */
    357          0xffff,                /* dst_mask */
    358          false),                /* pcrel_offset */
     355         TRUE,                  /* partial_inplace */
     356         0xffff,                /* src_mask */
     357         0xffff,                /* dst_mask */
     358         FALSE),                /* pcrel_offset */
    359359
    360360  /* Load address.  */
     
    363363         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    364364         16,                    /* bitsize */
    365          false,                 /* pc_relative */
     365         FALSE,                 /* pc_relative */
    366366         0,                     /* bitpos */
    367367         complain_overflow_bitfield, /* complain_on_overflow */
    368368         0,                     /* special_function */
    369369         "R_RLA",               /* name */
    370          true,                  /* partial_inplace */
    371          0xffff,                /* src_mask */
    372          0xffff,                /* dst_mask */
    373          false),                /* pcrel_offset */
     370         TRUE,                  /* partial_inplace */
     371         0xffff,                /* src_mask */
     372         0xffff,                /* dst_mask */
     373         FALSE),                /* pcrel_offset */
    374374
    375375  { 0xe },
     
    380380         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    381381         32,                    /* bitsize */
    382          false,                 /* pc_relative */
     382         FALSE,                 /* pc_relative */
    383383         0,                     /* bitpos */
    384384         complain_overflow_bitfield, /* complain_on_overflow */
    385385         0,                     /* special_function */
    386386         "R_REF",               /* name */
    387          false,                 /* partial_inplace */
     387         FALSE,                 /* partial_inplace */
    388388         0,                     /* src_mask */
    389389         0,                     /* dst_mask */
    390          false),                /* pcrel_offset */
     390         FALSE),                /* pcrel_offset */
    391391
    392392  { 0x10 },
     
    398398         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    399399         16,                    /* bitsize */
    400          false,                 /* pc_relative */
     400         FALSE,                 /* pc_relative */
    401401         0,                     /* bitpos */
    402402         complain_overflow_bitfield, /* complain_on_overflow */
    403403         0,                     /* special_function */
    404404         "R_TRL",               /* name */
    405          true,                  /* partial_inplace */
    406          0xffff,                /* src_mask */
    407          0xffff,                /* dst_mask */
    408          false),                /* pcrel_offset */
     405         TRUE,                  /* partial_inplace */
     406         0xffff,                /* src_mask */
     407         0xffff,                /* dst_mask */
     408         FALSE),                /* pcrel_offset */
    409409
    410410  /* TOC relative load address.  */
     
    413413         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    414414         16,                    /* bitsize */
    415          false,                 /* pc_relative */
     415         FALSE,                 /* pc_relative */
    416416         0,                     /* bitpos */
    417417         complain_overflow_bitfield, /* complain_on_overflow */
    418418         0,                     /* special_function */
    419419         "R_TRLA",              /* name */
    420          true,                  /* partial_inplace */
    421          0xffff,                /* src_mask */
    422          0xffff,                /* dst_mask */
    423          false),                /* pcrel_offset */
     420         TRUE,                  /* partial_inplace */
     421         0xffff,                /* src_mask */
     422         0xffff,                /* dst_mask */
     423         FALSE),                /* pcrel_offset */
    424424
    425425  /* Modifiable relative branch.  */
     
    428428         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    429429         32,                    /* bitsize */
    430          false,                 /* pc_relative */
     430         FALSE,                 /* pc_relative */
    431431         0,                     /* bitpos */
    432432         complain_overflow_bitfield, /* complain_on_overflow */
    433433         0,                     /* special_function */
    434434         "R_RRTBI",             /* name */
    435          true,                  /* partial_inplace */
     435         TRUE,                  /* partial_inplace */
    436436         0xffffffff,            /* src_mask */
    437437         0xffffffff,            /* dst_mask */
    438          false),                /* pcrel_offset */
     438         FALSE),                /* pcrel_offset */
    439439
    440440  /* Modifiable absolute branch.  */
     
    443443         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    444444         32,                    /* bitsize */
    445          false,                 /* pc_relative */
     445         FALSE,                 /* pc_relative */
    446446         0,                     /* bitpos */
    447447         complain_overflow_bitfield, /* complain_on_overflow */
    448448         0,                     /* special_function */
    449449         "R_RRTBA",             /* name */
    450          true,                  /* partial_inplace */
     450         TRUE,                  /* partial_inplace */
    451451         0xffffffff,            /* src_mask */
    452452         0xffffffff,            /* dst_mask */
    453          false),                /* pcrel_offset */
     453         FALSE),                /* pcrel_offset */
    454454
    455455  /* Modifiable call absolute indirect.  */
     
    458458         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    459459         16,                    /* bitsize */
    460          false,                 /* pc_relative */
     460         FALSE,                 /* pc_relative */
    461461         0,                     /* bitpos */
    462462         complain_overflow_bitfield, /* complain_on_overflow */
    463463         0,                     /* special_function */
    464464         "R_CAI",               /* name */
    465          true,                  /* partial_inplace */
    466          0xffff,                /* src_mask */
    467          0xffff,                /* dst_mask */
    468          false),                /* pcrel_offset */
     465         TRUE,                  /* partial_inplace */
     466         0xffff,                /* src_mask */
     467         0xffff,                /* dst_mask */
     468         FALSE),                /* pcrel_offset */
    469469
    470470  /* Modifiable call relative.  */
     
    473473         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    474474         16,                    /* bitsize */
    475          false,                 /* pc_relative */
     475         FALSE,                 /* pc_relative */
    476476         0,                     /* bitpos */
    477477         complain_overflow_bitfield, /* complain_on_overflow */
    478478         0,                     /* special_function */
    479479         "R_REL",               /* name */
    480          true,                  /* partial_inplace */
    481          0xffff,                /* src_mask */
    482          0xffff,                /* dst_mask */
    483          false),                /* pcrel_offset */
     480         TRUE,                  /* partial_inplace */
     481         0xffff,                /* src_mask */
     482         0xffff,                /* dst_mask */
     483         FALSE),                /* pcrel_offset */
    484484
    485485  /* Modifiable branch absolute.  */
     
    488488         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    489489         16,                    /* bitsize */
    490          false,                 /* pc_relative */
     490         FALSE,                 /* pc_relative */
    491491         0,                     /* bitpos */
    492492         complain_overflow_bitfield, /* complain_on_overflow */
    493493         0,                     /* special_function */
    494494         "R_RBA",               /* name */
    495          true,                  /* partial_inplace */
    496          0xffff,                /* src_mask */
    497          0xffff,                /* dst_mask */
    498          false),                /* pcrel_offset */
     495         TRUE,                  /* partial_inplace */
     496         0xffff,                /* src_mask */
     497         0xffff,                /* dst_mask */
     498         FALSE),                /* pcrel_offset */
    499499
    500500  /* Modifiable branch absolute.  */
     
    503503         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    504504         16,                    /* bitsize */
    505          false,                 /* pc_relative */
     505         FALSE,                 /* pc_relative */
    506506         0,                     /* bitpos */
    507507         complain_overflow_bitfield, /* complain_on_overflow */
    508508         0,                     /* special_function */
    509509         "R_RBAC",              /* name */
    510          true,                  /* partial_inplace */
    511          0xffff,                /* src_mask */
    512          0xffff,                /* dst_mask */
    513          false),                /* pcrel_offset */
     510         TRUE,                  /* partial_inplace */
     511         0xffff,                /* src_mask */
     512         0xffff,                /* dst_mask */
     513         FALSE),                /* pcrel_offset */
    514514
    515515  /* Modifiable branch relative.  */
     
    518518         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    519519         26,                    /* bitsize */
    520          false,                 /* pc_relative */
     520         FALSE,                 /* pc_relative */
    521521         0,                     /* bitpos */
    522522         complain_overflow_signed, /* complain_on_overflow */
    523523         0,                     /* special_function */
    524524         "R_REL",               /* name */
    525          true,                  /* partial_inplace */
    526          0xffff,                /* src_mask */
    527          0xffff,                /* dst_mask */
    528          false),                /* pcrel_offset */
     525         TRUE,                  /* partial_inplace */
     526         0xffff,                /* src_mask */
     527         0xffff,                /* dst_mask */
     528         FALSE),                /* pcrel_offset */
    529529
    530530  /* Modifiable branch absolute.  */
     
    533533         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    534534         16,                    /* bitsize */
    535          false,                 /* pc_relative */
     535         FALSE,                 /* pc_relative */
    536536         0,                     /* bitpos */
    537537         complain_overflow_bitfield, /* complain_on_overflow */
    538538         0,                     /* special_function */
    539539         "R_REL",               /* name */
    540          true,                  /* partial_inplace */
    541          0xffff,                /* src_mask */
    542          0xffff,                /* dst_mask */
    543          false)                 /* pcrel_offset */
     540         TRUE,                  /* partial_inplace */
     541         0xffff,                /* src_mask */
     542         0xffff,                /* dst_mask */
     543         FALSE)                 /* pcrel_offset */
    544544};
    545545
     
    549549/* Read a PowerPC NLM reloc.  */
    550550
    551 static boolean
     551static bfd_boolean
    552552nlm_powerpc_read_reloc (abfd, sym, secp, rel)
    553553     bfd *abfd;
     
    564564
    565565  /* Read the reloc from the file.  */
    566   if (bfd_read (&ext, sizeof ext, 1, abfd) != sizeof ext)
    567     return false;
     566  if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext)
     567    return FALSE;
    568568
    569569  /* Swap in the fields.  */
    570   l_vaddr = bfd_h_get_32 (abfd, ext.l_vaddr);
    571   l_symndx = bfd_h_get_32 (abfd, ext.l_symndx);
    572   l_rtype = bfd_h_get_16 (abfd, ext.l_rtype);
    573   l_rsecnm = bfd_h_get_16 (abfd, ext.l_rsecnm);
     570  l_vaddr = H_GET_32 (abfd, ext.l_vaddr);
     571  l_symndx = H_GET_32 (abfd, ext.l_symndx);
     572  l_rtype = H_GET_16 (abfd, ext.l_rtype);
     573  l_rsecnm = H_GET_16 (abfd, ext.l_rsecnm);
    574574
    575575  /* Get the sections now, for convenience.  */
     
    598598        {
    599599          bfd_set_error (bfd_error_bad_value);
    600           return false;
     600          return FALSE;
    601601        }
    602602
     
    628628    {
    629629      bfd_set_error (bfd_error_bad_value);
    630       return false;
     630      return FALSE;
    631631    }
    632632
    633633  rel->address = l_vaddr;
    634634
    635   return true;
     635  return TRUE;
    636636}
    637637
     
    640640/* Mangle PowerPC NLM relocs for output.  */
    641641
    642 static boolean
     642static bfd_boolean
    643643nlm_powerpc_mangle_relocs (abfd, sec, data, offset, count)
    644644     bfd *abfd ATTRIBUTE_UNUSED;
     
    648648     bfd_size_type count ATTRIBUTE_UNUSED;
    649649{
    650   return true;
     650  return TRUE;
    651651}
    652652
    653653/* Read a PowerPC NLM import record */
    654654
    655 static boolean
     655static bfd_boolean
    656656nlm_powerpc_read_import (abfd, sym)
    657657     bfd *abfd;
     
    664664  char *name;
    665665
    666   if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
     666  if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd)
    667667      != sizeof (symlength))
    668     return (false);
     668    return FALSE;
    669669  sym -> symbol.the_bfd = abfd;
    670   name = bfd_alloc (abfd, symlength + 1);
     670  name = bfd_alloc (abfd, (bfd_size_type) symlength + 1);
    671671  if (name == NULL)
    672     return false;
    673   if (bfd_read (name, symlength, 1, abfd) != symlength)
    674     return (false);
     672    return FALSE;
     673  if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
     674    return FALSE;
    675675  name[symlength] = '\0';
    676676  sym -> symbol.name = name;
     
    678678  sym -> symbol.value = 0;
    679679  sym -> symbol.section = bfd_und_section_ptr;
    680   if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
    681     return (false);
    682   rcount = bfd_h_get_32 (abfd, temp);
     680  if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd)
     681      != sizeof (temp))
     682    return FALSE;
     683  rcount = H_GET_32 (abfd, temp);
    683684  nlm_relocs = ((struct nlm_relent *)
    684685                bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
    685686  if (nlm_relocs == (struct nlm_relent *) NULL)
    686     return false;
     687    return FALSE;
    687688  sym -> relocs = nlm_relocs;
    688689  sym -> rcnt = 0;
     
    691692      asection *section;
    692693
    693       if (nlm_powerpc_read_reloc (abfd, sym, &section,
    694                                   &nlm_relocs -> reloc)
    695           == false)
    696         return false;
     694      if (! nlm_powerpc_read_reloc (abfd, sym, &section, &nlm_relocs -> reloc))
     695        return FALSE;
    697696      nlm_relocs -> section = section;
    698697      nlm_relocs++;
    699698      sym -> rcnt++;
    700699    }
    701   return true;
     700  return TRUE;
    702701}
    703702
     
    706705/* Write a PowerPC NLM reloc.  */
    707706
    708 static boolean
     707static bfd_boolean
    709708nlm_powerpc_write_import (abfd, sec, rel)
    710709     bfd *abfd;
     
    728727    {
    729728      bfd_set_error (bfd_error_invalid_operation);
    730       return false;
     729      return FALSE;
    731730    }
    732731
     
    741740    {
    742741      bfd_set_error (bfd_error_bad_value);
    743       return false;
     742      return FALSE;
    744743    }
    745744  val >>= 2;
     
    765764
    766765  bfd_put_32 (abfd, val, temp);
    767   if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
    768     return false;
    769 
    770   return true;
     766  if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
     767    return FALSE;
     768
     769  return TRUE;
    771770}
    772771
     
    777776/* Write a PowerPC NLM reloc.  */
    778777
    779 static boolean
     778static bfd_boolean
    780779nlm_powerpc_write_reloc (abfd, sec, rel, indx)
    781780     bfd *abfd;
     
    817816        {
    818817          bfd_set_error (bfd_error_bad_value);
    819           return false;
     818          return FALSE;
    820819        }
    821820    }
    822821
    823   bfd_h_put_32 (abfd, (bfd_vma) l_symndx, ext.l_symndx);
     822  H_PUT_32 (abfd, l_symndx, ext.l_symndx);
    824823
    825824  for (howto = nlm_powerpc_howto_table;
     
    845844    {
    846845      bfd_set_error (bfd_error_bad_value);
    847       return false;
     846      return FALSE;
    848847    }
    849848
     
    852851    l_rtype |= 0x8000;
    853852  l_rtype |= (howto->bitsize - 1) << 8;
    854   bfd_h_put_16 (abfd, (bfd_vma) l_rtype, ext.l_rtype);
     853  H_PUT_16 (abfd, l_rtype, ext.l_rtype);
    855854
    856855  address = rel->address;
     
    866865    {
    867866      bfd_set_error (bfd_error_bad_value);
    868       return false;
    869     }
    870 
    871   bfd_h_put_16 (abfd, (bfd_vma) l_rsecnm, ext.l_rsecnm);
    872   bfd_h_put_32 (abfd, (bfd_vma) address, ext.l_vaddr);
    873 
    874   if (bfd_write (&ext, sizeof ext, 1, abfd) != sizeof ext)
    875     return false;
    876 
    877   return true;
     867      return FALSE;
     868    }
     869
     870  H_PUT_16 (abfd, l_rsecnm, ext.l_rsecnm);
     871  H_PUT_32 (abfd, address, ext.l_vaddr);
     872
     873  if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext)
     874    return FALSE;
     875
     876  return TRUE;
    878877}
    879878
    880879/* Write a PowerPC NLM import.  */
    881880
    882 static boolean
     881static bfd_boolean
    883882nlm_powerpc_write_import (abfd, sec, rel)
    884883     bfd *abfd;
     
    895894   necessary, and the index never gets reset.  */
    896895
    897 static boolean
     896static bfd_boolean
    898897nlm_powerpc_write_external (abfd, count, sym, relocs)
    899898     bfd *abfd;
     
    910909
    911910  len = strlen (sym->name);
    912   if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
    913       || bfd_write (sym->name, len, 1, abfd) != len)
    914     return false;
     911  if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
     912       != sizeof (bfd_byte))
     913      || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
     914    return FALSE;
    915915
    916916  bfd_put_32 (abfd, count, temp);
    917   if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
    918     return false;
     917  if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
     918    return FALSE;
    919919
    920920  for (i = 0; i < count; i++)
     
    922922#ifndef OLDFORMAT
    923923      if (! nlm_powerpc_write_import (abfd, relocs[i].sec, relocs[i].rel))
    924         return false;
     924        return FALSE;
    925925#else
    926926      if (! nlm_powerpc_write_reloc (abfd, relocs[i].sec,
    927927                                     relocs[i].rel, indx))
    928         return false;
     928        return FALSE;
    929929#endif
    930930    }
     
    934934#endif
    935935
    936   return true;
     936  return TRUE;
    937937}
    938938
     
    945945/* Set the section for a public symbol.  */
    946946
    947 static boolean
     947static bfd_boolean
    948948nlm_powerpc_set_public_section (abfd, sym)
    949949     bfd *abfd;
     
    965965  sym->symbol.value <<= 2;
    966966
    967   return true;
     967  return TRUE;
    968968}
    969969
     
    10181018  bfd_arch_powerpc,
    10191019  0,
    1020   false,
     1020  FALSE,
    10211021#ifndef OLDFORMAT
    10221022  0,    /* backend_object_p */
Note: See TracChangeset for help on using the changeset viewer.