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/elf32-m32r.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* M32R-specific support for 32-bit ELF.
    2    Copyright 1996, 1997, 1998, 1999, 2000, 2001
     2   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
    33   Free Software Foundation, Inc.
    44
     
    4444  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
    4545static void m32r_info_to_howto_rel
    46   PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
    47 boolean _bfd_m32r_elf_section_from_bfd_section
    48   PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *));
     46  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
     47bfd_boolean _bfd_m32r_elf_section_from_bfd_section
     48  PARAMS ((bfd *, asection *, int *));
    4949void _bfd_m32r_elf_symbol_processing
    5050  PARAMS ((bfd *, asymbol *));
    51 static boolean m32r_elf_add_symbol_hook
     51static bfd_boolean m32r_elf_add_symbol_hook
    5252  PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
    5353           const char **, flagword *, asection **, bfd_vma *));
    54 static boolean m32r_elf_relocate_section
     54static bfd_boolean m32r_elf_relocate_section
    5555  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
    5656           Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
    5757#if 0 /* not yet */
    58 static boolean m32r_elf_relax_delete_bytes
     58static bfd_boolean m32r_elf_relax_delete_bytes
    5959  PARAMS ((bfd *, asection *, bfd_vma, int));
    6060#endif
    61 
    6261static bfd_reloc_status_type m32r_elf_final_sda_base
    6362  PARAMS ((bfd *, struct bfd_link_info *, const char **, bfd_vma *));
    64 static boolean m32r_elf_object_p
     63static bfd_boolean m32r_elf_object_p
    6564  PARAMS ((bfd *));
    6665static void m32r_elf_final_write_processing
    67   PARAMS ((bfd *, boolean));
    68 static boolean m32r_elf_set_private_flags
     66  PARAMS ((bfd *, bfd_boolean));
     67static bfd_boolean m32r_elf_set_private_flags
    6968  PARAMS ((bfd *, flagword));
    70 static boolean m32r_elf_copy_private_bfd_data
     69static bfd_boolean m32r_elf_merge_private_bfd_data
    7170  PARAMS ((bfd *, bfd *));
    72 static boolean m32r_elf_merge_private_bfd_data
    73   PARAMS ((bfd *, bfd *));
    74 static boolean m32r_elf_print_private_bfd_data
     71static bfd_boolean m32r_elf_print_private_bfd_data
    7572  PARAMS ((bfd *, PTR));
     73static bfd_boolean m32r_elf_gc_sweep_hook
     74  PARAMS ((bfd *, struct bfd_link_info *, asection *,
     75           const Elf_Internal_Rela *));
     76static bfd_boolean m32r_elf_check_relocs
     77  PARAMS ((bfd *, struct bfd_link_info *, asection *,
     78           const Elf_Internal_Rela *));
     79
     80asection * m32r_elf_gc_mark_hook
     81  PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
     82           struct elf_link_hash_entry *, Elf_Internal_Sym *));
    7683
    7784#define NOP_INSN                0x7000
     
    8289   relocs will be put in ROM?  All in all though, REL relocs are a pain
    8390   to work with.  */
    84 #define USE_REL
     91#define USE_REL 1
     92
     93#ifndef USE_REL
     94#define USE_REL 0
     95#endif
    8596
    8697static reloc_howto_type m32r_elf_howto_table[] =
     
    91102         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    92103         32,                    /* bitsize */
    93          false,                 /* pc_relative */
     104         FALSE,                 /* pc_relative */
    94105         0,                     /* bitpos */
    95106         complain_overflow_bitfield, /* complain_on_overflow */
    96107         bfd_elf_generic_reloc, /* special_function */
    97108         "R_M32R_NONE",         /* name */
    98          false,                 /* partial_inplace */
     109         FALSE,                 /* partial_inplace */
    99110         0,                     /* src_mask */
    100111         0,                     /* dst_mask */
    101          false),                /* pcrel_offset */
     112         FALSE),                /* pcrel_offset */
    102113
    103114  /* A 16 bit absolute relocation.  */
     
    106117         1,                     /* size (0 = byte, 1 = short, 2 = long) */
    107118         16,                    /* bitsize */
    108          false,                 /* pc_relative */
     119         FALSE,                 /* pc_relative */
    109120         0,                     /* bitpos */
    110121         complain_overflow_bitfield, /* complain_on_overflow */
    111122         m32r_elf_generic_reloc,/* special_function */
    112123         "R_M32R_16",           /* name */
    113          true,                  /* partial_inplace */
     124         TRUE,                  /* partial_inplace */
    114125         0xffff,                /* src_mask */
    115126         0xffff,                /* dst_mask */
    116          false),                /* pcrel_offset */
     127         FALSE),                /* pcrel_offset */
    117128
    118129  /* A 32 bit absolute relocation.  */
     
    121132         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    122133         32,                    /* bitsize */
    123          false,                 /* pc_relative */
     134         FALSE,                 /* pc_relative */
    124135         0,                     /* bitpos */
    125136         complain_overflow_bitfield, /* complain_on_overflow */
    126137         m32r_elf_generic_reloc,/* special_function */
    127138         "R_M32R_32",           /* name */
    128          true,                  /* partial_inplace */
     139         TRUE,                  /* partial_inplace */
    129140         0xffffffff,            /* src_mask */
    130141         0xffffffff,            /* dst_mask */
    131          false),                /* pcrel_offset */
     142         FALSE),                /* pcrel_offset */
    132143
    133144  /* A 24 bit address.  */
     
    136147         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    137148         24,                    /* bitsize */
    138          false,                 /* pc_relative */
     149         FALSE,                 /* pc_relative */
    139150         0,                     /* bitpos */
    140151         complain_overflow_unsigned, /* complain_on_overflow */
    141152         m32r_elf_generic_reloc,/* special_function */
    142153         "R_M32R_24",           /* name */
    143          true,                  /* partial_inplace */
     154         TRUE,                  /* partial_inplace */
    144155         0xffffff,              /* src_mask */
    145156         0xffffff,              /* dst_mask */
    146          false),                /* pcrel_offset */
     157         FALSE),                /* pcrel_offset */
    147158
    148159  /* An PC Relative 10-bit relocation, shifted by 2.
     
    158169         1,                     /* size (0 = byte, 1 = short, 2 = long) */
    159170         10,                    /* bitsize */
    160          true,                  /* pc_relative */
     171         TRUE,                  /* pc_relative */
    161172         0,                     /* bitpos */
    162173         complain_overflow_signed, /* complain_on_overflow */
    163174         m32r_elf_10_pcrel_reloc, /* special_function */
    164175         "R_M32R_10_PCREL",     /* name */
    165          false,                 /* partial_inplace */
     176         FALSE,                 /* partial_inplace */
    166177         0xff,                  /* src_mask */
    167178         0xff,                  /* dst_mask */
    168          true),                 /* pcrel_offset */
     179         TRUE),                 /* pcrel_offset */
    169180
    170181  /* A relative 18 bit relocation, right shifted by 2.  */
     
    173184         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    174185         16,                    /* bitsize */
    175          true,                  /* pc_relative */
     186         TRUE,                  /* pc_relative */
    176187         0,                     /* bitpos */
    177188         complain_overflow_signed, /* complain_on_overflow */
    178189         bfd_elf_generic_reloc, /* special_function */
    179190         "R_M32R_18_PCREL",     /* name */
    180          false,                 /* partial_inplace */
     191         FALSE,                 /* partial_inplace */
    181192         0xffff,                /* src_mask */
    182193         0xffff,                /* dst_mask */
    183          true),                 /* pcrel_offset */
     194         TRUE),                 /* pcrel_offset */
    184195
    185196  /* A relative 26 bit relocation, right shifted by 2.  */
     
    192203         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    193204         26,                    /* bitsize */
    194          true,                  /* pc_relative */
     205         TRUE,                  /* pc_relative */
    195206         0,                     /* bitpos */
    196207         complain_overflow_signed, /* complain_on_overflow */
    197208         bfd_elf_generic_reloc, /* special_function */
    198209         "R_M32R_26_PCREL",     /* name */
    199          false,                 /* partial_inplace */
     210         FALSE,                 /* partial_inplace */
    200211         0xffffff,              /* src_mask */
    201212         0xffffff,              /* dst_mask */
    202          true),                 /* pcrel_offset */
     213         TRUE),                 /* pcrel_offset */
    203214
    204215  /* High 16 bits of address when lower 16 is or'd in.  */
     
    207218         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    208219         16,                    /* bitsize */
    209          false,                 /* pc_relative */
     220         FALSE,                 /* pc_relative */
    210221         0,                     /* bitpos */
    211222         complain_overflow_dont, /* complain_on_overflow */
    212223         m32r_elf_hi16_reloc,   /* special_function */
    213224         "R_M32R_HI16_ULO",     /* name */
    214          true,                  /* partial_inplace */
     225         TRUE,                  /* partial_inplace */
    215226         0x0000ffff,            /* src_mask */
    216227         0x0000ffff,            /* dst_mask */
    217          false),                /* pcrel_offset */
     228         FALSE),                /* pcrel_offset */
    218229
    219230  /* High 16 bits of address when lower 16 is added in.  */
     
    222233         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    223234         16,                    /* bitsize */
    224          false,                 /* pc_relative */
     235         FALSE,                 /* pc_relative */
    225236         0,                     /* bitpos */
    226237         complain_overflow_dont, /* complain_on_overflow */
    227238         m32r_elf_hi16_reloc,   /* special_function */
    228239         "R_M32R_HI16_SLO",     /* name */
    229          true,                  /* partial_inplace */
     240         TRUE,                  /* partial_inplace */
    230241         0x0000ffff,            /* src_mask */
    231242         0x0000ffff,            /* dst_mask */
    232          false),                /* pcrel_offset */
     243         FALSE),                /* pcrel_offset */
    233244
    234245  /* Lower 16 bits of address.  */
     
    237248         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    238249         16,                    /* bitsize */
    239          false,                 /* pc_relative */
     250         FALSE,                 /* pc_relative */
    240251         0,                     /* bitpos */
    241252         complain_overflow_dont, /* complain_on_overflow */
    242253         m32r_elf_lo16_reloc,   /* special_function */
    243254         "R_M32R_LO16",         /* name */
    244          true,                  /* partial_inplace */
     255         TRUE,                  /* partial_inplace */
    245256         0x0000ffff,            /* src_mask */
    246257         0x0000ffff,            /* dst_mask */
    247          false),                /* pcrel_offset */
     258         FALSE),                /* pcrel_offset */
    248259
    249260  /* Small data area 16 bits offset.  */
     
    252263         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    253264         16,                    /* bitsize */
    254          false,                 /* pc_relative */
     265         FALSE,                 /* pc_relative */
    255266         0,                     /* bitpos */
    256267         complain_overflow_signed, /* complain_on_overflow */
    257268         m32r_elf_sda16_reloc,  /* special_function */
    258269         "R_M32R_SDA16",        /* name */
    259          true,                  /* partial_inplace */  /* FIXME: correct? */
     270         TRUE,                  /* partial_inplace */  /* FIXME: correct? */
    260271         0x0000ffff,            /* src_mask */
    261272         0x0000ffff,            /* dst_mask */
    262          false),                /* pcrel_offset */
     273         FALSE),                /* pcrel_offset */
    263274
    264275  /* GNU extension to record C++ vtable hierarchy */
     
    267278         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    268279         0,                     /* bitsize */
    269          false,                 /* pc_relative */
     280         FALSE,                 /* pc_relative */
    270281         0,                     /* bitpos */
    271282         complain_overflow_dont, /* complain_on_overflow */
    272283         NULL,                  /* special_function */
    273284         "R_M32R_GNU_VTINHERIT", /* name */
    274          false,                 /* partial_inplace */
     285         FALSE,                 /* partial_inplace */
    275286         0,                     /* src_mask */
    276287         0,                     /* dst_mask */
    277          false),                /* pcrel_offset */
     288         FALSE),                /* pcrel_offset */
    278289
    279290  /* GNU extension to record C++ vtable member usage */
     
    282293         2,                     /* size (0 = byte, 1 = short, 2 = long) */
    283294         0,                     /* bitsize */
    284          false,                 /* pc_relative */
     295         FALSE,                 /* pc_relative */
    285296         0,                     /* bitpos */
    286297         complain_overflow_dont, /* complain_on_overflow */
    287298         _bfd_elf_rel_vtable_reloc_fn,  /* special_function */
    288299         "R_M32R_GNU_VTENTRY",   /* name */
    289          false,                 /* partial_inplace */
     300         FALSE,                 /* partial_inplace */
    290301         0,                     /* src_mask */
    291302         0,                     /* dst_mask */
    292          false),                /* pcrel_offset */
     303         FALSE),                /* pcrel_offset */
    293304
    294305};
     
    362373  /* These jumps mask off the lower two bits of the current address
    363374     before doing pcrel calculations.  */
    364   relocation -= (offset & -4L);
     375  relocation -= (offset & -(bfd_vma) 4);
    365376
    366377  if (relocation < -0x200 || relocation > 0x1ff)
     
    373384  relocation <<= howto->bitpos;
    374385  x = (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask);
    375   bfd_put_16 (abfd, x, data + offset);
     386  bfd_put_16 (abfd, (bfd_vma) x, data + offset);
    376387
    377388  return status;
     
    450461
    451462  /* Save the information, and let LO16 do the actual relocation.  */
    452   n = (struct m32r_hi16 *) bfd_malloc (sizeof *n);
     463  n = (struct m32r_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n);
    453464  if (n == NULL)
    454465    return bfd_reloc_outofrange;
     
    549560            val += 0x10000;
    550561
    551           insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
    552           bfd_put_32 (input_bfd, insn, l->addr);
     562          insn = (insn &~ (bfd_vma) 0xffff) | ((val >> 16) & 0xffff);
     563          bfd_put_32 (input_bfd, (bfd_vma) insn, l->addr);
    553564
    554565          next = l->next;
     
    562573  /* Now do the LO16 reloc in the usual way.
    563574     ??? It would be nice to call bfd_elf_generic_reloc here,
    564      but we have partial_inplace == TRUE.  bfd_elf_generic_reloc will
     575     but we have partial_inplace set.  bfd_elf_generic_reloc will
    565576     pass the handling back to bfd_install_relocation which will install
    566577     a section relative addend which is wrong.  */
     
    598609    }
    599610
    600   /* Now do the the reloc in the usual way.
     611  /* Now do the reloc in the usual way.
    601612     ??? It would be nice to call bfd_elf_generic_reloc here,
    602      but we have partial_inplace == TRUE.  bfd_elf_generic_reloc will
     613     but we have partial_inplace set.  bfd_elf_generic_reloc will
    603614     pass the handling back to bfd_install_relocation which will install
    604615     a section relative addend which is wrong.  */
     
    640651        short x = bfd_get_16 (input_bfd, inplace_address);
    641652        DOIT (x);
    642         bfd_put_16 (input_bfd, x, inplace_address);
     653        bfd_put_16 (input_bfd, (bfd_vma) x, inplace_address);
    643654      }
    644655      break;
     
    647658        unsigned long x = bfd_get_32 (input_bfd, inplace_address);
    648659        DOIT (x);
    649         bfd_put_32 (input_bfd, x, inplace_address);
     660        bfd_put_32 (input_bfd, (bfd_vma)x , inplace_address);
    650661      }
    651662      break;
     
    748759     bfd *abfd ATTRIBUTE_UNUSED;
    749760     arelent *cache_ptr;
    750      Elf32_Internal_Rel *dst;
     761     Elf_Internal_Rela *dst;
    751762{
    752763  unsigned int r_type;
     
    761772   index.  */
    762773
    763 boolean
    764 _bfd_m32r_elf_section_from_bfd_section (abfd, hdr, sec, retval)
     774bfd_boolean
     775_bfd_m32r_elf_section_from_bfd_section (abfd, sec, retval)
    765776     bfd *abfd ATTRIBUTE_UNUSED;
    766      Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
    767777     asection *sec;
    768778     int *retval;
     
    771781    {
    772782      *retval = SHN_M32R_SCOMMON;
    773       return true;
    774     }
    775   return false;
     783      return TRUE;
     784    }
     785  return FALSE;
    776786}
    777787
     
    824834   linker sections.  */
    825835
    826 static boolean
     836static bfd_boolean
    827837m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
    828838     bfd *abfd;
     
    836846  if (! info->relocateable
    837847      && (*namep)[0] == '_' && (*namep)[1] == 'S'
    838       && strcmp (*namep, "_SDA_BASE_") == 0)
     848      && strcmp (*namep, "_SDA_BASE_") == 0
     849      && info->hash->creator->flavour == bfd_target_elf_flavour)
    839850    {
    840851      /* This is simpler than using _bfd_elf_create_linker_section
     
    844855         screws of _SDA_BASE_ address calcs because output_offset != 0.  */
    845856      struct elf_link_hash_entry *h;
     857      struct bfd_link_hash_entry *bh;
    846858      asection *s = bfd_get_section_by_name (abfd, ".sdata");
    847859
     
    850862      if (s == NULL)
    851863        {
    852           int flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
    853                        | SEC_IN_MEMORY | SEC_LINKER_CREATED);
     864          flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
     865                            | SEC_IN_MEMORY | SEC_LINKER_CREATED);
    854866
    855867          s = bfd_make_section_anyway (abfd, ".sdata");
    856868          if (s == NULL)
    857             return false;
     869            return FALSE;
    858870          bfd_set_section_flags (abfd, s, flags);
    859871          bfd_set_section_alignment (abfd, s, 2);
    860872        }
    861873
    862       h = (struct elf_link_hash_entry *)
    863         bfd_link_hash_lookup (info->hash, "_SDA_BASE_", false, false, false);
    864 
    865       if ((h == NULL || h->root.type == bfd_link_hash_undefined)
     874      bh = bfd_link_hash_lookup (info->hash, "_SDA_BASE_",
     875                                 FALSE, FALSE, FALSE);
     876
     877      if ((bh == NULL || bh->type == bfd_link_hash_undefined)
    866878          && !(_bfd_generic_link_add_one_symbol (info,
    867879                                                 abfd,
     
    869881                                                 BSF_GLOBAL,
    870882                                                 s,
    871                                                  32768,
     883                                                 (bfd_vma) 32768,
    872884                                                 (const char *) NULL,
    873                                                  false,
     885                                                 FALSE,
    874886                                                 get_elf_backend_data (abfd)->collect,
    875                                                  (struct bfd_link_hash_entry **) &h)))
    876         return false;
     887                                                 &bh)))
     888        return FALSE;
     889      h = (struct elf_link_hash_entry *) bh;
    877890      h->type = STT_OBJECT;
    878891    }
     
    887900    }
    888901
    889   return true;
     902  return TRUE;
    890903}
    891904
     
    907920      struct bfd_link_hash_entry *h;
    908921
    909       h = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", false, false, true);
     922      h = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", FALSE, FALSE, TRUE);
    910923      if (h != (struct bfd_link_hash_entry *) NULL
    911924          && h->type == bfd_link_hash_defined)
     
    929942/* Relocate an M32R/D ELF section.
    930943   There is some attempt to make this function usable for many architectures,
    931    both USE_REL and USE_RELA ['twould be nice if such a critter existed],
    932    if only to serve as a learning tool.
     944   both for RELA and REL type relocs, if only to serve as a learning tool.
    933945
    934946   The RELOCATE_SECTION function is called by the new ELF backend linker
     
    961973   accordingly.  */
    962974
    963 static boolean
     975static bfd_boolean
    964976m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section,
    965977                           contents, relocs, local_syms, local_sections)
     
    977989  Elf_Internal_Rela *rel, *relend;
    978990  /* Assume success.  */
    979   boolean ret = true;
     991  bfd_boolean ret = TRUE;
     992
     993#if !USE_REL
     994  if (info->relocateable)
     995    return TRUE;
     996#endif
    980997
    981998  rel = relocs;
     
    10041021        {
    10051022          (*_bfd_error_handler) (_("%s: unknown relocation type %d"),
    1006                                  bfd_get_filename (input_bfd),
     1023                                 bfd_archive_filename (input_bfd),
    10071024                                 (int) r_type);
    10081025          bfd_set_error (bfd_error_bad_value);
    1009           ret = false;
     1026          ret = FALSE;
    10101027          continue;
    10111028        }
     
    10181035      r_symndx = ELF32_R_SYM (rel->r_info);
    10191036
     1037#if USE_REL
    10201038      if (info->relocateable)
    10211039        {
     
    10431061          sec = local_sections[r_symndx];
    10441062          addend += sec->output_offset + sym->st_value;
    1045 #ifndef USE_REL
    1046           /* This can't be done for USE_REL because it doesn't mean anything
    1047              and elf_link_input_bfd asserts this stays zero.  */
    1048           rel->r_addend = addend;
    1049 #endif
    1050 
    1051 #ifndef USE_REL
    1052           /* Addends are stored with relocs.  We're done.  */
    1053           continue;
    1054 #else /* USE_REL */
     1063
    10551064          /* If partial_inplace, we need to store any additional addend
    10561065             back in the section.  */
     
    10861095                                            addend, contents + offset);
    10871096            }
    1088 #endif /* USE_REL */
    10891097        }
    10901098      else
     1099#endif /* USE_REL */
    10911100        {
    10921101          bfd_vma relocation;
     
    11021111              sec = local_sections[r_symndx];
    11031112              sym_name = "<local symbol>";
     1113#if !USE_REL
     1114              relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
     1115              addend = rel->r_addend;
     1116#else
     1117              /* FIXME: This won't handle local relocations against SEC_MERGE
     1118                 symbols.  See elf32-i386.c for how to do this.  */
    11041119              relocation = (sec->output_section->vma
    11051120                            + sec->output_offset
    11061121                            + sym->st_value);
     1122#endif
    11071123            }
    11081124          else
     
    11321148                  if (! ((*info->callbacks->undefined_symbol)
    11331149                         (info, h->root.root.string, input_bfd,
    1134                           input_section, offset, true)))
    1135                     return false;
     1150                          input_section, offset, TRUE)))
     1151                    return FALSE;
    11361152                  relocation = 0;
    11371153                }
     
    12001216                    if (r != bfd_reloc_ok)
    12011217                      {
    1202                         ret = false;
     1218                        ret = FALSE;
    12031219                        goto check_reloc;
    12041220                      }
     
    12111227                else
    12121228                  {
    1213                     (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"),
    1214                                            bfd_get_filename (input_bfd),
    1215                                            sym_name,
    1216                                            m32r_elf_howto_table[(int) r_type].name,
    1217                                            bfd_get_section_name (abfd, sec));
     1229                    (*_bfd_error_handler)
     1230                      (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"),
     1231                       bfd_archive_filename (input_bfd),
     1232                       sym_name,
     1233                       m32r_elf_howto_table[(int) r_type].name,
     1234                       bfd_get_section_name (abfd, sec));
    12181235                    /*bfd_set_error (bfd_error_bad_value); ??? why? */
    1219                     ret = false;
     1236                    ret = FALSE;
    12201237                    continue;
    12211238                  }
     
    12571274                     (info, name, howto->name, (bfd_vma) 0,
    12581275                      input_bfd, input_section, offset)))
    1259                 return false;
     1276                return FALSE;
    12601277              break;
    12611278
     
    12631280              if (! ((*info->callbacks->undefined_symbol)
    12641281                     (info, name, input_bfd, input_section,
    1265                       offset, true)))
    1266                 return false;
     1282                      offset, TRUE)))
     1283                return FALSE;
    12671284              break;
    12681285
     
    12871304                    (info, errmsg, name, input_bfd, input_section,
    12881305                     offset)))
    1289                 return false;
     1306                return FALSE;
    12901307              break;
    12911308            }
     
    13201337*/
    13211338
    1322 static boolean
     1339static bfd_boolean
    13231340m32r_elf_relax_section (abfd, sec, link_info, again)
    13241341     bfd *abfd;
    13251342     asection *sec;
    13261343     struct bfd_link_info *link_info;
    1327      boolean *again;
     1344     bfd_boolean *again;
    13281345{
    13291346  Elf_Internal_Shdr *symtab_hdr;
     
    13311348     _bfd_elf32_link_read_relocs uses [for convenience - it sets the addend
    13321349     field to 0].  */
    1333   Elf_Internal_Rela *internal_relocs;
    1334   Elf_Internal_Rela *free_relocs = NULL;
     1350  Elf_Internal_Rela *internal_relocs = NULL;
    13351351  Elf_Internal_Rela *irel, *irelend;
    13361352  bfd_byte *contents = NULL;
    1337   bfd_byte *free_contents = NULL;
    1338   Elf32_External_Sym *extsyms = NULL;
    1339   Elf32_External_Sym *free_extsyms = NULL;
     1353  Elf_Internal_Sym *isymbuf = NULL;
    13401354
    13411355  /* Assume nothing changes.  */
    1342   *again = false;
     1356  *again = FALSE;
    13431357
    13441358  /* We don't have to do anything for a relocateable link, if
     
    13501364      || (sec->flags & SEC_CODE) == 0
    13511365      || 0 /* FIXME: check SHF_M32R_CAN_RELAX */)
    1352     return true;
     1366    return TRUE;
    13531367
    13541368  /* If this is the first time we have been called for this section,
     
    13651379  if (internal_relocs == NULL)
    13661380    goto error_return;
    1367   if (! link_info->keep_memory)
    1368     free_relocs = internal_relocs;
    13691381
    13701382  /* Walk through them looking for relaxing opportunities.  */
     
    13911403              if (contents == NULL)
    13921404                goto error_return;
    1393               free_contents = contents;
    13941405
    13951406              if (! bfd_get_section_contents (abfd, sec, contents,
     
    13991410        }
    14001411
    1401       /* Read this BFD's symbols if we haven't done so already.  */
    1402       if (extsyms == NULL)
     1412      /* Read this BFD's local symbols if we haven't done so already.  */
     1413      if (isymbuf == NULL && symtab_hdr->sh_info != 0)
    14031414        {
    1404           /* Get cached copy if it exists.  */
    1405           if (symtab_hdr->contents != NULL)
    1406             extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
    1407           else
    1408             {
    1409               /* Go get them off disk.  */
    1410               extsyms = ((Elf32_External_Sym *)
    1411                          bfd_malloc (symtab_hdr->sh_size));
    1412               if (extsyms == NULL)
    1413                 goto error_return;
    1414               free_extsyms = extsyms;
    1415               if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
    1416                   || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd)
    1417                       != symtab_hdr->sh_size))
    1418                 goto error_return;
    1419             }
     1415          isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
     1416          if (isymbuf == NULL)
     1417            isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
     1418                                            symtab_hdr->sh_info, 0,
     1419                                            NULL, NULL, NULL);
     1420          if (isymbuf == NULL)
     1421            goto error_return;
    14201422        }
    14211423
     
    14231425      if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
    14241426        {
    1425           Elf_Internal_Sym isym;
     1427          /* A local symbol.  */
     1428          Elf_Internal_Sym *isym;
    14261429          asection *sym_sec;
    14271430
    1428           /* A local symbol.  */
    1429           bfd_elf32_swap_symbol_in (abfd,
    1430                                     extsyms + ELF32_R_SYM (irel->r_info),
    1431                                     &isym);
    1432 
    1433           sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx);
    1434           symval = (isym.st_value
     1431          isym = isymbuf + ELF32_R_SYM (irel->r_info),
     1432          sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
     1433          symval = (isym->st_value
    14351434                    + sym_sec->output_section->vma
    14361435                    + sym_sec->output_offset);
     
    15181517             be 4 or 8 bytes closer, but we don't know which just yet and
    15191518             the difference isn't significant enough to worry about.  */
    1520 #ifndef USE_REL /* put in for learning purposes */
     1519#if !USE_REL /* put in for learning purposes */
    15211520          pcrel_value += irel->r_addend;
    15221521#else
     
    15471546                     CODE currently must be a nop, but for cleanness we
    15481547                     allow it to be anything).  */
    1549 #ifndef USE_REL /* put in for learning purposes */
     1548#if !USE_REL /* put in for learning purposes */
    15501549                  code = 0x7e000000 | MAKE_PARALLEL (code);
    15511550#else
     
    15571556                {
    15581557                  /* Change the seth rN,foo to a bl24 foo.  */
    1559 #ifndef USE_REL /* put in for learning purposes */
     1558#if !USE_REL /* put in for learning purposes */
    15601559                  code = 0xfe000000;
    15611560#else
     
    15941593          /* Note that we've changed the relocs, section contents, etc.  */
    15951594          elf_section_data (sec)->relocs = internal_relocs;
    1596           free_relocs = NULL;
    1597 
    15981595          elf_section_data (sec)->this_hdr.contents = contents;
    1599           free_contents = NULL;
    1600 
    1601           symtab_hdr->contents = (bfd_byte *) extsyms;
    1602           free_extsyms = NULL;
     1596          symtab_hdr->contents = (unsigned char *) isymbuf;
    16031597
    16041598          /* Delete TO_DELETE bytes of data.  */
     
    16201614          /* That will change things, so we should relax again.
    16211615             Note that this is not required, and it may be slow.  */
    1622           *again = true;
     1616          *again = TRUE;
    16231617
    16241618          continue;
     
    16281622    }
    16291623
    1630   if (free_relocs != NULL)
    1631     {
    1632       free (free_relocs);
    1633       free_relocs = NULL;
    1634     }
    1635 
    1636   if (free_contents != NULL)
     1624  if (isymbuf != NULL
     1625      && symtab_hdr->contents != (unsigned char *) isymbuf)
    16371626    {
    16381627      if (! link_info->keep_memory)
    1639         free (free_contents);
     1628        free (isymbuf);
     1629      else
     1630        {
     1631          /* Cache the symbols for elf_link_input_bfd.  */
     1632          symtab_hdr->contents = (unsigned char *) isymbuf;
     1633        }
     1634    }
     1635
     1636  if (contents != NULL
     1637      && elf_section_data (sec)->this_hdr.contents != contents)
     1638    {
     1639      if (! link_info->keep_memory)
     1640        free (contents);
    16401641      else
    16411642        {
     
    16431644          elf_section_data (sec)->this_hdr.contents = contents;
    16441645        }
    1645       free_contents = NULL;
    1646     }
    1647 
    1648   if (free_extsyms != NULL)
    1649     {
    1650       if (! link_info->keep_memory)
    1651         free (free_extsyms);
    1652       else
    1653         {
    1654           /* Cache the symbols for elf_link_input_bfd.  */
    1655           symtab_hdr->contents = extsyms;
    1656         }
    1657       free_extsyms = NULL;
    1658     }
    1659 
    1660   return true;
     1646    }
     1647
     1648  if (internal_relocs != NULL
     1649      && elf_section_data (sec)->relocs != internal_relocs)
     1650    free (internal_relocs);
     1651
     1652  return TRUE;
    16611653
    16621654 error_return:
    1663   if (free_relocs != NULL)
    1664     free (free_relocs);
    1665   if (free_contents != NULL)
    1666     free (free_contents);
    1667   if (free_extsyms != NULL)
    1668     free (free_extsyms);
    1669   return false;
     1655  if (isymbuf != NULL
     1656      && symtab_hdr->contents != (unsigned char *) isymbuf)
     1657    free (isymbuf);
     1658  if (contents != NULL
     1659      && elf_section_data (sec)->this_hdr.contents != contents)
     1660    free (contents);
     1661  if (internal_relocs != NULL
     1662      && elf_section_data (sec)->relocs != internal_relocs)
     1663    free (internal_relocs);
     1664
     1665  return FALSE;
    16701666}
    16711667
    16721668/* Delete some bytes from a section while relaxing.  */
    16731669
    1674 static boolean
     1670static bfd_boolean
    16751671m32r_elf_relax_delete_bytes (abfd, sec, addr, count)
    16761672     bfd *abfd;
     
    16801676{
    16811677  Elf_Internal_Shdr *symtab_hdr;
    1682   Elf32_External_Sym *extsyms;
    1683   int shndx, index;
     1678  int shndx;
    16841679  bfd_byte *contents;
    16851680  Elf_Internal_Rela *irel, *irelend;
    16861681  Elf_Internal_Rela *irelalign;
    16871682  bfd_vma toaddr;
    1688   Elf32_External_Sym *esym, *esymend;
    1689   struct elf_link_hash_entry *sym_hash;
    1690 
    1691   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
    1692   extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
     1683  Elf_Internal_Sym *isym, *isymend;
     1684  struct elf_link_hash_entry **sym_hashes;
     1685  struct elf_link_hash_entry **end_hashes;
     1686  unsigned int symcount;
    16931687
    16941688  shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
     
    17191713
    17201714  /* Adjust the local symbols defined in this section.  */
    1721   esym = extsyms;
    1722   esymend = esym + symtab_hdr->sh_info;
    1723   for (; esym < esymend; esym++)
    1724     {
    1725       Elf_Internal_Sym isym;
    1726 
    1727       bfd_elf32_swap_symbol_in (abfd, esym, &isym);
    1728 
    1729       if (isym.st_shndx == shndx
    1730           && isym.st_value > addr
    1731           && isym.st_value < toaddr)
     1715  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
     1716  isym = (Elf_Internal_Sym *) symtab_hdr->contents;
     1717  for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++)
     1718    {
     1719      if (isym->st_shndx == shndx
     1720          && isym->st_value > addr
     1721          && isym->st_value < toaddr)
     1722        isym->st_value -= count;
     1723    }
     1724
     1725  /* Now adjust the global symbols defined in this section.  */
     1726  symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
     1727              - symtab_hdr->sh_info);
     1728  sym_hashes = elf_sym_hashes (abfd);
     1729  end_hashes = sym_hashes + symcount;
     1730  for (; sym_hashes < end_hashes; sym_hashes++)
     1731    {
     1732      struct elf_link_hash_entry *sym_hash = *sym_hashes;
     1733
     1734      if ((sym_hash->root.type == bfd_link_hash_defined
     1735           || sym_hash->root.type == bfd_link_hash_defweak)
     1736          && sym_hash->root.u.def.section == sec
     1737          && sym_hash->root.u.def.value > addr
     1738          && sym_hash->root.u.def.value < toaddr)
    17321739        {
    1733           isym.st_value -= count;
    1734           bfd_elf32_swap_symbol_out (abfd, &isym, esym);
     1740          sym_hash->root.u.def.value -= count;
    17351741        }
    17361742    }
    17371743
    1738   /* Now adjust the global symbols defined in this section.  */
    1739   esym = extsyms + symtab_hdr->sh_info;
    1740   esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym));
    1741   for (index = 0; esym < esymend; esym++, index++)
    1742     {
    1743       Elf_Internal_Sym isym;
    1744 
    1745       bfd_elf32_swap_symbol_in (abfd, esym, &isym);
    1746       sym_hash = elf_sym_hashes (abfd)[index];
    1747       if (isym.st_shndx == shndx
    1748           && ((sym_hash)->root.type == bfd_link_hash_defined
    1749               || (sym_hash)->root.type == bfd_link_hash_defweak)
    1750           && (sym_hash)->root.u.def.section == sec
    1751           && (sym_hash)->root.u.def.value > addr
    1752           && (sym_hash)->root.u.def.value < toaddr)
    1753         {
    1754           (sym_hash)->root.u.def.value -= count;
    1755         }
    1756     }
    1757 
    1758   return true;
     1744  return TRUE;
    17591745}
    17601746
     
    17691755     struct bfd_link_order *link_order;
    17701756     bfd_byte *data;
    1771      boolean relocateable;
     1757     bfd_boolean relocateable;
    17721758     asymbol **symbols;
    17731759{
     
    17771763  asection **sections = NULL;
    17781764  Elf_Internal_Rela *internal_relocs = NULL;
    1779   Elf32_External_Sym *external_syms = NULL;
    1780   Elf_Internal_Sym *internal_syms = NULL;
     1765  Elf_Internal_Sym *isymbuf = NULL;
     1766  bfd_size_type amt;
    17811767
    17821768  /* We only need to handle the case of relaxing, or of having a
     
    18011787      Elf32_External_Sym *esym, *esymend;
    18021788
    1803       if (symtab_hdr->contents != NULL)
    1804         external_syms = (Elf32_External_Sym *) symtab_hdr->contents;
    1805       else
     1789      internal_relocs = (_bfd_elf32_link_read_relocs
     1790                         (input_bfd, input_section, (PTR) NULL,
     1791                          (Elf_Internal_Rela *) NULL, FALSE));
     1792      if (internal_relocs == NULL)
     1793        goto error_return;
     1794
     1795      if (symtab_hdr->sh_info != 0)
    18061796        {
    1807           external_syms = ((Elf32_External_Sym *)
    1808                            bfd_malloc (symtab_hdr->sh_info
    1809                                        * sizeof (Elf32_External_Sym)));
    1810           if (external_syms == NULL && symtab_hdr->sh_info > 0)
    1811             goto error_return;
    1812           if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0
    1813               || (bfd_read (external_syms, sizeof (Elf32_External_Sym),
    1814                             symtab_hdr->sh_info, input_bfd)
    1815                   != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym))))
     1797          isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
     1798          if (isymbuf == NULL)
     1799            isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
     1800                                            symtab_hdr->sh_info, 0,
     1801                                            NULL, NULL, NULL);
     1802          if (isymbuf == NULL)
    18161803            goto error_return;
    18171804        }
    18181805
    1819       internal_relocs = (_bfd_elf32_link_read_relocs
    1820                          (input_bfd, input_section, (PTR) NULL,
    1821                           (Elf_Internal_Rela *) NULL, false));
    1822       if (internal_relocs == NULL)
    1823         goto error_return;
    1824 
    1825       internal_syms = ((Elf_Internal_Sym *)
    1826                        bfd_malloc (symtab_hdr->sh_info
    1827                                    * sizeof (Elf_Internal_Sym)));
    1828       if (internal_syms == NULL && symtab_hdr->sh_info > 0)
    1829         goto error_return;
    1830 
    1831       sections = (asection **) bfd_malloc (symtab_hdr->sh_info
    1832                                            * sizeof (asection *));
     1806      amt = symtab_hdr->sh_info;
     1807      amt *= sizeof (asection *);
     1808      sections = (asection **) bfd_malloc (amt);
    18331809      if (sections == NULL && symtab_hdr->sh_info > 0)
    18341810        goto error_return;
    18351811
    1836       isymp = internal_syms;
    1837       secpp = sections;
    1838       esym = external_syms;
    1839       esymend = esym + symtab_hdr->sh_info;
    1840       for (; esym < esymend; ++esym, ++isymp, ++secpp)
     1812      isymend = isymbuf + symtab_hdr->sh_info;
     1813      for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp)
    18411814        {
    18421815          asection *isec;
    18431816
    1844           bfd_elf32_swap_symbol_in (input_bfd, esym, isymp);
    1845 
    1846           if (isymp->st_shndx == SHN_UNDEF)
     1817          if (isym->st_shndx == SHN_UNDEF)
    18471818            isec = bfd_und_section_ptr;
    1848           else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE)
    1849             isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx);
    1850           else if (isymp->st_shndx == SHN_ABS)
     1819          else if (isym->st_shndx == SHN_ABS)
    18511820            isec = bfd_abs_section_ptr;
    1852           else if (isymp->st_shndx == SHN_COMMON)
     1821          else if (isym->st_shndx == SHN_COMMON)
    18531822            isec = bfd_com_section_ptr;
    1854           else if (isymp->st_shndx == SHN_M32R_SCOMMON)
     1823          else if (isym->st_shndx == SHN_M32R_SCOMMON)
    18551824            isec = &m32r_elf_scom_section;
    18561825          else
    1857             {
    1858               /* Who knows?  */
    1859               isec = NULL;
    1860             }
     1826            isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx);
    18611827
    18621828          *secpp = isec;
     
    18651831      if (! m32r_elf_relocate_section (output_bfd, link_info, input_bfd,
    18661832                                       input_section, data, internal_relocs,
    1867                                        internal_syms, sections))
     1833                                       isymbuf, sections))
    18681834        goto error_return;
    18691835
    18701836      if (sections != NULL)
    18711837        free (sections);
    1872       sections = NULL;
    1873       if (internal_syms != NULL)
    1874         free (internal_syms);
    1875       internal_syms = NULL;
    1876       if (external_syms != NULL && symtab_hdr->contents == NULL)
    1877         free (external_syms);
    1878       external_syms = NULL;
    1879       if (internal_relocs != elf_section_data (input_section)->relocs)
     1838      if (isymbuf != NULL
     1839          && symtab_hdr->contents != (unsigned char *) isymbuf)
     1840        free (isymbuf);
     1841      if (elf_section_data (input_section)->relocs != internal_relocs)
    18801842        free (internal_relocs);
    1881       internal_relocs = NULL;
    18821843    }
    18831844
     
    18851846
    18861847 error_return:
    1887   if (internal_relocs != NULL
    1888       && internal_relocs != elf_section_data (input_section)->relocs)
    1889     free (internal_relocs);
    1890   if (external_syms != NULL && symtab_hdr->contents == NULL)
    1891     free (external_syms);
    1892   if (internal_syms != NULL)
    1893     free (internal_syms);
    18941848  if (sections != NULL)
    18951849    free (sections);
     1850  if (isymbuf != NULL
     1851      && symtab_hdr->contents != (unsigned char *) isymbuf)
     1852    free (isymbuf);
     1853  if (internal_relocs != NULL
     1854      && elf_section_data (input_section)->relocs != internal_relocs)
     1855    free (internal_relocs);
    18961856  return NULL;
    18971857}
     
    19011861
    19021862/* Set the right machine number.  */
    1903 static boolean
     1863static bfd_boolean
    19041864m32r_elf_object_p (abfd)
    19051865     bfd *abfd;
     
    19111871    case E_M32RX_ARCH:  (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32rx); break;
    19121872    }
    1913   return true;
     1873  return TRUE;
    19141874}
    19151875
     
    19171877static void
    19181878m32r_elf_final_write_processing (abfd, linker)
    1919      bfd *   abfd;
    1920      boolean linker ATTRIBUTE_UNUSED;
     1879     bfd *abfd;
     1880     bfd_boolean linker ATTRIBUTE_UNUSED;
    19211881{
    19221882  unsigned long val;
     
    19341894
    19351895/* Function to keep M32R specific file flags.  */
    1936 static boolean
     1896static bfd_boolean
    19371897m32r_elf_set_private_flags (abfd, flags)
    1938      bfd *    abfd;
     1898     bfd *abfd;
    19391899     flagword flags;
    19401900{
     
    19431903
    19441904  elf_elfheader (abfd)->e_flags = flags;
    1945   elf_flags_init (abfd) = true;
    1946   return true;
    1947 }
    1948 
    1949 /* Copy backend specific data from one object module to another */
    1950 static boolean
    1951 m32r_elf_copy_private_bfd_data (ibfd, obfd)
    1952      bfd * ibfd;
    1953      bfd * obfd;
    1954 {
     1905  elf_flags_init (abfd) = TRUE;
     1906  return TRUE;
     1907}
     1908
     1909/* Merge backend specific data from an object file to the output
     1910   object file when linking.  */
     1911static bfd_boolean
     1912m32r_elf_merge_private_bfd_data (ibfd, obfd)
     1913     bfd *ibfd;
     1914     bfd *obfd;
     1915{
     1916  flagword out_flags;
     1917  flagword in_flags;
     1918
    19551919  if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
    19561920      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
    1957     return true;
    1958 
    1959   BFD_ASSERT (!elf_flags_init (obfd)
    1960               || (elf_elfheader (obfd)->e_flags
    1961                   == elf_elfheader (ibfd)->e_flags));
    1962 
    1963   elf_gp (obfd) = elf_gp (ibfd);
    1964   elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
    1965   elf_flags_init (obfd) = true;
    1966   return true;
    1967 }
    1968 
    1969 /* Merge backend specific data from an object file to the output
    1970    object file when linking.  */
    1971 static boolean
    1972 m32r_elf_merge_private_bfd_data (ibfd, obfd)
    1973      bfd * ibfd;
    1974      bfd * obfd;
    1975 {
    1976   flagword out_flags;
    1977   flagword in_flags;
    1978 
    1979   if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
    1980       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
    1981     return true;
     1921    return TRUE;
    19821922
    19831923  in_flags  = elf_elfheader (ibfd)->e_flags;
     
    19931933         to the default values.  */
    19941934      if (bfd_get_arch_info (ibfd)->the_default)
    1995         return true;
    1996 
    1997       elf_flags_init (obfd) = true;
     1935        return TRUE;
     1936
     1937      elf_flags_init (obfd) = TRUE;
    19981938      elf_elfheader (obfd)->e_flags = in_flags;
    19991939
     
    20041944        }
    20051945
    2006       return true;
     1946      return TRUE;
    20071947    }
    20081948
    20091949  /* Check flag compatibility.  */
    20101950  if (in_flags == out_flags)
    2011     return true;
     1951    return TRUE;
    20121952
    20131953  if ((in_flags & EF_M32R_ARCH) != (out_flags & EF_M32R_ARCH))
     
    20151955      if ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH)
    20161956        {
    2017           _bfd_error_handler (_("%s: Instruction set mismatch with previous modules"),
    2018                               bfd_get_filename (ibfd));
     1957          (*_bfd_error_handler)
     1958            (_("%s: Instruction set mismatch with previous modules"),
     1959             bfd_archive_filename (ibfd));
    20191960
    20201961          bfd_set_error (bfd_error_bad_value);
    2021           return false;
     1962          return FALSE;
    20221963        }
    20231964    }
    20241965
    2025   return true;
     1966  return TRUE;
    20261967}
    20271968
    20281969/* Display the flags field */
    2029 static boolean
     1970static bfd_boolean
    20301971m32r_elf_print_private_bfd_data (abfd, ptr)
    2031      bfd *   abfd;
    2032      PTR     ptr;
     1972     bfd *abfd;
     1973     PTR ptr;
    20331974{
    20341975  FILE * file = (FILE *) ptr;
     
    20491990  fputc ('\n', file);
    20501991
    2051   return true;
     1992  return TRUE;
    20521993}
    20531994
    20541995asection *
    2055 m32r_elf_gc_mark_hook (abfd, info, rel, h, sym)
    2056        bfd *abfd;
    2057        struct bfd_link_info *info ATTRIBUTE_UNUSED;
    2058        Elf_Internal_Rela *rel;
    2059        struct elf_link_hash_entry *h;
    2060        Elf_Internal_Sym *sym;
     1996m32r_elf_gc_mark_hook (sec, info, rel, h, sym)
     1997     asection *sec;
     1998     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     1999     Elf_Internal_Rela *rel;
     2000     struct elf_link_hash_entry *h;
     2001     Elf_Internal_Sym *sym;
    20612002{
    20622003  if (h != NULL)
     
    20842025     }
    20852026   else
    2086      {
    2087        if (!(elf_bad_symtab (abfd)
    2088            && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
    2089          && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
    2090                 && sym->st_shndx != SHN_COMMON))
    2091           {
    2092             return bfd_section_from_elf_index (abfd, sym->st_shndx);
    2093           }
    2094       }
     2027     return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
     2028
    20952029  return NULL;
    20962030}
    20972031
    2098 static boolean
     2032static bfd_boolean
    20992033m32r_elf_gc_sweep_hook (abfd, info, sec, relocs)
    21002034     bfd *abfd ATTRIBUTE_UNUSED;
     
    21042038{
    21052039  /* we don't use got and plt entries for m32r */
    2106   return true;
     2040  return TRUE;
    21072041}
    21082042
     
    21112045   virtual table relocs for gc.  */
    21122046
    2113 static boolean
     2047static bfd_boolean
    21142048m32r_elf_check_relocs (abfd, info, sec, relocs)
    21152049     bfd *abfd;
     
    21242058
    21252059  if (info->relocateable)
    2126     return true;
     2060    return TRUE;
    21272061
    21282062  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
     
    21502084        case R_M32R_GNU_VTINHERIT:
    21512085          if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
    2152             return false;
     2086            return FALSE;
    21532087          break;
    21542088
     
    21572091        case R_M32R_GNU_VTENTRY:
    21582092          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_offset))
    2159             return false;
     2093            return FALSE;
    21602094          break;
    21612095        }
    21622096    }
    21632097
    2164   return true;
     2098  return TRUE;
    21652099}
    21662100
    21672101
    21682102#define ELF_ARCH                bfd_arch_m32r
    2169 #define ELF_MACHINE_CODE        EM_CYGNUS_M32R
     2103#define ELF_MACHINE_CODE        EM_M32R
     2104#define ELF_MACHINE_ALT1        EM_CYGNUS_M32R
    21702105#define ELF_MAXPAGESIZE         0x1 /* Explicitly requested by Mitsubishi.  */
    21712106
     
    21842119
    21852120#define elf_backend_can_gc_sections             1
     2121#if !USE_REL
     2122#define elf_backend_rela_normal                 1
     2123#endif
    21862124#if 0 /* not yet */
    21872125/* relax support */
     
    21932131#define elf_backend_object_p                    m32r_elf_object_p
    21942132#define elf_backend_final_write_processing      m32r_elf_final_write_processing
    2195 #define bfd_elf32_bfd_copy_private_bfd_data     m32r_elf_copy_private_bfd_data
    21962133#define bfd_elf32_bfd_merge_private_bfd_data    m32r_elf_merge_private_bfd_data
    21972134#define bfd_elf32_bfd_set_private_flags         m32r_elf_set_private_flags
Note: See TracChangeset for help on using the changeset viewer.