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/cpu-h8300.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* BFD library support routines for the Hitachi H8/300 architecture.
    2    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000
     1/* BFD library support routines for the Renesas H8/300 architecture.
     2   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2003
    33   Free Software Foundation, Inc.
    44   Hacked by Steve Chamberlain of Cygnus Support.
    55
    6 This file is part of BFD, the Binary File Descriptor library.
     6   This file is part of BFD, the Binary File Descriptor library.
    77
    8 This program is free software; you can redistribute it and/or modify
    9 it under the terms of the GNU General Public License as published by
    10 the Free Software Foundation; either version 2 of the License, or
    11 (at your option) any later version.
     8   This program is free software; you can redistribute it and/or modify
     9   it under the terms of the GNU General Public License as published by
     10   the Free Software Foundation; either version 2 of the License, or
     11   (at your option) any later version.
    1212
    13 This program is distributed in the hope that it will be useful,
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 GNU General Public License for more details.
     13   This program is distributed in the hope that it will be useful,
     14   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16   GNU General Public License for more details.
    1717
    18 You should have received a copy of the GNU General Public License
    19 along with this program; if not, write to the Free Software
    20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     18   You should have received a copy of the GNU General Public License
     19   along with this program; if not, write to the Free Software
     20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    2121
    2222#include "bfd.h"
     
    2424#include "libbfd.h"
    2525
    26 int bfd_default_scan_num_mach ();
     26static bfd_boolean h8300_scan
     27  PARAMS ((const struct bfd_arch_info *, const char *));
     28static const bfd_arch_info_type * compatible
     29  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
    2730
    28 static boolean
     31static bfd_boolean
    2932h8300_scan (info, string)
    3033     const struct bfd_arch_info *info;
     
    3235{
    3336  if (*string != 'h' && *string != 'H')
    34     return false;
     37    return FALSE;
    3538
    3639  string++;
    3740  if (*string != '8')
    38     return false;
     41    return FALSE;
    3942
    4043  string++;
     
    4346
    4447  if (*string != '3')
    45     return false;
     48    return FALSE;
    4649  string++;
    4750  if (*string != '0')
    48     return false;
     51    return FALSE;
    4952  string++;
    5053  if (*string != '0')
    51     return false;
     54    return FALSE;
    5255  string++;
    5356  if (*string == '-')
    5457    string++;
     58
     59  /* In ELF linker scripts, we typically express the architecture/machine
     60     as architecture:machine.
     61
     62     So if we've matched so far and encounter a colon, try to match the
     63     string following the colon.  */
     64  if (*string == ':')
     65    {
     66      string++;
     67      return h8300_scan (info, string);
     68    }
     69
    5570  if (*string == 'h' || *string == 'H')
    5671    {
     72      string++;
     73      if (*string == 'n' || *string == 'N')
     74        return (info->mach == bfd_mach_h8300hn);
     75
    5776      return (info->mach == bfd_mach_h8300h);
    5877    }
    5978  else if (*string == 's' || *string == 'S')
    6079    {
     80      string++;
     81      if (*string == 'n' || *string == 'N')
     82        return (info->mach == bfd_mach_h8300sn);
     83
    6184      return (info->mach == bfd_mach_h8300s);
    6285    }
    6386  else
    64     {
    65       return info->mach == bfd_mach_h8300;
    66     }
     87    return info->mach == bfd_mach_h8300;
    6788}
    6889
     
    7798{
    7899  /* It's really not a good idea to mix and match modes.  */
    79   if (in->mach != out->mach)
     100  if (in->arch != out->arch || in->mach != out->mach)
    80101    return 0;
    81102  else
     
    83104}
    84105
    85 static const bfd_arch_info_type h8300_info_struct =
     106static const bfd_arch_info_type h8300sn_info_struct =
    86107{
    87   16,                           /* 16 bits in a word */
    88   16,                           /* 16 bits in an address */
    89   8,                            /* 8 bits in a byte */
     108  32,                           /* 32 bits in a word. */
     109  32,                           /* 32 bits in an address. */
     110  8,                            /* 8 bits in a byte. */
    90111  bfd_arch_h8300,
    91   bfd_mach_h8300,
    92   "h8300",                      /* arch_name  */
    93   "h8300",                      /* printable name */
     112  bfd_mach_h8300sn,
     113  "h8300sn",                    /* Architecture name.  */
     114  "h8300sn",                    /* Printable name. */
    94115  1,
    95   true,                         /* the default machine */
     116  FALSE,                        /* The default machine. */
    96117  compatible,
    97118  h8300_scan,
    98 #if 0
    99   local_bfd_reloc_type_lookup,
    100 #endif
    101   0,
     119  0
     120};
     121
     122
     123static const bfd_arch_info_type h8300hn_info_struct =
     124{
     125  32,                           /* 32 bits in a word.  */
     126  32,                           /* 32 bits in an address.  */
     127  8,                            /* 8 bits in a byte.  */
     128  bfd_arch_h8300,
     129  bfd_mach_h8300hn,
     130  "h8300hn",                    /* Architecture name.  */
     131  "h8300hn",                    /* Printable name.  */
     132  1,
     133  FALSE,                        /* The default machine.  */
     134  compatible,
     135  h8300_scan,
     136  &h8300sn_info_struct
     137};
     138
     139static const bfd_arch_info_type h8300s_info_struct =
     140{
     141  32,                           /* 32 bits in a word.  */
     142  32,                           /* 32 bits in an address.  */
     143  8,                            /* 8 bits in a byte.  */
     144  bfd_arch_h8300,
     145  bfd_mach_h8300s,
     146  "h8300s",                     /* Architecture name.  */
     147  "h8300s",                     /* Printable name.  */
     148  1,
     149  FALSE,                        /* The default machine.  */
     150  compatible,
     151  h8300_scan,
     152  & h8300hn_info_struct
    102153};
    103154
    104155static const bfd_arch_info_type h8300h_info_struct =
    105156{
    106   32,                           /* 32 bits in a word */
    107   32,                           /* 32 bits in an address */
    108   8,                            /* 8 bits in a byte */
     157  32,                           /* 32 bits in a word. */
     158  32,                           /* 32 bits in an address. */
     159  8,                            /* 8 bits in a byte. */
    109160  bfd_arch_h8300,
    110161  bfd_mach_h8300h,
    111   "h8300h",                     /* arch_name  */
    112   "h8300h",                     /* printable name */
     162  "h8300h",                     /* Architecture name.  */
     163  "h8300h",                     /* Printable name. */
    113164  1,
    114   false,                        /* the default machine */
     165  FALSE,                        /* The default machine. */
    115166  compatible,
    116167  h8300_scan,
    117 #if 0
    118   local_bfd_reloc_type_lookup,
    119 #endif
    120   &h8300_info_struct,
     168  &h8300s_info_struct
    121169};
    122170
    123171const bfd_arch_info_type bfd_h8300_arch =
    124172{
    125   32,                           /* 32 bits in a word */
    126   32,                           /* 32 bits in an address */
    127   8,                            /* 8 bits in a byte */
     173  16,                           /* 16 bits in a word. */
     174  16,                           /* 16 bits in an address. */
     175  8,                            /* 8 bits in a byte. */
    128176  bfd_arch_h8300,
    129   bfd_mach_h8300s,
    130   "h8300s",                     /* arch_name  */
    131   "h8300s",                     /* printable name */
     177  bfd_mach_h8300,
     178  "h8300",                      /* Architecture name.  */
     179  "h8300",                      /* Printable name. */
    132180  1,
    133   false,                        /* the default machine */
     181  TRUE,                         /* The default machine. */
    134182  compatible,
    135183  h8300_scan,
    136 #if 0
    137   local_bfd_reloc_type_lookup,
    138 #endif
    139   &h8300h_info_struct,
     184  &h8300h_info_struct
    140185};
Note: See TracChangeset for help on using the changeset viewer.