Back to index

cell-binutils  2.17cvs20070401
elf32-i860.c
Go to the documentation of this file.
00001 /* Intel i860 specific support for 32-bit ELF.
00002    Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
00003    Free Software Foundation, Inc.
00004 
00005    Full i860 support contributed by Jason Eckhardt <jle@cygnus.com>.
00006 
00007 This file is part of BFD, the Binary File Descriptor library.
00008 
00009 This program is free software; you can redistribute it and/or modify
00010 it under the terms of the GNU General Public License as published by
00011 the Free Software Foundation; either version 2 of the License, or
00012 (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00022 
00023 #include "bfd.h"
00024 #include "sysdep.h"
00025 #include "libbfd.h"
00026 #include "elf-bfd.h"
00027 #include "elf/i860.h"
00028 
00029 /* special_function for R_860_PC26 relocation.  */
00030 static bfd_reloc_status_type
00031 i860_howto_pc26_reloc (bfd *abfd ATTRIBUTE_UNUSED,
00032                        arelent *reloc_entry,
00033                        asymbol *symbol,
00034                        void *data ATTRIBUTE_UNUSED,
00035                        asection *input_section,
00036                        bfd *output_bfd,
00037                        char **error_message ATTRIBUTE_UNUSED)
00038 {
00039   bfd_vma insn;
00040   bfd_vma relocation;
00041   bfd_byte *addr;
00042 
00043   if (output_bfd != NULL
00044       && (symbol->flags & BSF_SECTION_SYM) == 0
00045       && (! reloc_entry->howto->partial_inplace
00046          || reloc_entry->addend == 0))
00047     {
00048       reloc_entry->address += input_section->output_offset;
00049       return bfd_reloc_ok;
00050     }
00051 
00052   /* Used elf32-mips.c as an example.  */
00053   if (bfd_is_und_section (symbol->section)
00054       && output_bfd == (bfd *) NULL)
00055     return bfd_reloc_undefined;
00056 
00057   if (bfd_is_com_section (symbol->section))
00058     relocation = 0;
00059   else
00060     relocation = symbol->value;
00061 
00062   relocation += symbol->section->output_section->vma;
00063   relocation += symbol->section->output_offset;
00064   relocation += reloc_entry->addend;
00065 
00066   if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
00067     return bfd_reloc_outofrange;
00068 
00069   /* Adjust for PC-relative relocation.  */
00070   relocation -= (input_section->output_section->vma
00071                  + input_section->output_offset
00072                  + reloc_entry->address
00073                  + 4);
00074 
00075   /* Check for target out of range.  */
00076   if ((bfd_signed_vma)relocation > (0x3ffffff << 2)
00077       || (bfd_signed_vma)relocation < (-0x4000000 << 2))
00078     return bfd_reloc_outofrange;
00079 
00080   addr = (bfd_byte *) data + reloc_entry->address;
00081   insn = bfd_get_32 (abfd, addr);
00082 
00083   relocation >>= reloc_entry->howto->rightshift;
00084   insn = (insn & ~reloc_entry->howto->dst_mask)
00085          | (relocation & reloc_entry->howto->dst_mask);
00086 
00087   bfd_put_32 (abfd, (bfd_vma) insn, addr);
00088 
00089   return bfd_reloc_ok;
00090 }
00091 
00092 /* special_function for R_860_PC16 relocation.  */
00093 static bfd_reloc_status_type
00094 i860_howto_pc16_reloc (bfd *abfd,
00095                        arelent *reloc_entry,
00096                        asymbol *symbol,
00097                        void *data,
00098                        asection *input_section,
00099                        bfd *output_bfd,
00100                        char **error_message ATTRIBUTE_UNUSED)
00101 {
00102   bfd_vma insn;
00103   bfd_vma relocation;
00104   bfd_byte *addr;
00105 
00106   if (output_bfd != NULL
00107       && (symbol->flags & BSF_SECTION_SYM) == 0
00108       && (! reloc_entry->howto->partial_inplace
00109          || reloc_entry->addend == 0))
00110     {
00111       reloc_entry->address += input_section->output_offset;
00112       return bfd_reloc_ok;
00113     }
00114 
00115   /* Used elf32-mips.c as an example.  */
00116   if (bfd_is_und_section (symbol->section)
00117       && output_bfd == (bfd *) NULL)
00118     return bfd_reloc_undefined;
00119 
00120   if (bfd_is_com_section (symbol->section))
00121     relocation = 0;
00122   else
00123     relocation = symbol->value;
00124 
00125   relocation += symbol->section->output_section->vma;
00126   relocation += symbol->section->output_offset;
00127   relocation += reloc_entry->addend;
00128 
00129   if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
00130     return bfd_reloc_outofrange;
00131 
00132   /* Adjust for PC-relative relocation.  */
00133   relocation -= (input_section->output_section->vma
00134                  + input_section->output_offset
00135                  + reloc_entry->address
00136                  + 4);
00137 
00138   /* Check for target out of range.  */
00139   if ((bfd_signed_vma)relocation > (0x7fff << 2)
00140       || (bfd_signed_vma)relocation < (-0x8000 << 2))
00141     return bfd_reloc_outofrange;
00142 
00143   addr = (bfd_byte *) data + reloc_entry->address;
00144   insn = bfd_get_32 (abfd, addr);
00145 
00146   relocation >>= reloc_entry->howto->rightshift;
00147   relocation = (((relocation & 0xf800) << 5) | (relocation & 0x7ff))
00148                & reloc_entry->howto->dst_mask;
00149   insn = (insn & ~reloc_entry->howto->dst_mask) | relocation;
00150 
00151   bfd_put_32 (abfd, (bfd_vma) insn, addr);
00152 
00153   return bfd_reloc_ok;
00154 }
00155 
00156 /* special_function for R_860_HIGHADJ relocation.  */
00157 static bfd_reloc_status_type
00158 i860_howto_highadj_reloc (bfd *abfd,
00159                           arelent *reloc_entry,
00160                           asymbol *symbol,
00161                           void *data,
00162                           asection *input_section,
00163                           bfd *output_bfd,
00164                           char **error_message ATTRIBUTE_UNUSED)
00165 {
00166   bfd_vma insn;
00167   bfd_vma relocation;
00168   bfd_byte *addr;
00169 
00170   if (output_bfd != NULL
00171       && (symbol->flags & BSF_SECTION_SYM) == 0
00172       && (! reloc_entry->howto->partial_inplace
00173          || reloc_entry->addend == 0))
00174     {
00175       reloc_entry->address += input_section->output_offset;
00176       return bfd_reloc_ok;
00177     }
00178 
00179   /* Used elf32-mips.c as an example.  */
00180   if (bfd_is_und_section (symbol->section)
00181       && output_bfd == (bfd *) NULL)
00182     return bfd_reloc_undefined;
00183 
00184   if (bfd_is_com_section (symbol->section))
00185     relocation = 0;
00186   else
00187     relocation = symbol->value;
00188 
00189   relocation += symbol->section->output_section->vma;
00190   relocation += symbol->section->output_offset;
00191   relocation += reloc_entry->addend;
00192   relocation += 0x8000;
00193 
00194   if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
00195     return bfd_reloc_outofrange;
00196 
00197   addr = (bfd_byte *) data + reloc_entry->address;
00198   insn = bfd_get_32 (abfd, addr);
00199 
00200   relocation = ((relocation >> 16) & 0xffff);
00201 
00202   insn = (insn & 0xffff0000) | relocation;
00203 
00204   bfd_put_32 (abfd, (bfd_vma) insn, addr);
00205 
00206   return bfd_reloc_ok;
00207 }
00208 
00209 /* special_function for R_860_SPLITn relocations.  */
00210 static bfd_reloc_status_type
00211 i860_howto_splitn_reloc (bfd *abfd,
00212                          arelent *reloc_entry,
00213                          asymbol *symbol,
00214                          void *data,
00215                          asection *input_section,
00216                          bfd *output_bfd,
00217                          char **error_message ATTRIBUTE_UNUSED)
00218 {
00219   bfd_vma insn;
00220   bfd_vma relocation;
00221   bfd_byte *addr;
00222 
00223   if (output_bfd != NULL
00224       && (symbol->flags & BSF_SECTION_SYM) == 0
00225       && (! reloc_entry->howto->partial_inplace
00226          || reloc_entry->addend == 0))
00227     {
00228       reloc_entry->address += input_section->output_offset;
00229       return bfd_reloc_ok;
00230     }
00231 
00232   /* Used elf32-mips.c as an example.  */
00233   if (bfd_is_und_section (symbol->section)
00234       && output_bfd == (bfd *) NULL)
00235     return bfd_reloc_undefined;
00236 
00237   if (bfd_is_com_section (symbol->section))
00238     relocation = 0;
00239   else
00240     relocation = symbol->value;
00241 
00242   relocation += symbol->section->output_section->vma;
00243   relocation += symbol->section->output_offset;
00244   relocation += reloc_entry->addend;
00245 
00246   if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
00247     return bfd_reloc_outofrange;
00248 
00249   addr = (bfd_byte *) data + reloc_entry->address;
00250   insn = bfd_get_32 (abfd, addr);
00251 
00252   relocation = (((relocation & 0xf800) << 5) | (relocation & 0x7ff))
00253                & reloc_entry->howto->dst_mask;
00254   insn = (insn & ~reloc_entry->howto->dst_mask) | relocation;
00255 
00256   bfd_put_32 (abfd, (bfd_vma) insn, addr);
00257 
00258   return bfd_reloc_ok;
00259 }
00260 
00261 /* This howto table is preliminary.  */
00262 static reloc_howto_type elf32_i860_howto_table [] =
00263 {
00264   /* This relocation does nothing.  */
00265   HOWTO (R_860_NONE,        /* type */
00266         0,                  /* rightshift */
00267         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00268         32,                 /* bitsize */
00269         FALSE,                     /* pc_relative */
00270         0,                  /* bitpos */
00271         complain_overflow_bitfield, /* complain_on_overflow */
00272         bfd_elf_generic_reloc,     /* special_function */
00273         "R_860_NONE",              /* name */
00274         FALSE,                     /* partial_inplace */
00275         0,                  /* src_mask */
00276         0,                  /* dst_mask */
00277         FALSE),             /* pcrel_offset */
00278 
00279   /* A 32-bit absolute relocation.  */
00280   HOWTO (R_860_32,          /* type */
00281         0,                  /* rightshift */
00282         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00283         32,                 /* bitsize */
00284         FALSE,                     /* pc_relative */
00285         0,                  /* bitpos */
00286         complain_overflow_bitfield, /* complain_on_overflow */
00287         bfd_elf_generic_reloc,     /* special_function */
00288         "R_860_32",         /* name */
00289         FALSE,                     /* partial_inplace */
00290         0xffffffff,         /* src_mask */
00291         0xffffffff,         /* dst_mask */
00292         FALSE),             /* pcrel_offset */
00293 
00294   HOWTO (R_860_COPY,        /* type */
00295         0,                  /* rightshift */
00296         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00297         32,                 /* bitsize */
00298         FALSE,                     /* pc_relative */
00299         0,                  /* bitpos */
00300         complain_overflow_bitfield, /* complain_on_overflow */
00301         bfd_elf_generic_reloc,     /* special_function */
00302         "R_860_COPY",              /* name */
00303         TRUE,               /* partial_inplace */
00304         0xffffffff,         /* src_mask */
00305         0xffffffff,         /* dst_mask */
00306         FALSE),             /* pcrel_offset */
00307 
00308   HOWTO (R_860_GLOB_DAT,    /* type */
00309         0,                  /* rightshift */
00310         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00311         32,                 /* bitsize */
00312         FALSE,                     /* pc_relative */
00313         0,                  /* bitpos */
00314         complain_overflow_bitfield, /* complain_on_overflow */
00315         bfd_elf_generic_reloc,     /* special_function */
00316         "R_860_GLOB_DAT",   /* name */
00317         TRUE,               /* partial_inplace */
00318         0xffffffff,         /* src_mask */
00319         0xffffffff,         /* dst_mask */
00320         FALSE),             /* pcrel_offset */
00321 
00322   HOWTO (R_860_JUMP_SLOT,   /* type */
00323         0,                  /* rightshift */
00324         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00325         32,                 /* bitsize */
00326         FALSE,                     /* pc_relative */
00327         0,                  /* bitpos */
00328         complain_overflow_bitfield, /* complain_on_overflow */
00329         bfd_elf_generic_reloc,     /* special_function */
00330         "R_860_JUMP_SLOT",  /* name */
00331         TRUE,               /* partial_inplace */
00332         0xffffffff,         /* src_mask */
00333         0xffffffff,         /* dst_mask */
00334         FALSE),             /* pcrel_offset */
00335 
00336   HOWTO (R_860_RELATIVE,    /* type */
00337         0,                  /* rightshift */
00338         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00339         32,                 /* bitsize */
00340         FALSE,                     /* pc_relative */
00341         0,                  /* bitpos */
00342         complain_overflow_bitfield, /* complain_on_overflow */
00343         bfd_elf_generic_reloc,     /* special_function */
00344         "R_860_RELATIVE",   /* name */
00345         TRUE,               /* partial_inplace */
00346         0xffffffff,         /* src_mask */
00347         0xffffffff,         /* dst_mask */
00348         FALSE),             /* pcrel_offset */
00349 
00350   /* A 26-bit PC-relative relocation.  */
00351   HOWTO (R_860_PC26,         /* type */
00352         2,                  /* rightshift */
00353         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00354         26,                 /* bitsize */
00355         TRUE,               /* pc_relative */
00356         0,                  /* bitpos */
00357         complain_overflow_bitfield, /* complain_on_overflow */
00358         i860_howto_pc26_reloc,     /* special_function */
00359         "R_860_PC26",              /* name */
00360         FALSE,                     /* partial_inplace */
00361         0x3ffffff,          /* src_mask */
00362         0x3ffffff,          /* dst_mask */
00363         TRUE),                      /* pcrel_offset */
00364 
00365   HOWTO (R_860_PLT26,               /* type */
00366         0,                  /* rightshift */
00367         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00368         26,                 /* bitsize */
00369         TRUE,               /* pc_relative */
00370         0,                  /* bitpos */
00371         complain_overflow_bitfield, /* complain_on_overflow */
00372         bfd_elf_generic_reloc,     /* special_function */
00373         "R_860_PLT26",             /* name */
00374         TRUE,               /* partial_inplace */
00375         0xffffffff,         /* src_mask */
00376         0xffffffff,         /* dst_mask */
00377         TRUE),                      /* pcrel_offset */
00378 
00379   /* A 16-bit PC-relative relocation.  */
00380   HOWTO (R_860_PC16,         /* type */
00381         2,                  /* rightshift */
00382         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00383         16,                 /* bitsize */
00384         TRUE,               /* pc_relative */
00385         0,                  /* bitpos */
00386         complain_overflow_bitfield, /* complain_on_overflow */
00387         i860_howto_pc16_reloc,     /* special_function */
00388         "R_860_PC16",              /* name */
00389         FALSE,                     /* partial_inplace */
00390         0x1f07ff,           /* src_mask */
00391         0x1f07ff,           /* dst_mask */
00392         TRUE),                      /* pcrel_offset */
00393 
00394   HOWTO (R_860_LOW0,         /* type */
00395         0,                  /* rightshift */
00396         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00397         16,                 /* bitsize */
00398         FALSE,                     /* pc_relative */
00399         0,                  /* bitpos */
00400         complain_overflow_dont, /* complain_on_overflow */
00401         bfd_elf_generic_reloc,     /* special_function */
00402         "R_860_LOW0",              /* name */
00403         FALSE,                     /* partial_inplace */
00404         0xffff,             /* src_mask */
00405         0xffff,             /* dst_mask */
00406         FALSE),              /* pcrel_offset */
00407 
00408   HOWTO (R_860_SPLIT0,              /* type */
00409         0,                  /* rightshift */
00410         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00411         16,                 /* bitsize */
00412         FALSE,                     /* pc_relative */
00413         0,                  /* bitpos */
00414         complain_overflow_dont, /* complain_on_overflow */
00415         i860_howto_splitn_reloc, /* special_function */
00416         "R_860_SPLIT0",     /* name */
00417         FALSE,                     /* partial_inplace */
00418         0x1f07ff,           /* src_mask */
00419         0x1f07ff,           /* dst_mask */
00420         FALSE),              /* pcrel_offset */
00421 
00422   HOWTO (R_860_LOW1,         /* type */
00423         0,                  /* rightshift */
00424         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00425         16,                 /* bitsize */
00426         FALSE,                     /* pc_relative */
00427         0,                  /* bitpos */
00428         complain_overflow_dont, /* complain_on_overflow */
00429         bfd_elf_generic_reloc,     /* special_function */
00430         "R_860_LOW1",              /* name */
00431         FALSE,                     /* partial_inplace */
00432         0xfffe,             /* src_mask */
00433         0xfffe,             /* dst_mask */
00434         FALSE),              /* pcrel_offset */
00435 
00436   HOWTO (R_860_SPLIT1,              /* type */
00437         0,                  /* rightshift */
00438         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00439         16,                 /* bitsize */
00440         FALSE,                     /* pc_relative */
00441         0,                  /* bitpos */
00442         complain_overflow_dont, /* complain_on_overflow */
00443         i860_howto_splitn_reloc, /* special_function */
00444         "R_860_SPLIT1",     /* name */
00445         FALSE,                     /* partial_inplace */
00446         0x1f07fe,           /* src_mask */
00447         0x1f07fe,           /* dst_mask */
00448         FALSE),              /* pcrel_offset */
00449 
00450   HOWTO (R_860_LOW2,         /* type */
00451         0,                  /* rightshift */
00452         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00453         16,                 /* bitsize */
00454         FALSE,                     /* pc_relative */
00455         0,                  /* bitpos */
00456         complain_overflow_dont, /* complain_on_overflow */
00457         bfd_elf_generic_reloc,     /* special_function */
00458         "R_860_LOW2",              /* name */
00459         FALSE,                     /* partial_inplace */
00460         0xfffc,             /* src_mask */
00461         0xfffc,             /* dst_mask */
00462         FALSE),              /* pcrel_offset */
00463 
00464   HOWTO (R_860_SPLIT2,              /* type */
00465         0,                  /* rightshift */
00466         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00467         16,                 /* bitsize */
00468         FALSE,                     /* pc_relative */
00469         0,                  /* bitpos */
00470         complain_overflow_dont, /* complain_on_overflow */
00471         i860_howto_splitn_reloc, /* special_function */
00472         "R_860_SPLIT2",     /* name */
00473         FALSE,                     /* partial_inplace */
00474         0x1f07fc,           /* src_mask */
00475         0x1f07fc,           /* dst_mask */
00476         FALSE),              /* pcrel_offset */
00477 
00478   HOWTO (R_860_LOW3,         /* type */
00479         0,                  /* rightshift */
00480         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00481         16,                 /* bitsize */
00482         FALSE,                     /* pc_relative */
00483         0,                  /* bitpos */
00484         complain_overflow_dont, /* complain_on_overflow */
00485         bfd_elf_generic_reloc,     /* special_function */
00486         "R_860_LOW3",              /* name */
00487         FALSE,                     /* partial_inplace */
00488         0xfff8,             /* src_mask */
00489         0xfff8,             /* dst_mask */
00490         FALSE),              /* pcrel_offset */
00491 
00492   HOWTO (R_860_LOGOT0,              /* type */
00493         0,                  /* rightshift */
00494         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00495         16,                 /* bitsize */
00496         FALSE,                     /* pc_relative */
00497         0,                  /* bitpos */
00498         complain_overflow_dont, /* complain_on_overflow */
00499         bfd_elf_generic_reloc,     /* special_function */
00500         "R_860_LOGOT0",     /* name */
00501         FALSE,                     /* partial_inplace */
00502         0,                  /* src_mask */
00503         0xffff,             /* dst_mask */
00504         TRUE),                      /* pcrel_offset */
00505 
00506   HOWTO (R_860_SPGOT0,              /* type */
00507         0,                  /* rightshift */
00508         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00509         16,                 /* bitsize */
00510         FALSE,                     /* pc_relative */
00511         0,                  /* bitpos */
00512         complain_overflow_dont, /* complain_on_overflow */
00513         bfd_elf_generic_reloc,     /* special_function */
00514         "R_860_SPGOT0",     /* name */
00515         FALSE,                     /* partial_inplace */
00516         0,                  /* src_mask */
00517         0xffff,             /* dst_mask */
00518         TRUE),                      /* pcrel_offset */
00519 
00520   HOWTO (R_860_LOGOT1,              /* type */
00521         0,                  /* rightshift */
00522         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00523         16,                 /* bitsize */
00524         FALSE,                     /* pc_relative */
00525         0,                  /* bitpos */
00526         complain_overflow_dont, /* complain_on_overflow */
00527         bfd_elf_generic_reloc,     /* special_function */
00528         "R_860_LOGOT1",     /* name */
00529         FALSE,                     /* partial_inplace */
00530         0,                  /* src_mask */
00531         0xffff,             /* dst_mask */
00532         TRUE),                      /* pcrel_offset */
00533 
00534   HOWTO (R_860_SPGOT1,              /* type */
00535         0,                  /* rightshift */
00536         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00537         16,                 /* bitsize */
00538         FALSE,                     /* pc_relative */
00539         0,                  /* bitpos */
00540         complain_overflow_dont, /* complain_on_overflow */
00541         bfd_elf_generic_reloc,     /* special_function */
00542         "R_860_SPGOT1",     /* name */
00543         FALSE,                     /* partial_inplace */
00544         0,                  /* src_mask */
00545         0xffff,             /* dst_mask */
00546         TRUE),                      /* pcrel_offset */
00547 
00548   HOWTO (R_860_LOGOTOFF0,        /* type */
00549         0,                  /* rightshift */
00550         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00551         32,                 /* bitsize */
00552         FALSE,                     /* pc_relative */
00553         0,                  /* bitpos */
00554         complain_overflow_dont, /* complain_on_overflow */
00555         bfd_elf_generic_reloc,     /* special_function */
00556         "R_860_LOGOTOFF0",  /* name */
00557         TRUE,               /* partial_inplace */
00558         0xffffffff,         /* src_mask */
00559         0xffffffff,         /* dst_mask */
00560         FALSE),              /* pcrel_offset */
00561 
00562   HOWTO (R_860_SPGOTOFF0,        /* type */
00563         0,                  /* rightshift */
00564         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00565         32,                 /* bitsize */
00566         FALSE,                     /* pc_relative */
00567         0,                  /* bitpos */
00568         complain_overflow_dont, /* complain_on_overflow */
00569         bfd_elf_generic_reloc,     /* special_function */
00570         "R_860_SPGOTOFF0",  /* name */
00571         TRUE,               /* partial_inplace */
00572         0xffffffff,         /* src_mask */
00573         0xffffffff,         /* dst_mask */
00574         FALSE),              /* pcrel_offset */
00575 
00576   HOWTO (R_860_LOGOTOFF1,        /* type */
00577         0,                  /* rightshift */
00578         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00579         32,                 /* bitsize */
00580         FALSE,                     /* pc_relative */
00581         0,                  /* bitpos */
00582         complain_overflow_dont, /* complain_on_overflow */
00583         bfd_elf_generic_reloc,     /* special_function */
00584         "R_860_LOGOTOFF1",  /* name */
00585         TRUE,               /* partial_inplace */
00586         0xffffffff,         /* src_mask */
00587         0xffffffff,         /* dst_mask */
00588         FALSE),              /* pcrel_offset */
00589 
00590   HOWTO (R_860_SPGOTOFF1,       /* type */
00591         0,                  /* rightshift */
00592         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00593         32,                 /* bitsize */
00594         FALSE,                     /* pc_relative */
00595         0,                  /* bitpos */
00596         complain_overflow_dont, /* complain_on_overflow */
00597         bfd_elf_generic_reloc,     /* special_function */
00598         "R_860_SPGOTOFF1",  /* name */
00599         TRUE,               /* partial_inplace */
00600         0xffffffff,         /* src_mask */
00601         0xffffffff,         /* dst_mask */
00602         FALSE),              /* pcrel_offset */
00603 
00604   HOWTO (R_860_LOGOTOFF2,        /* type */
00605         0,                  /* rightshift */
00606         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00607         32,                 /* bitsize */
00608         FALSE,                     /* pc_relative */
00609         0,                  /* bitpos */
00610         complain_overflow_dont, /* complain_on_overflow */
00611         bfd_elf_generic_reloc,     /* special_function */
00612         "R_860_LOGOTOFF2",  /* name */
00613         TRUE,               /* partial_inplace */
00614         0xffffffff,         /* src_mask */
00615         0xffffffff,         /* dst_mask */
00616         FALSE),              /* pcrel_offset */
00617 
00618   HOWTO (R_860_LOGOTOFF3,        /* type */
00619         0,                  /* rightshift */
00620         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00621         32,                 /* bitsize */
00622         FALSE,                     /* pc_relative */
00623         0,                  /* bitpos */
00624         complain_overflow_dont, /* complain_on_overflow */
00625         bfd_elf_generic_reloc,     /* special_function */
00626         "R_860_LOGOTOFF3",  /* name */
00627         TRUE,               /* partial_inplace */
00628         0xffffffff,         /* src_mask */
00629         0xffffffff,         /* dst_mask */
00630         FALSE),              /* pcrel_offset */
00631 
00632   HOWTO (R_860_LOPC,         /* type */
00633         0,                  /* rightshift */
00634         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00635         16,                 /* bitsize */
00636         TRUE,               /* pc_relative */
00637         0,                  /* bitpos */
00638         complain_overflow_bitfield, /* complain_on_overflow */
00639         bfd_elf_generic_reloc,     /* special_function */
00640         "R_860_LOPC",              /* name */
00641         FALSE,                     /* partial_inplace */
00642         0xffff,             /* src_mask */
00643         0xffff,             /* dst_mask */
00644         TRUE),                      /* pcrel_offset */
00645 
00646   HOWTO (R_860_HIGHADJ,             /* type */
00647         0,                  /* rightshift */
00648         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00649         16,                 /* bitsize */
00650         FALSE,                     /* pc_relative */
00651         0,                  /* bitpos */
00652         complain_overflow_dont, /* complain_on_overflow */
00653         i860_howto_highadj_reloc, /* special_function */
00654         "R_860_HIGHADJ",    /* name */
00655         FALSE,                     /* partial_inplace */
00656         0xffff,             /* src_mask */
00657         0xffff,             /* dst_mask */
00658         FALSE),              /* pcrel_offset */
00659 
00660   HOWTO (R_860_HAGOT,               /* type */
00661         0,                  /* rightshift */
00662         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00663         16,                 /* bitsize */
00664         FALSE,                     /* pc_relative */
00665         0,                  /* bitpos */
00666         complain_overflow_dont, /* complain_on_overflow */
00667         bfd_elf_generic_reloc,     /* special_function */
00668         "R_860_HAGOT",             /* name */
00669         FALSE,                     /* partial_inplace */
00670         0,                  /* src_mask */
00671         0xffff,             /* dst_mask */
00672         TRUE),                      /* pcrel_offset */
00673 
00674   HOWTO (R_860_HAGOTOFF,        /* type */
00675         0,                  /* rightshift */
00676         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00677         32,                 /* bitsize */
00678         FALSE,                     /* pc_relative */
00679         0,                  /* bitpos */
00680         complain_overflow_dont, /* complain_on_overflow */
00681         bfd_elf_generic_reloc,     /* special_function */
00682         "R_860_HAGOTOFF",   /* name */
00683         TRUE,               /* partial_inplace */
00684         0xffffffff,         /* src_mask */
00685         0xffffffff,         /* dst_mask */
00686         FALSE),              /* pcrel_offset */
00687 
00688   HOWTO (R_860_HAPC,         /* type */
00689         0,                  /* rightshift */
00690         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00691         16,                 /* bitsize */
00692         TRUE,               /* pc_relative */
00693         0,                  /* bitpos */
00694         complain_overflow_bitfield, /* complain_on_overflow */
00695         bfd_elf_generic_reloc,     /* special_function */
00696         "R_860_HAPC",              /* name */
00697         FALSE,                     /* partial_inplace */
00698         0xffff,             /* src_mask */
00699         0xffff,             /* dst_mask */
00700         TRUE),                      /* pcrel_offset */
00701 
00702   HOWTO (R_860_HIGH,         /* type */
00703         16,                 /* rightshift */
00704         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00705         16,                 /* bitsize */
00706         FALSE,                     /* pc_relative */
00707         0,                  /* bitpos */
00708         complain_overflow_dont, /* complain_on_overflow */
00709         bfd_elf_generic_reloc,     /* special_function */
00710         "R_860_HIGH",              /* name */
00711         FALSE,                     /* partial_inplace */
00712         0xffff,             /* src_mask */
00713         0xffff,             /* dst_mask */
00714         FALSE),              /* pcrel_offset */
00715 
00716   HOWTO (R_860_HIGOT,               /* type */
00717         0,                  /* rightshift */
00718         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00719         16,                 /* bitsize */
00720         FALSE,                     /* pc_relative */
00721         0,                  /* bitpos */
00722         complain_overflow_dont, /* complain_on_overflow */
00723         bfd_elf_generic_reloc,     /* special_function */
00724         "R_860_HIGOT",             /* name */
00725         FALSE,                     /* partial_inplace */
00726         0,                  /* src_mask */
00727         0xffff,             /* dst_mask */
00728         TRUE),                      /* pcrel_offset */
00729 
00730   HOWTO (R_860_HIGOTOFF,        /* type */
00731         0,                  /* rightshift */
00732         2,                  /* size (0 = byte, 1 = short, 2 = long) */
00733         32,                 /* bitsize */
00734         FALSE,                     /* pc_relative */
00735         0,                  /* bitpos */
00736         complain_overflow_dont, /* complain_on_overflow */
00737         bfd_elf_generic_reloc,     /* special_function */
00738         "R_860_HIGOTOFF",   /* name */
00739         TRUE,               /* partial_inplace */
00740         0xffffffff,         /* src_mask */
00741         0xffffffff,         /* dst_mask */
00742         FALSE),              /* pcrel_offset */
00743 };
00744 
00745 static unsigned char elf_code_to_howto_index[R_860_max + 1];
00746 
00747 static reloc_howto_type *
00748 lookup_howto (unsigned int rtype)
00749 {
00750   static int initialized = 0;
00751   int i;
00752   int howto_tbl_size = (int) (sizeof (elf32_i860_howto_table)
00753                      / sizeof (elf32_i860_howto_table[0]));
00754 
00755   if (! initialized)
00756     {
00757       initialized = 1;
00758       memset (elf_code_to_howto_index, 0xff,
00759              sizeof (elf_code_to_howto_index));
00760       for (i = 0; i < howto_tbl_size; i++)
00761         elf_code_to_howto_index[elf32_i860_howto_table[i].type] = i;
00762     }
00763 
00764   BFD_ASSERT (rtype <= R_860_max);
00765   i = elf_code_to_howto_index[rtype];
00766   if (i >= howto_tbl_size)
00767     return 0;
00768   return elf32_i860_howto_table + i;
00769 }
00770 
00771 /* Given a BFD reloc, return the matching HOWTO structure.  */
00772 static reloc_howto_type *
00773 elf32_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
00774                            bfd_reloc_code_real_type code)
00775 {
00776   unsigned int rtype;
00777 
00778   switch (code)
00779     {
00780     case BFD_RELOC_NONE:
00781       rtype = R_860_NONE;
00782       break;
00783     case BFD_RELOC_32:
00784       rtype = R_860_32;
00785       break;
00786     case BFD_RELOC_860_COPY:
00787       rtype = R_860_COPY;
00788       break;
00789     case BFD_RELOC_860_GLOB_DAT:
00790       rtype = R_860_GLOB_DAT;
00791       break;
00792     case BFD_RELOC_860_JUMP_SLOT:
00793       rtype = R_860_JUMP_SLOT;
00794       break;
00795     case BFD_RELOC_860_RELATIVE:
00796       rtype = R_860_RELATIVE;
00797       break;
00798     case BFD_RELOC_860_PC26:
00799       rtype = R_860_PC26;
00800       break;
00801     case BFD_RELOC_860_PLT26:
00802       rtype = R_860_PLT26;
00803       break;
00804     case BFD_RELOC_860_PC16:
00805       rtype = R_860_PC16;
00806       break;
00807     case BFD_RELOC_860_LOW0:
00808       rtype = R_860_LOW0;
00809       break;
00810     case BFD_RELOC_860_SPLIT0:
00811       rtype = R_860_SPLIT0;
00812       break;
00813     case BFD_RELOC_860_LOW1:
00814       rtype = R_860_LOW1;
00815       break;
00816     case BFD_RELOC_860_SPLIT1:
00817       rtype = R_860_SPLIT1;
00818       break;
00819     case BFD_RELOC_860_LOW2:
00820       rtype = R_860_LOW2;
00821       break;
00822     case BFD_RELOC_860_SPLIT2:
00823       rtype = R_860_SPLIT2;
00824       break;
00825     case BFD_RELOC_860_LOW3:
00826       rtype = R_860_LOW3;
00827       break;
00828     case BFD_RELOC_860_LOGOT0:
00829       rtype = R_860_LOGOT0;
00830       break;
00831     case BFD_RELOC_860_SPGOT0:
00832       rtype = R_860_SPGOT0;
00833       break;
00834     case BFD_RELOC_860_LOGOT1:
00835       rtype = R_860_LOGOT1;
00836       break;
00837     case BFD_RELOC_860_SPGOT1:
00838       rtype = R_860_SPGOT1;
00839       break;
00840     case BFD_RELOC_860_LOGOTOFF0:
00841       rtype = R_860_LOGOTOFF0;
00842       break;
00843     case BFD_RELOC_860_SPGOTOFF0:
00844       rtype = R_860_SPGOTOFF0;
00845       break;
00846     case BFD_RELOC_860_LOGOTOFF1:
00847       rtype = R_860_LOGOTOFF1;
00848       break;
00849     case BFD_RELOC_860_SPGOTOFF1:
00850       rtype = R_860_SPGOTOFF1;
00851       break;
00852     case BFD_RELOC_860_LOGOTOFF2:
00853       rtype = R_860_LOGOTOFF2;
00854       break;
00855     case BFD_RELOC_860_LOGOTOFF3:
00856       rtype = R_860_LOGOTOFF3;
00857       break;
00858     case BFD_RELOC_860_LOPC:
00859       rtype = R_860_LOPC;
00860       break;
00861     case BFD_RELOC_860_HIGHADJ:
00862       rtype = R_860_HIGHADJ;
00863       break;
00864     case BFD_RELOC_860_HAGOT:
00865       rtype = R_860_HAGOT;
00866       break;
00867     case BFD_RELOC_860_HAGOTOFF:
00868       rtype = R_860_HAGOTOFF;
00869       break;
00870     case BFD_RELOC_860_HAPC:
00871       rtype = R_860_HAPC;
00872       break;
00873     case BFD_RELOC_860_HIGH:
00874       rtype = R_860_HIGH;
00875       break;
00876     case BFD_RELOC_860_HIGOT:
00877       rtype = R_860_HIGOT;
00878       break;
00879     case BFD_RELOC_860_HIGOTOFF:
00880       rtype = R_860_HIGOTOFF;
00881       break;
00882     default:
00883       rtype = 0;
00884       break;
00885     }
00886   return lookup_howto (rtype);
00887 }
00888 
00889 static reloc_howto_type *
00890 elf32_i860_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
00891                            const char *r_name)
00892 {
00893   unsigned int i;
00894 
00895   for (i = 0;
00896        i < (sizeof (elf32_i860_howto_table)
00897            / sizeof (elf32_i860_howto_table[0]));
00898        i++)
00899     if (elf32_i860_howto_table[i].name != NULL
00900        && strcasecmp (elf32_i860_howto_table[i].name, r_name) == 0)
00901       return &elf32_i860_howto_table[i];
00902 
00903   return NULL;
00904 }
00905 
00906 /* Given a ELF reloc, return the matching HOWTO structure.  */
00907 static void
00908 elf32_i860_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
00909                             arelent *bfd_reloc,
00910                             Elf_Internal_Rela *elf_reloc)
00911 {
00912   bfd_reloc->howto
00913     = lookup_howto ((unsigned) ELF32_R_TYPE (elf_reloc->r_info));
00914 }
00915 
00916 /* Specialized relocation handler for R_860_SPLITn.  These relocations
00917    involves a 16-bit field that is split into two contiguous parts.  */
00918 static bfd_reloc_status_type
00919 elf32_i860_relocate_splitn (bfd *input_bfd,
00920                          Elf_Internal_Rela *rello,
00921                          bfd_byte *contents,
00922                          bfd_vma value)
00923 {
00924   bfd_vma insn;
00925   reloc_howto_type *howto;
00926   howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info));
00927   insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
00928 
00929   /* Relocate.  */
00930   value += rello->r_addend;
00931 
00932   /* Separate the fields and insert.  */
00933   value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask;
00934   insn = (insn & ~howto->dst_mask) | value;
00935 
00936   bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
00937   return bfd_reloc_ok;
00938 }
00939 
00940 /* Specialized relocation handler for R_860_PC16.  This relocation
00941    involves a 16-bit, PC-relative field that is split into two contiguous
00942    parts.  */
00943 static bfd_reloc_status_type
00944 elf32_i860_relocate_pc16 (bfd *input_bfd,
00945                        asection *input_section,
00946                        Elf_Internal_Rela *rello,
00947                        bfd_byte *contents,
00948                        bfd_vma value)
00949 {
00950   bfd_vma insn;
00951   reloc_howto_type *howto;
00952   howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info));
00953   insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
00954 
00955   /* Adjust for PC-relative relocation.  */
00956   value -= (input_section->output_section->vma
00957            + input_section->output_offset);
00958   value -= rello->r_offset;
00959 
00960   /* Relocate.  */
00961   value += rello->r_addend;
00962 
00963   /* Adjust the value by 4, then separate the fields and insert.  */
00964   value = (value - 4) >> howto->rightshift;
00965   value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask;
00966   insn = (insn & ~howto->dst_mask) | value;
00967 
00968   bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
00969   return bfd_reloc_ok;
00970 
00971 }
00972 
00973 /* Specialized relocation handler for R_860_PC26.  This relocation
00974    involves a 26-bit, PC-relative field which must be adjusted by 4.  */
00975 static bfd_reloc_status_type
00976 elf32_i860_relocate_pc26 (bfd *input_bfd,
00977                        asection *input_section,
00978                        Elf_Internal_Rela *rello,
00979                        bfd_byte *contents,
00980                        bfd_vma value)
00981 {
00982   bfd_vma insn;
00983   reloc_howto_type *howto;
00984   howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info));
00985   insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
00986 
00987   /* Adjust for PC-relative relocation.  */
00988   value -= (input_section->output_section->vma
00989            + input_section->output_offset);
00990   value -= rello->r_offset;
00991 
00992   /* Relocate.  */
00993   value += rello->r_addend;
00994 
00995   /* Adjust value by 4 and insert the field.  */
00996   value = ((value - 4) >> howto->rightshift) & howto->dst_mask;
00997   insn = (insn & ~howto->dst_mask) | value;
00998 
00999   bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
01000   return bfd_reloc_ok;
01001 
01002 }
01003 
01004 /* Specialized relocation handler for R_860_HIGHADJ.  */
01005 static bfd_reloc_status_type
01006 elf32_i860_relocate_highadj (bfd *input_bfd,
01007                           Elf_Internal_Rela *rel,
01008                           bfd_byte *contents,
01009                           bfd_vma value)
01010 {
01011   bfd_vma insn;
01012 
01013   insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
01014 
01015   value += rel->r_addend;
01016   value += 0x8000; 
01017   value = ((value >> 16) & 0xffff);
01018 
01019   insn = (insn & 0xffff0000) | value;
01020 
01021   bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
01022   return bfd_reloc_ok;
01023 }
01024 
01025 /* Perform a single relocation.  By default we use the standard BFD
01026    routines. However, we handle some specially.  */
01027 static bfd_reloc_status_type
01028 i860_final_link_relocate (reloc_howto_type *howto,
01029                        bfd *input_bfd,
01030                        asection *input_section,
01031                        bfd_byte *contents,
01032                        Elf_Internal_Rela *rel,
01033                        bfd_vma relocation)
01034 {
01035   return _bfd_final_link_relocate (howto, input_bfd, input_section,
01036                                contents, rel->r_offset, relocation,
01037                                rel->r_addend);
01038 }
01039 
01040 /* Relocate an i860 ELF section.
01041 
01042    This is boiler-plate code copied from fr30.
01043 
01044    The RELOCATE_SECTION function is called by the new ELF backend linker
01045    to handle the relocations for a section.
01046 
01047    The relocs are always passed as Rela structures; if the section
01048    actually uses Rel structures, the r_addend field will always be
01049    zero.
01050 
01051    This function is responsible for adjusting the section contents as
01052    necessary, and (if using Rela relocs and generating a relocatable
01053    output file) adjusting the reloc addend as necessary.
01054 
01055    This function does not have to worry about setting the reloc
01056    address or the reloc symbol index.
01057 
01058    LOCAL_SYMS is a pointer to the swapped in local symbols.
01059 
01060    LOCAL_SECTIONS is an array giving the section in the input file
01061    corresponding to the st_shndx field of each local symbol.
01062 
01063    The global hash table entry for the global symbols can be found
01064    via elf_sym_hashes (input_bfd).
01065 
01066    When generating relocatable output, this function must handle
01067    STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
01068    going to be the section symbol corresponding to the output
01069    section, which means that the addend must be adjusted
01070    accordingly.  */
01071 static bfd_boolean
01072 elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
01073                           struct bfd_link_info *info,
01074                           bfd *input_bfd,
01075                           asection *input_section,
01076                           bfd_byte *contents,
01077                           Elf_Internal_Rela *relocs,
01078                           Elf_Internal_Sym *local_syms,
01079                           asection **local_sections)
01080 {
01081   Elf_Internal_Shdr *symtab_hdr;
01082   struct elf_link_hash_entry **sym_hashes;
01083   Elf_Internal_Rela *rel;
01084   Elf_Internal_Rela *relend;
01085 
01086   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
01087   sym_hashes = elf_sym_hashes (input_bfd);
01088   relend     = relocs + input_section->reloc_count;
01089 
01090   for (rel = relocs; rel < relend; rel ++)
01091     {
01092       reloc_howto_type *           howto;
01093       unsigned long                r_symndx;
01094       Elf_Internal_Sym *           sym;
01095       asection *                   sec;
01096       struct elf_link_hash_entry * h;
01097       bfd_vma                      relocation;
01098       bfd_reloc_status_type        r;
01099       const char *                 name = NULL;
01100       int                          r_type;
01101 
01102       r_type = ELF32_R_TYPE (rel->r_info);
01103       r_symndx = ELF32_R_SYM (rel->r_info);
01104 
01105       howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info));
01106       h     = NULL;
01107       sym   = NULL;
01108       sec   = NULL;
01109 
01110       if (r_symndx < symtab_hdr->sh_info)
01111        {
01112          sym = local_syms + r_symndx;
01113          sec = local_sections [r_symndx];
01114          relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
01115 
01116          name = bfd_elf_string_from_elf_section
01117            (input_bfd, symtab_hdr->sh_link, sym->st_name);
01118          name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
01119        }
01120       else
01121        {
01122          bfd_boolean unresolved_reloc, warned;
01123 
01124          RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
01125                                r_symndx, symtab_hdr, sym_hashes,
01126                                h, sec, relocation,
01127                                unresolved_reloc, warned);
01128        }
01129 
01130       if (sec != NULL && elf_discarded_section (sec))
01131        {
01132          /* For relocs against symbols from removed linkonce sections,
01133             or sections discarded by a linker script, we just want the
01134             section contents zeroed.  Avoid any special processing.  */
01135          _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
01136          rel->r_info = 0;
01137          rel->r_addend = 0;
01138          continue;
01139        }
01140 
01141       if (info->relocatable)
01142        continue;
01143 
01144       switch (r_type)
01145        {
01146        default:
01147          r = i860_final_link_relocate (howto, input_bfd, input_section,
01148                                    contents, rel, relocation);
01149          break;
01150 
01151        case R_860_HIGHADJ:
01152          r = elf32_i860_relocate_highadj (input_bfd, rel, contents,
01153                                       relocation);
01154          break;
01155 
01156        case R_860_PC16:
01157          r = elf32_i860_relocate_pc16 (input_bfd, input_section, rel,
01158                                    contents, relocation);
01159          break;
01160 
01161        case R_860_PC26:
01162          r = elf32_i860_relocate_pc26 (input_bfd, input_section, rel,
01163                                    contents, relocation);
01164          break;
01165 
01166        case R_860_SPLIT0:
01167        case R_860_SPLIT1:
01168        case R_860_SPLIT2:
01169          r = elf32_i860_relocate_splitn (input_bfd, rel, contents,
01170                                      relocation);
01171          break;
01172 
01173        /* We do not yet handle GOT/PLT/Dynamic relocations.  */
01174        case R_860_COPY:
01175        case R_860_GLOB_DAT:
01176        case R_860_JUMP_SLOT:
01177        case R_860_RELATIVE:
01178        case R_860_PLT26:
01179        case R_860_LOGOT0:
01180        case R_860_SPGOT0:
01181        case R_860_LOGOT1:
01182        case R_860_SPGOT1:
01183        case R_860_LOGOTOFF0:
01184        case R_860_SPGOTOFF0:
01185        case R_860_LOGOTOFF1:
01186        case R_860_SPGOTOFF1:
01187        case R_860_LOGOTOFF2:
01188        case R_860_LOGOTOFF3:
01189        case R_860_LOPC:
01190        case R_860_HAGOT:
01191        case R_860_HAGOTOFF:
01192        case R_860_HAPC:
01193        case R_860_HIGOT:
01194        case R_860_HIGOTOFF:
01195          r = bfd_reloc_notsupported;
01196          break;
01197        }
01198 
01199       if (r != bfd_reloc_ok)
01200        {
01201          const char * msg = (const char *) NULL;
01202 
01203          switch (r)
01204            {
01205            case bfd_reloc_overflow:
01206              r = info->callbacks->reloc_overflow
01207               (info, (h ? &h->root : NULL), name, howto->name,
01208                (bfd_vma) 0, input_bfd, input_section, rel->r_offset);
01209              break;
01210 
01211            case bfd_reloc_undefined:
01212              r = info->callbacks->undefined_symbol
01213               (info, name, input_bfd, input_section, rel->r_offset, TRUE);
01214              break;
01215 
01216            case bfd_reloc_outofrange:
01217              msg = _("internal error: out of range error");
01218              break;
01219 
01220            case bfd_reloc_notsupported:
01221              msg = _("internal error: unsupported relocation error");
01222              break;
01223 
01224            case bfd_reloc_dangerous:
01225              msg = _("internal error: dangerous relocation");
01226              break;
01227 
01228            default:
01229              msg = _("internal error: unknown error");
01230              break;
01231            }
01232 
01233          if (msg)
01234            r = info->callbacks->warning
01235              (info, msg, name, input_bfd, input_section, rel->r_offset);
01236 
01237          if (! r)
01238            return FALSE;
01239        }
01240     }
01241 
01242   return TRUE;
01243 }
01244 
01245 /* Return whether a symbol name implies a local label.  SVR4/860 compilers
01246    generate labels of the form ".ep.function_name" to denote the end of a
01247    function prolog. These should be local.
01248    ??? Do any other SVR4 compilers have this convention? If so, this should
01249    be added to the generic routine.  */
01250 static bfd_boolean
01251 elf32_i860_is_local_label_name (bfd *abfd, const char *name)
01252 {
01253   if (name[0] == '.' && name[1] == 'e' && name[2] == 'p' && name[3] == '.')
01254     return TRUE;
01255 
01256   return _bfd_elf_is_local_label_name (abfd, name);
01257 }
01258 
01259 #define TARGET_BIG_SYM             bfd_elf32_i860_vec
01260 #define TARGET_BIG_NAME            "elf32-i860"
01261 #define TARGET_LITTLE_SYM   bfd_elf32_i860_little_vec
01262 #define TARGET_LITTLE_NAME  "elf32-i860-little"
01263 #define ELF_ARCH            bfd_arch_i860
01264 #define ELF_MACHINE_CODE    EM_860
01265 #define ELF_MAXPAGESIZE            4096
01266 
01267 #define elf_backend_rela_normal                  1
01268 #define elf_info_to_howto_rel                   NULL
01269 #define elf_info_to_howto                 elf32_i860_info_to_howto_rela
01270 #define elf_backend_relocate_section             elf32_i860_relocate_section
01271 #define bfd_elf32_bfd_reloc_type_lookup          elf32_i860_reloc_type_lookup
01272 #define bfd_elf32_bfd_reloc_name_lookup   elf32_i860_reloc_name_lookup
01273 #define bfd_elf32_bfd_is_local_label_name elf32_i860_is_local_label_name
01274 
01275 #include "elf32-target.h"