Back to index

cell-binutils  2.17cvs20070401
elf32-dlx.c
Go to the documentation of this file.
00001 /* DLX specific support for 32-bit ELF
00002    Copyright 2002, 2003, 2004, 2005, 2007
00003    Free Software Foundation, Inc.
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
00020    MA 02110-1301, USA.  */
00021 
00022 #include "bfd.h"
00023 #include "sysdep.h"
00024 #include "libbfd.h"
00025 #include "elf-bfd.h"
00026 #include "elf/dlx.h"
00027 
00028 #define USE_REL 1
00029 
00030 #define bfd_elf32_bfd_reloc_type_lookup elf32_dlx_reloc_type_lookup
00031 #define bfd_elf32_bfd_reloc_name_lookup elf32_dlx_reloc_name_lookup
00032 #define elf_info_to_howto               elf32_dlx_info_to_howto
00033 #define elf_info_to_howto_rel           elf32_dlx_info_to_howto_rel
00034 #define elf_backend_check_relocs        elf32_dlx_check_relocs
00035 
00036 /* The gas default behavior is not to preform the %hi modifier so that the
00037    GNU assembler can have the lower 16 bits offset placed in the insn, BUT
00038    we do like the gas to indicate it is %hi reloc type so when we in the link
00039    loader phase we can have the corrected hi16 vale replace the buggous lo16
00040    value that was placed there by gas.  */
00041 
00042 static int skip_dlx_elf_hi16_reloc = 0;
00043 
00044 extern int set_dlx_skip_hi16_flag (int);
00045 
00046 int
00047 set_dlx_skip_hi16_flag (int flag)
00048 {
00049   skip_dlx_elf_hi16_reloc = flag;
00050   return flag;
00051 }
00052 
00053 static bfd_reloc_status_type
00054 _bfd_dlx_elf_hi16_reloc (bfd *abfd,
00055                       arelent *reloc_entry,
00056                       asymbol *symbol,
00057                       void * data,
00058                       asection *input_section,
00059                       bfd *output_bfd,
00060                       char **error_message)
00061 {
00062   bfd_reloc_status_type ret;
00063   bfd_vma relocation;
00064 
00065   /* If the skip flag is set then we simply do the generic relocating, this
00066      is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo
00067      fixup like mips gld did.   */
00068   if (skip_dlx_elf_hi16_reloc)
00069     return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
00070                           input_section, output_bfd, error_message);
00071 
00072   /* If we're relocating, and this an external symbol, we don't want
00073      to change anything.  */
00074   if (output_bfd != (bfd *) NULL
00075       && (symbol->flags & BSF_SECTION_SYM) == 0
00076       && reloc_entry->addend == 0)
00077     {
00078       reloc_entry->address += input_section->output_offset;
00079       return bfd_reloc_ok;
00080     }
00081 
00082   ret = bfd_reloc_ok;
00083 
00084   if (bfd_is_und_section (symbol->section)
00085       && output_bfd == (bfd *) NULL)
00086     ret = bfd_reloc_undefined;
00087 
00088   relocation = (bfd_is_com_section (symbol->section)) ? 0 : symbol->value;
00089   relocation += symbol->section->output_section->vma;
00090   relocation += symbol->section->output_offset;
00091   relocation += reloc_entry->addend;
00092   relocation += bfd_get_16 (abfd, (bfd_byte *)data + reloc_entry->address);
00093 
00094   if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
00095     return bfd_reloc_outofrange;
00096 
00097   bfd_put_16 (abfd, (short)((relocation >> 16) & 0xFFFF),
00098               (bfd_byte *)data + reloc_entry->address);
00099 
00100   return ret;
00101 }
00102 
00103 /* ELF relocs are against symbols.  If we are producing relocatable
00104    output, and the reloc is against an external symbol, and nothing
00105    has given us any additional addend, the resulting reloc will also
00106    be against the same symbol.  In such a case, we don't want to
00107    change anything about the way the reloc is handled, since it will
00108    all be done at final link time.  Rather than put special case code
00109    into bfd_perform_relocation, all the reloc types use this howto
00110    function.  It just short circuits the reloc if producing
00111    relocatable output against an external symbol.  */
00112 
00113 static bfd_reloc_status_type
00114 elf32_dlx_relocate16 (bfd *abfd,
00115                     arelent *reloc_entry,
00116                     asymbol *symbol,
00117                     void * data,
00118                     asection *input_section,
00119                     bfd *output_bfd,
00120                     char **error_message ATTRIBUTE_UNUSED)
00121 {
00122   unsigned long insn, vallo, allignment;
00123   int           val;
00124 
00125   /* HACK: I think this first condition is necessary when producing
00126      relocatable output.  After the end of HACK, the code is identical
00127      to bfd_elf_generic_reloc().  I would _guess_ the first change
00128      belongs there rather than here.  martindo 1998-10-23.  */
00129 
00130   if (skip_dlx_elf_hi16_reloc)
00131     return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
00132                                  input_section, output_bfd, error_message);
00133 
00134   /* Check undefined section and undefined symbols.  */
00135   if (bfd_is_und_section (symbol->section)
00136       && output_bfd == (bfd *) NULL)
00137     return bfd_reloc_undefined;
00138 
00139   /* Can not support a long jump to sections other then .text.  */
00140   if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
00141     {
00142       fprintf (stderr,
00143               "BFD Link Error: branch (PC rel16) to section (%s) not supported\n",
00144               symbol->section->output_section->name);
00145       return bfd_reloc_undefined;
00146     }
00147 
00148   insn  = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
00149   allignment = 1 << (input_section->output_section->alignment_power - 1);
00150   vallo = insn & 0x0000FFFF;
00151 
00152   if (vallo & 0x8000)
00153     vallo = ~(vallo | 0xFFFF0000) + 1;
00154 
00155   /* vallo points to the vma of next instruction.  */
00156   vallo += (((unsigned long)(input_section->output_section->vma +
00157                            input_section->output_offset) +
00158             allignment) & ~allignment);
00159 
00160   /* val is the displacement (PC relative to next instruction).  */
00161   val =  (symbol->section->output_offset +
00162          symbol->section->output_section->vma +
00163          symbol->value) - vallo;
00164 
00165   if (abs ((int) val) > 0x00007FFF)
00166     return bfd_reloc_outofrange;
00167 
00168   insn  = (insn & 0xFFFF0000) | (val & 0x0000FFFF);
00169 
00170   bfd_put_32 (abfd, insn,
00171               (bfd_byte *) data + reloc_entry->address);
00172 
00173   return bfd_reloc_ok;
00174 }
00175 
00176 static bfd_reloc_status_type
00177 elf32_dlx_relocate26 (bfd *abfd,
00178                     arelent *reloc_entry,
00179                     asymbol *symbol,
00180                     void * data,
00181                     asection *input_section,
00182                     bfd *output_bfd,
00183                     char **error_message ATTRIBUTE_UNUSED)
00184 {
00185   unsigned long insn, vallo, allignment;
00186   int           val;
00187 
00188   /* HACK: I think this first condition is necessary when producing
00189      relocatable output.  After the end of HACK, the code is identical
00190      to bfd_elf_generic_reloc().  I would _guess_ the first change
00191      belongs there rather than here.  martindo 1998-10-23.  */
00192 
00193   if (skip_dlx_elf_hi16_reloc)
00194     return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
00195                                  input_section, output_bfd, error_message);
00196 
00197   /* Check undefined section and undefined symbols.  */
00198   if (bfd_is_und_section (symbol->section)
00199       && output_bfd == (bfd *) NULL)
00200     return bfd_reloc_undefined;
00201 
00202   /* Can not support a long jump to sections other then .text   */
00203   if (strcmp (input_section->name, symbol->section->output_section->name) != 0)
00204     {
00205       fprintf (stderr,
00206               "BFD Link Error: jump (PC rel26) to section (%s) not supported\n",
00207               symbol->section->output_section->name);
00208       return bfd_reloc_undefined;
00209     }
00210 
00211   insn  = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
00212   allignment = 1 << (input_section->output_section->alignment_power - 1);
00213   vallo = insn & 0x03FFFFFF;
00214 
00215   if (vallo & 0x03000000)
00216     vallo = ~(vallo | 0xFC000000) + 1;
00217 
00218   /* vallo is the vma for the next instruction.  */
00219   vallo += (((unsigned long) (input_section->output_section->vma +
00220                            input_section->output_offset) +
00221             allignment) & ~allignment);
00222 
00223   /* val is the displacement (PC relative to next instruction).  */
00224   val = (symbol->section->output_offset +
00225         symbol->section->output_section->vma + symbol->value)
00226     - vallo;
00227 
00228   if (abs ((int) val) > 0x01FFFFFF)
00229     return bfd_reloc_outofrange;
00230 
00231   insn  = (insn & 0xFC000000) | (val & 0x03FFFFFF);
00232   bfd_put_32 (abfd, insn,
00233               (bfd_byte *) data + reloc_entry->address);
00234 
00235   return bfd_reloc_ok;
00236 }
00237 
00238 static reloc_howto_type dlx_elf_howto_table[]=
00239 {
00240   /* No relocation.  */
00241   HOWTO (R_DLX_NONE,            /* Type. */
00242         0,                     /* Rightshift.  */
00243         0,                     /* size (0 = byte, 1 = short, 2 = long).  */
00244         0,                     /* Bitsize.  */
00245         FALSE,                 /* PC_relative.  */
00246         0,                     /* Bitpos.  */
00247         complain_overflow_dont,/* Complain_on_overflow.  */
00248         bfd_elf_generic_reloc, /* Special_function.  */
00249         "R_DLX_NONE",          /* Name.  */
00250         FALSE,                 /* Partial_inplace.  */
00251         0,                     /* Src_mask.  */
00252         0,                     /* Dst_mask.  */
00253         FALSE),                /* PCrel_offset.  */
00254 
00255   /* 8 bit relocation.  */
00256   HOWTO (R_DLX_RELOC_8,         /* Type. */
00257         0,                     /* Rightshift.  */
00258         0,                     /* Size (0 = byte, 1 = short, 2 = long).  */
00259         8,                     /* Bitsize.  */
00260         FALSE,                 /* PC_relative.  */
00261         0,                     /* Bitpos.  */
00262         complain_overflow_dont,/* Complain_on_overflow.  */
00263         bfd_elf_generic_reloc, /* Special_function.  */
00264         "R_DLX_RELOC_8",       /* Name.  */
00265         TRUE,                  /* Partial_inplace.  */
00266         0xff,                  /* Src_mask.  */
00267         0xff,                  /* Dst_mask.  */
00268         FALSE),                /* PCrel_offset.  */
00269 
00270   /* 16 bit relocation.  */
00271   HOWTO (R_DLX_RELOC_16,        /* Type. */
00272         0,                     /* Rightshift.  */
00273         1,                     /* Size (0 = byte, 1 = short, 2 = long).  */
00274         16,                    /* Bitsize.  */
00275         FALSE,                 /* PC_relative.  */
00276         0,                     /* Bitpos.  */
00277         complain_overflow_dont,/* Complain_on_overflow.  */
00278         bfd_elf_generic_reloc, /* Special_function.  */
00279         "R_DLX_RELOC_16",      /* Name.  */
00280         TRUE,                  /* Partial_inplace.  */
00281         0xffff,                /* Src_mask.  */
00282         0xffff,                /* Dst_mask.  */
00283         FALSE),                /* PCrel_offset.  */
00284 
00285   /* 32 bit relocation.  */
00286   HOWTO (R_DLX_RELOC_32,        /* Type. */
00287         0,                     /* Rightshift.  */
00288         2,                     /* Size (0 = byte, 1 = short, 2 = long).  */
00289         32,                    /* Bitsize.  */
00290         FALSE,                 /* PC_relative.  */
00291         0,                     /* Bitpos.  */
00292         complain_overflow_dont,/* Complain_on_overflow.  */
00293         bfd_elf_generic_reloc, /* Special_function.  */
00294         "R_DLX_RELOC_32",      /* Name.  */
00295         TRUE,                  /* Partial_inplace.  */
00296         0xffffffff,            /* Src_mask.  */
00297         0xffffffff,            /* Dst_mask.  */
00298         FALSE),                /* PCrel_offset.  */
00299 
00300   /* GNU extension to record C++ vtable hierarchy.  */
00301   HOWTO (R_DLX_GNU_VTINHERIT,   /* Type. */
00302         0,                  /* Rightshift.  */
00303         2,                  /* Size (0 = byte, 1 = short, 2 = long).  */
00304         0,                  /* Bitsize.  */
00305         FALSE,                     /* PC_relative.  */
00306         0,                  /* Bitpos.  */
00307         complain_overflow_dont,/* Complain_on_overflow.  */
00308         NULL,               /* Special_function.  */
00309         "R_DLX_GNU_VTINHERIT", /* Name.  */
00310         FALSE,                     /* Partial_inplace.  */
00311         0,                  /* Src_mask.  */
00312         0,                  /* Dst_mask.  */
00313         FALSE),             /* PCrel_offset.  */
00314 
00315   /* GNU extension to record C++ vtable member usage.  */
00316   HOWTO (R_DLX_GNU_VTENTRY,     /* Type. */
00317         0,                  /* Rightshift.  */
00318         2,                  /* Size (0 = byte, 1 = short, 2 = long).  */
00319         0,                  /* Bitsize.  */
00320         FALSE,                     /* PC_relative.  */
00321         0,                  /* Bitpos.  */
00322         complain_overflow_dont,/* Complain_on_overflow.  */
00323         _bfd_elf_rel_vtable_reloc_fn,/* Special_function.  */
00324         "R_DLX_GNU_VTENTRY",       /* Name.  */
00325         FALSE,                     /* Partial_inplace.  */
00326         0,                  /* Src_mask.  */
00327         0,                  /* Dst_mask.  */
00328         FALSE)                     /* PCrel_offset.  */
00329 };
00330 
00331 /* 16 bit offset for pc-relative branches.  */
00332 static reloc_howto_type elf_dlx_gnu_rel16_s2 =
00333   HOWTO (R_DLX_RELOC_16_PCREL,  /* Type. */
00334         0,                     /* Rightshift.  */
00335         1,                     /* Size (0 = byte, 1 = short, 2 = long).  */
00336         16,                    /* Bitsize.  */
00337         TRUE,                  /* PC_relative.  */
00338         0,                     /* Bitpos.  */
00339         complain_overflow_signed, /* Complain_on_overflow.  */
00340         elf32_dlx_relocate16,  /* Special_function.  */
00341         "R_DLX_RELOC_16_PCREL",/* Name.  */
00342         TRUE,                  /* Partial_inplace.  */
00343         0xffff,                /* Src_mask.  */
00344         0xffff,                /* Dst_mask.  */
00345         TRUE);                 /* PCrel_offset.  */
00346 
00347 /* 26 bit offset for pc-relative branches.  */
00348 static reloc_howto_type elf_dlx_gnu_rel26_s2 =
00349   HOWTO (R_DLX_RELOC_26_PCREL,  /* Type. */
00350         0,                     /* Rightshift.  */
00351         2,                     /* Size (0 = byte, 1 = short, 2 = long).  */
00352         26,                    /* Bitsize.  */
00353         TRUE,                  /* PC_relative.  */
00354         0,                     /* Bitpos.  */
00355         complain_overflow_dont,/* Complain_on_overflow.  */
00356         elf32_dlx_relocate26,  /* Special_function.  */
00357         "R_DLX_RELOC_26_PCREL",/* Name.  */
00358         TRUE,                  /* Partial_inplace.  */
00359         0xffff,                /* Src_mask.  */
00360         0xffff,                /* Dst_mask.  */
00361         TRUE);                 /* PCrel_offset.  */
00362 
00363 /* High 16 bits of symbol value.  */
00364 static reloc_howto_type elf_dlx_reloc_16_hi =
00365   HOWTO (R_DLX_RELOC_16_HI,     /* Type. */
00366         16,                    /* Rightshift.  */
00367         2,                     /* Size (0 = byte, 1 = short, 2 = long).  */
00368         32,                    /* Bitsize.  */
00369         FALSE,                 /* PC_relative.  */
00370         0,                     /* Bitpos.  */
00371         complain_overflow_dont,/* Complain_on_overflow.  */
00372         _bfd_dlx_elf_hi16_reloc,/* Special_function.  */
00373         "R_DLX_RELOC_16_HI",   /* Name.  */
00374         TRUE,                  /* Partial_inplace.  */
00375         0xFFFF,                /* Src_mask.  */
00376         0xffff,                /* Dst_mask.  */
00377         FALSE);                /* PCrel_offset.  */
00378 
00379   /* Low 16 bits of symbol value.  */
00380 static reloc_howto_type elf_dlx_reloc_16_lo =
00381   HOWTO (R_DLX_RELOC_16_LO,     /* Type. */
00382         0,                     /* Rightshift.  */
00383         1,                     /* Size (0 = byte, 1 = short, 2 = long).  */
00384         16,                    /* Bitsize.  */
00385         FALSE,                 /* PC_relative.  */
00386         0,                     /* Bitpos.  */
00387         complain_overflow_dont,/* Complain_on_overflow.  */
00388         bfd_elf_generic_reloc, /* Special_function.  */
00389         "R_DLX_RELOC_16_LO",   /* Name.  */
00390         TRUE,                  /* Partial_inplace.  */
00391         0xffff,                /* Src_mask.  */
00392         0xffff,                /* Dst_mask.  */
00393         FALSE);                /* PCrel_offset.  */
00394 
00395 /* A mapping from BFD reloc types to DLX ELF reloc types.
00396    Stolen from elf32-mips.c.
00397 
00398    More about this table - for dlx elf relocation we do not really
00399    need this table, if we have a rtype defined in this table will
00400    caused tc_gen_relocate confused and die on us, but if we remove
00401    this table it will caused more problem, so for now simple solution
00402    is to remove those entries which may cause problem.  */
00403 struct elf_reloc_map
00404 {
00405   bfd_reloc_code_real_type bfd_reloc_val;
00406   enum elf_dlx_reloc_type elf_reloc_val;
00407 };
00408 
00409 static const struct elf_reloc_map dlx_reloc_map[] =
00410 {
00411   { BFD_RELOC_NONE,           R_DLX_NONE },
00412   { BFD_RELOC_16,             R_DLX_RELOC_16 },
00413   { BFD_RELOC_32,             R_DLX_RELOC_32 },
00414   { BFD_RELOC_DLX_HI16_S,     R_DLX_RELOC_16_HI },
00415   { BFD_RELOC_DLX_LO16,       R_DLX_RELOC_16_LO },
00416   { BFD_RELOC_VTABLE_INHERIT,      R_DLX_GNU_VTINHERIT },
00417   { BFD_RELOC_VTABLE_ENTRY, R_DLX_GNU_VTENTRY }
00418 };
00419 
00420 /* Look through the relocs for a section during the first phase.
00421    Since we don't do .gots or .plts, we just need to consider the
00422    virtual table relocs for gc.  */
00423 
00424 static bfd_boolean
00425 elf32_dlx_check_relocs (bfd *abfd,
00426                      struct bfd_link_info *info,
00427                      asection *sec,
00428                      const Elf_Internal_Rela *relocs)
00429 {
00430   Elf_Internal_Shdr *symtab_hdr;
00431   struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
00432   const Elf_Internal_Rela *rel;
00433   const Elf_Internal_Rela *rel_end;
00434 
00435   if (info->relocatable)
00436     return TRUE;
00437 
00438   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
00439   sym_hashes = elf_sym_hashes (abfd);
00440   sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
00441   if (!elf_bad_symtab (abfd))
00442     sym_hashes_end -= symtab_hdr->sh_info;
00443 
00444   rel_end = relocs + sec->reloc_count;
00445   for (rel = relocs; rel < rel_end; rel++)
00446     {
00447       struct elf_link_hash_entry *h;
00448       unsigned long r_symndx;
00449 
00450       r_symndx = ELF32_R_SYM (rel->r_info);
00451       if (r_symndx < symtab_hdr->sh_info)
00452         h = NULL;
00453       else
00454        {
00455          h = sym_hashes[r_symndx - symtab_hdr->sh_info];
00456          while (h->root.type == bfd_link_hash_indirect
00457                || h->root.type == bfd_link_hash_warning)
00458            h = (struct elf_link_hash_entry *) h->root.u.i.link;
00459        }
00460 
00461       switch (ELF32_R_TYPE (rel->r_info))
00462         {
00463         /* This relocation describes the C++ object vtable hierarchy.
00464            Reconstruct it for later use during GC.  */
00465         case R_DLX_GNU_VTINHERIT:
00466           if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
00467             return FALSE;
00468           break;
00469 
00470         /* This relocation describes which C++ vtable entries are actually
00471            used.  Record for later use during GC.  */
00472         case R_DLX_GNU_VTENTRY:
00473           if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
00474             return FALSE;
00475           break;
00476         }
00477     }
00478 
00479   return TRUE;
00480 }
00481 
00482 /* Given a BFD reloc type, return a howto structure.  */
00483 
00484 static reloc_howto_type *
00485 elf32_dlx_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
00486                           bfd_reloc_code_real_type code)
00487 {
00488   unsigned int i;
00489 
00490   for (i = 0; i < sizeof (dlx_reloc_map) / sizeof (struct elf_reloc_map); i++)
00491     if (dlx_reloc_map[i].bfd_reloc_val == code)
00492       return &dlx_elf_howto_table[(int) dlx_reloc_map[i].elf_reloc_val];
00493 
00494   switch (code)
00495     {
00496     default:
00497       bfd_set_error (bfd_error_bad_value);
00498       return NULL;
00499     case BFD_RELOC_16_PCREL_S2:
00500       return &elf_dlx_gnu_rel16_s2;
00501     case BFD_RELOC_DLX_JMP26:
00502       return &elf_dlx_gnu_rel26_s2;
00503     case BFD_RELOC_HI16_S:
00504       return &elf_dlx_reloc_16_hi;
00505     case BFD_RELOC_LO16:
00506       return &elf_dlx_reloc_16_lo;
00507     }
00508 }
00509 
00510 static reloc_howto_type *
00511 elf32_dlx_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
00512                           const char *r_name)
00513 {
00514   unsigned int i;
00515 
00516   for (i = 0;
00517        i < sizeof (dlx_elf_howto_table) / sizeof (dlx_elf_howto_table[0]);
00518        i++)
00519     if (dlx_elf_howto_table[i].name != NULL
00520        && strcasecmp (dlx_elf_howto_table[i].name, r_name) == 0)
00521       return &dlx_elf_howto_table[i];
00522 
00523   if (strcasecmp (elf_dlx_gnu_rel16_s2.name, r_name) == 0)
00524     return &elf_dlx_gnu_rel16_s2;
00525   if (strcasecmp (elf_dlx_gnu_rel26_s2.name, r_name) == 0)
00526     return &elf_dlx_gnu_rel26_s2;
00527   if (strcasecmp (elf_dlx_reloc_16_hi.name, r_name) == 0)
00528     return &elf_dlx_reloc_16_hi;
00529   if (strcasecmp (elf_dlx_reloc_16_lo.name, r_name) == 0)
00530     return &elf_dlx_reloc_16_lo;
00531 
00532   return NULL;
00533 }
00534 
00535 static reloc_howto_type *
00536 dlx_rtype_to_howto (unsigned int r_type)
00537 {
00538   switch (r_type)
00539     {
00540     case R_DLX_RELOC_16_PCREL:
00541       return & elf_dlx_gnu_rel16_s2;
00542     case R_DLX_RELOC_26_PCREL:
00543       return & elf_dlx_gnu_rel26_s2;
00544     case R_DLX_RELOC_16_HI:
00545       return & elf_dlx_reloc_16_hi;
00546     case R_DLX_RELOC_16_LO:
00547       return & elf_dlx_reloc_16_lo;
00548     default:
00549       BFD_ASSERT (r_type < (unsigned int) R_DLX_max);
00550       return & dlx_elf_howto_table[r_type];
00551     }
00552 }
00553 
00554 static void
00555 elf32_dlx_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
00556                       arelent * cache_ptr ATTRIBUTE_UNUSED,
00557                       Elf_Internal_Rela * dst ATTRIBUTE_UNUSED)
00558 {
00559   abort ();
00560 }
00561 
00562 static void
00563 elf32_dlx_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
00564                           arelent *cache_ptr,
00565                           Elf_Internal_Rela *dst)
00566 {
00567   unsigned int r_type;
00568 
00569   r_type = ELF32_R_TYPE (dst->r_info);
00570   cache_ptr->howto = dlx_rtype_to_howto (r_type);
00571   return;
00572 }
00573 
00574 #define TARGET_BIG_SYM          bfd_elf32_dlx_big_vec
00575 #define TARGET_BIG_NAME         "elf32-dlx"
00576 #define ELF_ARCH                bfd_arch_dlx
00577 #define ELF_MACHINE_CODE        EM_DLX
00578 #define ELF_MAXPAGESIZE         1 /* FIXME: This number is wrong,  It should be the page size in bytes.  */
00579 
00580 #include "elf32-target.h"