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/coff-h8500.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* BFD back-end for Hitachi H8/500 COFF binaries.
    2    Copyright 1993, 1994, 1995, 1997, 1999, 2000
     1/* BFD back-end for Renesas H8/500 COFF binaries.
     2   Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003
    33   Free Software Foundation, Inc.
    44   Contributed by Cygnus Support.
    55   Written by Steve Chamberlain, <sac@cygnus.com>.
    66
    7 This file is part of BFD, the Binary File Descriptor library.
    8 
    9 This program is free software; you can redistribute it and/or modify
    10 it under the terms of the GNU General Public License as published by
    11 the Free Software Foundation; either version 2 of the License, or
    12 (at your option) any later version.
    13 
    14 This program is distributed in the hope that it will be useful,
    15 but WITHOUT ANY WARRANTY; without even the implied warranty of
    16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17 GNU General Public License for more details.
    18 
    19 You should have received a copy of the GNU General Public License
    20 along with this program; if not, write to the Free Software
    21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     7   This file is part of BFD, the Binary File Descriptor library.
     8
     9   This program is free software; you can redistribute it and/or modify
     10   it under the terms of the GNU General Public License as published by
     11   the Free Software Foundation; either version 2 of the License, or
     12   (at your option) any later version.
     13
     14   This program is distributed in the hope that it will be useful,
     15   but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   GNU General Public License for more details.
     18
     19   You should have received a copy of the GNU General Public License
     20   along with this program; if not, write to the Free Software
     21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    2222
    2323#include "bfd.h"
     
    2929#include "libcoff.h"
    3030
     31static int  coff_h8500_select_reloc PARAMS ((reloc_howto_type *));
     32static void rtype2howto      PARAMS ((arelent *, struct internal_reloc *));
     33static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
     34static void extra_case       PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *));
     35
    3136#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
    3237
    3338static reloc_howto_type r_imm8 =
    34 HOWTO (R_H8500_IMM8, 0, 1, 8, false, 0,
    35        complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff, false);
     39HOWTO (R_H8500_IMM8, 0, 1, 8, FALSE, 0,
     40       complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff, FALSE);
    3641
    3742static reloc_howto_type r_imm16 =
    38 HOWTO (R_H8500_IMM16, 0, 1, 16, false, 0,
    39        complain_overflow_bitfield, 0, "r_imm16", true, 0x0000ffff, 0x0000ffff, false);
     43HOWTO (R_H8500_IMM16, 0, 1, 16, FALSE, 0,
     44       complain_overflow_bitfield, 0, "r_imm16", TRUE, 0x0000ffff, 0x0000ffff, FALSE);
    4045
    4146static reloc_howto_type r_imm24 =
    42 HOWTO (R_H8500_IMM24, 0, 1, 24, false, 0,
    43        complain_overflow_bitfield, 0, "r_imm24", true, 0x00ffffff, 0x00ffffff, false);
     47HOWTO (R_H8500_IMM24, 0, 1, 24, FALSE, 0,
     48       complain_overflow_bitfield, 0, "r_imm24", TRUE, 0x00ffffff, 0x00ffffff, FALSE);
    4449
    4550static reloc_howto_type r_imm32 =
    46 HOWTO (R_H8500_IMM32, 0, 1, 32, false, 0,
    47        complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff, 0xffffffff, false);
     51HOWTO (R_H8500_IMM32, 0, 1, 32, FALSE, 0,
     52       complain_overflow_bitfield, 0, "r_imm32", TRUE, 0xffffffff, 0xffffffff, FALSE);
    4853
    4954static reloc_howto_type r_high8 =
    50 HOWTO (R_H8500_HIGH8, 0, 1, 8, false, 0,
    51        complain_overflow_dont, 0, "r_high8", true, 0x000000ff, 0x000000ff, false);
     55HOWTO (R_H8500_HIGH8, 0, 1, 8, FALSE, 0,
     56       complain_overflow_dont, 0, "r_high8", TRUE, 0x000000ff, 0x000000ff, FALSE);
    5257
    5358static reloc_howto_type r_low16 =
    54 HOWTO (R_H8500_LOW16, 0, 1, 16, false, 0,
    55        complain_overflow_dont, 0, "r_low16", true, 0x0000ffff, 0x0000ffff, false);
     59HOWTO (R_H8500_LOW16, 0, 1, 16, FALSE, 0,
     60       complain_overflow_dont, 0, "r_low16", TRUE, 0x0000ffff, 0x0000ffff, FALSE);
    5661
    5762static reloc_howto_type r_pcrel8 =
    58 HOWTO (R_H8500_PCREL8, 0, 1, 8, true, 0, complain_overflow_signed, 0, "r_pcrel8", true, 0, 0, true);
     63HOWTO (R_H8500_PCREL8, 0, 1, 8, TRUE, 0, complain_overflow_signed, 0, "r_pcrel8", TRUE, 0, 0, TRUE);
    5964
    6065static reloc_howto_type r_pcrel16 =
    61 HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel16", true, 0, 0, true);
     66HOWTO (R_H8500_PCREL16, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "r_pcrel16", TRUE, 0, 0, TRUE);
    6267
    6368static reloc_howto_type r_high16 =
    64 HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0,
    65        complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false);
    66 
    67 /* Turn a howto into a reloc number */
     69HOWTO (R_H8500_HIGH16, 0, 1, 8, FALSE, 0,
     70       complain_overflow_dont, 0, "r_high16", TRUE, 0x000ffff, 0x0000ffff, FALSE);
     71
     72
     73/* Turn a howto into a reloc number.  */
    6874
    6975static int
     
    8187#define __A_MAGIC_SET__
    8288
    83 /* Code to swap in the reloc */
    84 #define SWAP_IN_RELOC_OFFSET   bfd_h_get_32
    85 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
     89/* Code to swap in the reloc. */
     90#define SWAP_IN_RELOC_OFFSET    H_GET_32
     91#define SWAP_OUT_RELOC_OFFSET   H_PUT_32
    8692#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
    8793  dst->r_stuff[0] = 'S'; \
    8894  dst->r_stuff[1] = 'C';
    8995
    90 /* Code to turn a r_type into a howto ptr, uses the above howto table
    91    */
     96/* Code to turn a r_type into a howto ptr, uses the above howto table.  */
    9297
    9398static void
    94 rtype2howto(internal, dst)
     99rtype2howto (internal, dst)
    95100     arelent * internal;
    96101     struct internal_reloc *dst;
     
    133138#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
    134139
    135 /* Perform any necessary magic to the addend in a reloc entry */
     140/* Perform any necessary magic to the addend in a reloc entry. */
    136141
    137142#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
     
    152157
    153158  if (reloc->r_symndx > 0)
    154     {
    155       relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
    156     }
     159    relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
    157160  else
    158     {
    159       relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
    160     }
     161    relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
    161162
    162163  relent->addend = reloc->r_offset;
     
    176177  bfd_byte *d = data+*dst_ptr;
    177178  asection *input_section = link_order->u.indirect.section;
     179
    178180  switch (reloc->howto->type)
    179181    {
     
    190192                 (bfd_coff_reloc16_get_value (reloc, link_info, input_section)
    191193                  >> 16),
    192                  d );
     194                 d);
    193195      (*dst_ptr) += 1;
    194196      (*src_ptr) += 1;
     
    198200      bfd_put_16 (in_abfd,
    199201                  bfd_coff_reloc16_get_value (reloc, link_info, input_section),
    200                   d  );
     202                  d);
    201203      (*dst_ptr) += 2;
    202204      (*src_ptr) += 2;
     
    215217      bfd_put_16 (in_abfd,
    216218                  (bfd_coff_reloc16_get_value (reloc, link_info, input_section)
    217                    >>16),
     219                   >> 16),
    218220                  d);
    219221
     
    224226    case R_H8500_IMM24:
    225227      {
    226         int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
     228        int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
    227229        int o = bfd_get_32 (in_abfd, data+ *dst_ptr -1);
    228230        v = (v & 0x00ffffff) | (o & 0xff00000);
    229         bfd_put_32 (in_abfd, v, data  + *dst_ptr -1);
    230         (*dst_ptr) +=3;
    231         (*src_ptr)+=3;;
     231        bfd_put_32 (in_abfd, (bfd_vma) v, data  + *dst_ptr -1);
     232        (*dst_ptr) += 3;
     233        (*src_ptr) += 3;;
    232234      }
    233235      break;
    234236    case R_H8500_IMM32:
    235237      {
    236         int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
    237         bfd_put_32 (in_abfd, v, data  + *dst_ptr);
    238         (*dst_ptr) +=4;
    239         (*src_ptr)+=4;;
     238        int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
     239        bfd_put_32 (in_abfd, (bfd_vma) v, data  + *dst_ptr);
     240        (*dst_ptr) += 4;
     241        (*src_ptr) += 4;;
    240242      }
    241243      break;
     
    249251            + link_order->u.indirect.section->output_section->vma;
    250252        int gap = dst - dot - 1; /* -1 since were in the odd byte of the
    251                                     word and the pc's been incremented */
     253                                    word and the pc's been incremented. */
    252254
    253255        if (gap > 128 || gap < -128)
     
    272274            + link_order->u.indirect.section->output_section->vma;
    273275        int gap = dst - dot - 1; /* -1 since were in the odd byte of the
    274                                     word and the pc's been incremented */
     276                                    word and the pc's been incremented. */
    275277
    276278        if (gap > 32767 || gap < -32768)
     
    282284              abort ();
    283285          }
    284         bfd_put_16 (in_abfd, gap, data + *dst_ptr);
    285         (*dst_ptr)+=2;
    286         (*src_ptr)+=2;
     286        bfd_put_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr);
     287        (*dst_ptr) += 2;
     288        (*src_ptr) += 2;
    287289        break;
    288290      }
Note: See TracChangeset for help on using the changeset viewer.