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

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Support for 32-bit SPARC NLM (NetWare Loadable Module)
    2    Copyright 1993, 1994, 2000 Free Software Foundation, Inc.
    3 
    4 This file is part of BFD, the Binary File Descriptor library.
    5 
    6 This program is free software; you can redistribute it and/or modify
    7 it under the terms of the GNU General Public License as published by
    8 the Free Software Foundation; either version 2 of the License, or
    9 (at your option) any later version.
    10 
    11 This program is distributed in the hope that it will be useful,
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14 GNU General Public License for more details.
    15 
    16 You should have received a copy of the GNU General Public License
    17 along with this program; if not, write to the Free Software
    18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     2   Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
     3
     4   This file is part of BFD, the Binary File Descriptor library.
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2 of the License, or
     9   (at your option) any later version.
     10
     11   This program is distributed in the hope that it will be useful,
     12   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14   GNU General Public License for more details.
     15
     16   You should have received a copy of the GNU General Public License
     17   along with this program; if not, write to the Free Software
     18   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    1919
    2020#include "bfd.h"
     
    2929#include "libnlm.h"
    3030
    31 static boolean nlm_sparc_read_reloc
     31static bfd_boolean nlm_sparc_read_reloc
    3232  PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *));
    33 static boolean nlm_sparc_write_reloc
     33static bfd_boolean nlm_sparc_write_reloc
    3434  PARAMS ((bfd *, asection *, arelent *));
    35 static boolean nlm_sparc_mangle_relocs
     35static bfd_boolean nlm_sparc_mangle_relocs
    3636  PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type));
    37 static boolean nlm_sparc_read_import
     37static bfd_boolean nlm_sparc_read_import
    3838  PARAMS ((bfd *, nlmNAME(symbol_type) *));
    39 static boolean nlm_sparc_write_import
     39static bfd_boolean nlm_sparc_write_import
    4040  PARAMS ((bfd *, asection *, arelent *));
    41 static boolean nlm_sparc_write_external
     41static bfd_boolean nlm_sparc_write_external
    4242  PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *));
     43static bfd_boolean nlm_sparc_write_export
     44  PARAMS ((bfd *, asymbol *, bfd_vma));
    4345
    4446enum reloc_type
     
    6163
    6264#if 0
    63 static CONST char *CONST reloc_type_names[] =
    64 {
    65   "R_SPARC_NONE",
    66   "R_SPARC_8",          "R_SPARC_16",           "R_SPARC_32",
    67   "R_SPARC_DISP8",      "R_SPARC_DISP16",       "R_SPARC_DISP32",
    68   "R_SPARC_WDISP30",    "R_SPARC_WDISP22",
    69   "R_SPARC_HI22",       "R_SPARC_22",
    70   "R_SPARC_13",         "R_SPARC_LO10",
    71   "R_SPARC_GOT10",      "R_SPARC_GOT13",        "R_SPARC_GOT22",
    72   "R_SPARC_PC10",       "R_SPARC_PC22",
    73   "R_SPARC_WPLT30",
    74   "R_SPARC_COPY",
    75   "R_SPARC_GLOB_DAT",   "R_SPARC_JMP_SLOT",
    76   "R_SPARC_RELATIVE",
    77   "R_SPARC_UA32",
     65static const char *const reloc_type_names[] =
     66  {
     67    "R_SPARC_NONE",
     68    "R_SPARC_8",                "R_SPARC_16",           "R_SPARC_32",
     69    "R_SPARC_DISP8",    "R_SPARC_DISP16",       "R_SPARC_DISP32",
     70    "R_SPARC_WDISP30",  "R_SPARC_WDISP22",
     71    "R_SPARC_HI22",     "R_SPARC_22",
     72    "R_SPARC_13",               "R_SPARC_LO10",
     73    "R_SPARC_GOT10",    "R_SPARC_GOT13",        "R_SPARC_GOT22",
     74    "R_SPARC_PC10",     "R_SPARC_PC22",
     75    "R_SPARC_WPLT30",
     76    "R_SPARC_COPY",
     77    "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT",
     78    "R_SPARC_RELATIVE",
     79    "R_SPARC_UA32",
     80  };
     81#endif
     82
     83static reloc_howto_type nlm32_sparc_howto_table[] =
     84  {
     85    HOWTO (R_SPARC_NONE,    0,0, 0,FALSE,0,complain_overflow_dont,    0,"R_SPARC_NONE",    FALSE,0,0x00000000,TRUE),
     86    HOWTO (R_SPARC_8,       0,0, 8,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_8",       FALSE,0,0x000000ff,TRUE),
     87    HOWTO (R_SPARC_16,      0,1,16,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_16",      FALSE,0,0x0000ffff,TRUE),
     88    HOWTO (R_SPARC_32,      0,2,32,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_32",      FALSE,0,0xffffffff,TRUE),
     89    HOWTO (R_SPARC_DISP8,   0,0, 8,TRUE, 0,complain_overflow_signed,  0,"R_SPARC_DISP8",   FALSE,0,0x000000ff,TRUE),
     90    HOWTO (R_SPARC_DISP16,  0,1,16,TRUE, 0,complain_overflow_signed,  0,"R_SPARC_DISP16",  FALSE,0,0x0000ffff,TRUE),
     91    HOWTO (R_SPARC_DISP32,  0,2,32,TRUE, 0,complain_overflow_signed,  0,"R_SPARC_DISP32",  FALSE,0,0x00ffffff,TRUE),
     92    HOWTO (R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed,  0,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE),
     93    HOWTO (R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed,  0,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE),
     94    HOWTO (R_SPARC_HI22,   10,2,22,FALSE,0,complain_overflow_dont,    0,"R_SPARC_HI22",    FALSE,0,0x003fffff,TRUE),
     95    HOWTO (R_SPARC_22,      0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_22",      FALSE,0,0x003fffff,TRUE),
     96    HOWTO (R_SPARC_13,      0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_13",      FALSE,0,0x00001fff,TRUE),
     97    HOWTO (R_SPARC_LO10,    0,2,10,FALSE,0,complain_overflow_dont,    0,"R_SPARC_LO10",    FALSE,0,0x000003ff,TRUE),
     98    HOWTO (R_SPARC_GOT10,   0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT10",   FALSE,0,0x000003ff,TRUE),
     99    HOWTO (R_SPARC_GOT13,   0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT13",   FALSE,0,0x00001fff,TRUE),
     100    HOWTO (R_SPARC_GOT22,  10,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT22",   FALSE,0,0x003fffff,TRUE),
     101    HOWTO (R_SPARC_PC10,    0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC10",    FALSE,0,0x000003ff,TRUE),
     102    HOWTO (R_SPARC_PC22,    0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC22",    FALSE,0,0x003fffff,TRUE),
     103    HOWTO (R_SPARC_WPLT30,  0,0,00,FALSE,0,complain_overflow_dont,    0,"R_SPARC_WPLT30",  FALSE,0,0x00000000,TRUE),
     104    HOWTO (R_SPARC_COPY,    0,0,00,FALSE,0,complain_overflow_dont,    0,"R_SPARC_COPY",    FALSE,0,0x00000000,TRUE),
     105    HOWTO (R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont,    0,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE),
     106    HOWTO (R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont,    0,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE),
     107    HOWTO (R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont,    0,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE),
     108    HOWTO (R_SPARC_UA32,    0,0,00,FALSE,0,complain_overflow_dont,    0,"R_SPARC_UA32",    FALSE,0,0x00000000,TRUE),
    78109};
    79 #endif
    80 
    81 static reloc_howto_type nlm32_sparc_howto_table[] =
    82 {
    83   HOWTO(R_SPARC_NONE,    0,0, 0,false,0,complain_overflow_dont,    0,"R_SPARC_NONE",    false,0,0x00000000,true),
    84   HOWTO(R_SPARC_8,       0,0, 8,false,0,complain_overflow_bitfield,0,"R_SPARC_8",       false,0,0x000000ff,true),
    85   HOWTO(R_SPARC_16,      0,1,16,false,0,complain_overflow_bitfield,0,"R_SPARC_16",      false,0,0x0000ffff,true),
    86   HOWTO(R_SPARC_32,      0,2,32,false,0,complain_overflow_bitfield,0,"R_SPARC_32",      false,0,0xffffffff,true),
    87   HOWTO(R_SPARC_DISP8,   0,0, 8,true, 0,complain_overflow_signed,  0,"R_SPARC_DISP8",   false,0,0x000000ff,true),
    88   HOWTO(R_SPARC_DISP16,  0,1,16,true, 0,complain_overflow_signed,  0,"R_SPARC_DISP16",  false,0,0x0000ffff,true),
    89   HOWTO(R_SPARC_DISP32,  0,2,32,true, 0,complain_overflow_signed,  0,"R_SPARC_DISP32",  false,0,0x00ffffff,true),
    90   HOWTO(R_SPARC_WDISP30, 2,2,30,true, 0,complain_overflow_signed,  0,"R_SPARC_WDISP30", false,0,0x3fffffff,true),
    91   HOWTO(R_SPARC_WDISP22, 2,2,22,true, 0,complain_overflow_signed,  0,"R_SPARC_WDISP22", false,0,0x003fffff,true),
    92   HOWTO(R_SPARC_HI22,   10,2,22,false,0,complain_overflow_dont,    0,"R_SPARC_HI22",    false,0,0x003fffff,true),
    93   HOWTO(R_SPARC_22,      0,2,22,false,0,complain_overflow_bitfield,0,"R_SPARC_22",      false,0,0x003fffff,true),
    94   HOWTO(R_SPARC_13,      0,2,13,false,0,complain_overflow_bitfield,0,"R_SPARC_13",      false,0,0x00001fff,true),
    95   HOWTO(R_SPARC_LO10,    0,2,10,false,0,complain_overflow_dont,    0,"R_SPARC_LO10",    false,0,0x000003ff,true),
    96   HOWTO(R_SPARC_GOT10,   0,2,10,false,0,complain_overflow_bitfield,0,"R_SPARC_GOT10",   false,0,0x000003ff,true),
    97   HOWTO(R_SPARC_GOT13,   0,2,13,false,0,complain_overflow_bitfield,0,"R_SPARC_GOT13",   false,0,0x00001fff,true),
    98   HOWTO(R_SPARC_GOT22,  10,2,22,false,0,complain_overflow_bitfield,0,"R_SPARC_GOT22",   false,0,0x003fffff,true),
    99   HOWTO(R_SPARC_PC10,    0,2,10,false,0,complain_overflow_bitfield,0,"R_SPARC_PC10",    false,0,0x000003ff,true),
    100   HOWTO(R_SPARC_PC22,    0,2,22,false,0,complain_overflow_bitfield,0,"R_SPARC_PC22",    false,0,0x003fffff,true),
    101   HOWTO(R_SPARC_WPLT30,  0,0,00,false,0,complain_overflow_dont,    0,"R_SPARC_WPLT30",  false,0,0x00000000,true),
    102   HOWTO(R_SPARC_COPY,    0,0,00,false,0,complain_overflow_dont,    0,"R_SPARC_COPY",    false,0,0x00000000,true),
    103   HOWTO(R_SPARC_GLOB_DAT,0,0,00,false,0,complain_overflow_dont,    0,"R_SPARC_GLOB_DAT",false,0,0x00000000,true),
    104   HOWTO(R_SPARC_JMP_SLOT,0,0,00,false,0,complain_overflow_dont,    0,"R_SPARC_JMP_SLOT",false,0,0x00000000,true),
    105   HOWTO(R_SPARC_RELATIVE,0,0,00,false,0,complain_overflow_dont,    0,"R_SPARC_RELATIVE",false,0,0x00000000,true),
    106   HOWTO(R_SPARC_UA32,    0,0,00,false,0,complain_overflow_dont,    0,"R_SPARC_UA32",    false,0,0x00000000,true),
    107 };
    108110
    109111/* Read a NetWare sparc reloc.  */
    110112
    111 struct nlm32_sparc_reloc_ext {
    112   unsigned char offset[4];
    113   unsigned char addend[4];
    114   unsigned char type[1];
    115   unsigned char pad1[3];
    116 };
    117 
    118 static boolean
     113struct nlm32_sparc_reloc_ext
     114  {
     115    unsigned char offset[4];
     116    unsigned char addend[4];
     117    unsigned char type[1];
     118    unsigned char pad1[3];
     119  };
     120
     121static bfd_boolean
    119122nlm_sparc_read_reloc (abfd, sym, secp, rel)
    120123     bfd *abfd;
     
    129132  asection *code_sec, *data_sec;
    130133
    131   if (bfd_read (&tmp_reloc, 12, 1, abfd) != 12)
    132     return false;
     134  if (bfd_bread (&tmp_reloc, (bfd_size_type) 12, abfd) != 12)
     135    return FALSE;
    133136
    134137  code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME);
     
    148151       index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
    149152       index++)
    150     if (nlm32_sparc_howto_table[index].type == type) {
    151       rel->howto = &nlm32_sparc_howto_table[index];
    152       break;
    153     }
     153    if (nlm32_sparc_howto_table[index].type == type)
     154      {
     155        rel->howto = &nlm32_sparc_howto_table[index];
     156        break;
     157      }
    154158
    155159#ifdef DEBUG
     
    157161           __FUNCTION__, rel->address, rel->addend, type, rel->howto);
    158162#endif
    159   return true;
     163  return TRUE;
    160164
    161165}
     
    163167/* Write a NetWare sparc reloc.  */
    164168
    165 static boolean
     169static bfd_boolean
    166170nlm_sparc_write_reloc (abfd, sec, rel)
    167171     bfd *abfd;
     
    177181  for (index = 0;
    178182       index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
    179        index++) {
    180     tmp = &nlm32_sparc_howto_table[index];
    181 
    182     if (tmp->rightshift == rel->howto->rightshift
    183         && tmp->size == rel->howto->size
    184         && tmp->bitsize == rel->howto->bitsize
    185         && tmp->pc_relative == rel->howto->pc_relative
    186         && tmp->bitpos == rel->howto->bitpos
    187         && tmp->src_mask == rel->howto->src_mask
    188         && tmp->dst_mask == rel->howto->dst_mask) {
    189       type = tmp->type;
    190       break;
     183       index++)
     184    {
     185      tmp = &nlm32_sparc_howto_table[index];
     186
     187      if (tmp->rightshift == rel->howto->rightshift
     188          && tmp->size == rel->howto->size
     189          && tmp->bitsize == rel->howto->bitsize
     190          && tmp->pc_relative == rel->howto->pc_relative
     191          && tmp->bitpos == rel->howto->bitpos
     192          && tmp->src_mask == rel->howto->src_mask
     193          && tmp->dst_mask == rel->howto->dst_mask)
     194        {
     195          type = tmp->type;
     196          break;
     197        }
    191198    }
    192   }
    193199  if (type == -1)
    194200    abort ();
    195201
    196   /*
    197    * Netware wants a list of relocs for each address.
    198    * Format is:
    199    *    long    offset
    200    *    long    addend
    201    *    char    type
    202    * That should be it.
    203    */
     202  /* Netware wants a list of relocs for each address.
     203     Format is:
     204        long    offset
     205        long    addend
     206        char    type
     207     That should be it.  */
    204208
    205209  /* The value we write out is the offset into the appropriate
     
    221225  bfd_put_8 (abfd, (short) (rel->howto->type), tmp_reloc.type);
    222226
    223   if (bfd_write (&tmp_reloc, 12, 1, abfd) != 12)
    224     return false;
    225 
    226   return true;
     227  if (bfd_bwrite (&tmp_reloc, (bfd_size_type) 12, abfd) != 12)
     228    return FALSE;
     229
     230  return TRUE;
    227231}
    228232
     
    230234   SPARC relocs.  */
    231235
    232 static boolean
     236static bfd_boolean
    233237nlm_sparc_mangle_relocs (abfd, sec, data, offset, count)
    234238     bfd *abfd ATTRIBUTE_UNUSED;
     
    238242     bfd_size_type count ATTRIBUTE_UNUSED;
    239243{
    240   return true;
    241 }
    242 
    243 /* Read a NetWare sparc import record */
    244 static boolean
     244  return TRUE;
     245}
     246
     247/* Read a NetWare sparc import record.  */
     248
     249static bfd_boolean
    245250nlm_sparc_read_import (abfd, sym)
    246251     bfd *abfd;
    247252     nlmNAME(symbol_type) *sym;
    248253{
    249   struct nlm_relent *nlm_relocs;        /* relocation records for symbol */
    250   bfd_size_type rcount;                 /* number of relocs */
    251   bfd_byte temp[NLM_TARGET_LONG_SIZE];  /* temporary 32-bit value */
    252   unsigned char symlength;              /* length of symbol name */
     254  struct nlm_relent *nlm_relocs;        /* Relocation records for symbol. */
     255  bfd_size_type rcount;                 /* Number of relocs. */
     256  bfd_byte temp[NLM_TARGET_LONG_SIZE];  /* Temporary 32-bit value. */
     257  unsigned char symlength;              /* Length of symbol name. */
    253258  char *name;
    254259
    255   /*
    256    * First, read in the number of relocation
    257    * entries for this symbol
    258    */
    259   if (bfd_read ((PTR) temp, 4, 1, abfd) != 4)
    260     return false;
     260  /* First, read in the number of relocation
     261     entries for this symbol.  */
     262  if (bfd_bread ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
     263    return FALSE;
    261264
    262265  rcount = bfd_get_32 (abfd, temp);
    263266
    264   /*
    265    * Next, read in the length of the symbol
    266    */
    267 
    268   if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
     267  /* Next, read in the length of the symbol.  */
     268
     269  if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd)
    269270      != sizeof (symlength))
    270     return false;
     271    return FALSE;
    271272  sym -> symbol.the_bfd = abfd;
    272   name = bfd_alloc (abfd, symlength + 1);
     273  name = bfd_alloc (abfd, (bfd_size_type) symlength + 1);
    273274  if (name == NULL)
    274     return false;
    275 
    276   /*
    277    * Then read in the symbol
    278    */
    279 
    280   if (bfd_read (name, symlength, 1, abfd) != symlength)
    281     return false;
     275    return FALSE;
     276
     277  /* Then read in the symbol.  */
     278
     279  if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength)
     280    return FALSE;
    282281  name[symlength] = '\0';
    283282  sym -> symbol.name = name;
     
    286285  sym -> symbol.section = bfd_und_section_ptr;
    287286
    288   /*
    289    * Next, start reading in the relocs.
    290    */
     287  /* Next, start reading in the relocs.  */
    291288
    292289  nlm_relocs = ((struct nlm_relent *)
    293290                bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
    294291  if (!nlm_relocs)
    295     return false;
     292    return FALSE;
    296293  sym -> relocs = nlm_relocs;
    297294  sym -> rcnt = 0;
     
    300297      asection *section;
    301298
    302       if (nlm_sparc_read_reloc (abfd, sym, &section,
    303                               &nlm_relocs -> reloc)
    304           == false)
    305         return false;
     299      if (! nlm_sparc_read_reloc (abfd, sym, &section, &nlm_relocs -> reloc))
     300        return FALSE;
    306301      nlm_relocs -> section = section;
    307302      nlm_relocs++;
    308303      sym -> rcnt++;
    309304    }
    310   return true;
    311 }
    312 
    313 static boolean
     305
     306  return TRUE;
     307}
     308
     309static bfd_boolean
    314310nlm_sparc_write_import (abfd, sec, rel)
    315311     bfd *abfd;
     
    326322  symsec = (*rel->sym_ptr_ptr)->section;
    327323
    328   if (symsec == code) {
     324  if (symsec == code)
    329325    base = 0;
    330   } else if (symsec == data) {
     326  else if (symsec == data)
    331327    base = bfd_section_size (abfd, code);
    332   } else if (symsec == bss) {
     328  else if (symsec == bss)
    333329    base = bfd_section_size (abfd, code) + bfd_section_size (abfd, data);
    334   } else
     330  else
    335331    base = 0;
    336332
     
    340336#endif
    341337  bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp);
    342   if (bfd_write ((PTR)temp, 4, 1, abfd) != 4)
    343     return false;
    344   bfd_put_32 (abfd, 1, temp);
    345   if (bfd_write ((PTR)temp, 4, 1, abfd) != 4)
    346     return false;
    347   if (nlm_sparc_write_reloc (abfd, sec, rel) == false)
    348     return false;
    349   return true;
     338  if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
     339    return FALSE;
     340  bfd_put_32 (abfd, (bfd_vma) 1, temp);
     341  if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
     342    return FALSE;
     343  if (! nlm_sparc_write_reloc (abfd, sec, rel))
     344    return FALSE;
     345  return TRUE;
    350346}
    351347
    352348/* Write out an external reference.  */
    353349
    354 static boolean
     350static bfd_boolean
    355351nlm_sparc_write_external (abfd, count, sym, relocs)
    356352     bfd *abfd;
     
    364360
    365361  bfd_put_32 (abfd, count, temp);
    366   if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
    367     return false;
     362  if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp))
     363    return FALSE;
    368364
    369365  len = strlen (sym->name);
    370   if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
    371       || bfd_write (sym->name, len, 1, abfd) != len)
    372     return false;
     366  if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd)
     367       != sizeof (bfd_byte))
     368      || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
     369    return FALSE;
    373370
    374371  for (i = 0; i < count; i++)
    375372    {
    376       if (nlm_sparc_write_reloc (abfd, relocs[i].sec,
    377                                  relocs[i].rel) == false)
    378         return false;
     373      if (! nlm_sparc_write_reloc (abfd, relocs[i].sec, relocs[i].rel))
     374        return FALSE;
    379375    }
    380376
    381   return true;
    382 }
    383 
    384 static boolean
     377  return TRUE;
     378}
     379
     380static bfd_boolean
    385381nlm_sparc_write_export (abfd, sym, value)
    386382     bfd *abfd;
     
    398394  len = strlen (sym->name);
    399395
    400   if (bfd_write (temp, 4, 1, abfd) != 4
    401       || bfd_write (&len, 1, 1, abfd) != 1
    402       || bfd_write (sym->name, len, 1, abfd) != len)
    403     return false;
    404 
    405   return true;
     396  if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4
     397      || bfd_bwrite (&len, (bfd_size_type) 1, abfd) != 1
     398      || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len)
     399    return FALSE;
     400
     401  return TRUE;
    406402}
    407403
     
    412408
    413409static const struct nlm_backend_data nlm32_sparc_backend =
    414 {
    415   "NetWare SPARC Module   \032",
    416   sizeof (Nlm32_sparc_External_Fixed_Header),
    417   0,    /* optional_prefix_size */
    418   bfd_arch_sparc,
    419   0,
    420   false,
    421   0,    /* backend_object_p */
    422   0,    /* write_prefix_func */
    423   nlm_sparc_read_reloc,
    424   nlm_sparc_mangle_relocs,
    425   nlm_sparc_read_import,
    426   nlm_sparc_write_import,
    427   0,    /* set_public_section */
    428   0,    /* get_public_offset */
    429   nlm_swap_fixed_header_in,
    430   nlm_swap_fixed_header_out,
    431   nlm_sparc_write_external,
    432   nlm_sparc_write_export
    433 };
     410  {
     411    "NetWare SPARC Module   \032",
     412    sizeof (Nlm32_sparc_External_Fixed_Header),
     413    0,  /* optional_prefix_size */
     414    bfd_arch_sparc,
     415    0,
     416    FALSE,
     417    0,  /* backend_object_p */
     418    0,  /* write_prefix_func */
     419    nlm_sparc_read_reloc,
     420    nlm_sparc_mangle_relocs,
     421    nlm_sparc_read_import,
     422    nlm_sparc_write_import,
     423    0,  /* set_public_section */
     424    0,  /* get_public_offset */
     425    nlm_swap_fixed_header_in,
     426    nlm_swap_fixed_header_out,
     427    nlm_sparc_write_external,
     428    nlm_sparc_write_export
     429  };
    434430
    435431#define TARGET_BIG_NAME         "nlm32-sparc"
    436432#define TARGET_BIG_SYM          nlmNAME(sparc_vec)
    437 #define TARGET_BACKEND_DATA             &nlm32_sparc_backend
     433#define TARGET_BACKEND_DATA     & nlm32_sparc_backend
    438434
    439435#include "nlm-target.h"
Note: See TracChangeset for help on using the changeset viewer.