Back to index

cell-binutils  2.17cvs20070401
elf64-gen.c
Go to the documentation of this file.
00001 /* Generic support for 64-bit ELF
00002    Copyright 1993, 1995, 1998, 1999, 2001, 2002, 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, MA 02110-1301, USA.  */
00020 
00021 #include "bfd.h"
00022 #include "sysdep.h"
00023 #include "libbfd.h"
00024 #include "elf-bfd.h"
00025 
00026 /* This does not include any relocation information, but should be
00027    good enough for GDB or objdump to read the file.  */
00028 
00029 static reloc_howto_type dummy =
00030   HOWTO (0,                 /* type */
00031         0,                  /* rightshift */
00032         0,                  /* size (0 = byte, 1 = short, 2 = long) */
00033         0,                  /* bitsize */
00034         FALSE,                     /* pc_relative */
00035         0,                  /* bitpos */
00036         complain_overflow_dont, /* complain_on_overflow */
00037         NULL,               /* special_function */
00038         "UNKNOWN",          /* name */
00039         FALSE,                     /* partial_inplace */
00040         0,                  /* src_mask */
00041         0,                  /* dst_mask */
00042         FALSE);             /* pcrel_offset */
00043 
00044 static void
00045 elf_generic_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
00046                         arelent *bfd_reloc,
00047                         Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
00048 {
00049   bfd_reloc->howto = &dummy;
00050 }
00051 
00052 static void
00053 elf_generic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
00054                             arelent *bfd_reloc,
00055                             Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED)
00056 {
00057   bfd_reloc->howto = &dummy;
00058 }
00059 
00060 static void
00061 check_for_relocs (bfd * abfd, asection * o, void * failed)
00062 {
00063   if ((o->flags & SEC_RELOC) != 0)
00064     {
00065       Elf_Internal_Ehdr *ehdrp;
00066 
00067       ehdrp = elf_elfheader (abfd);
00068       _bfd_error_handler (_("%B: Relocations in generic ELF (EM: %d)"),
00069                        abfd, ehdrp->e_machine);
00070 
00071       bfd_set_error (bfd_error_wrong_format);
00072       * (bfd_boolean *) failed = TRUE;
00073     }
00074 }
00075 
00076 static bfd_boolean
00077 elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
00078 {
00079   bfd_boolean failed = FALSE;
00080 
00081   /* Check if there are any relocations.  */
00082   bfd_map_over_sections (abfd, check_for_relocs, & failed);
00083 
00084   if (failed)
00085     return FALSE;
00086   return bfd_elf_link_add_symbols (abfd, info);
00087 }
00088 
00089 #define TARGET_LITTLE_SYM          bfd_elf64_little_generic_vec
00090 #define TARGET_LITTLE_NAME         "elf64-little"
00091 #define TARGET_BIG_SYM                    bfd_elf64_big_generic_vec
00092 #define TARGET_BIG_NAME                   "elf64-big"
00093 #define ELF_ARCH                   bfd_arch_unknown
00094 #define ELF_MACHINE_CODE           EM_NONE
00095 #define ELF_MAXPAGESIZE                   0x1
00096 #define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
00097 #define bfd_elf64_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
00098 #define bfd_elf64_bfd_link_add_symbols    elf64_generic_link_add_symbols
00099 #define elf_info_to_howto          elf_generic_info_to_howto
00100 #define elf_info_to_howto_rel             elf_generic_info_to_howto_rel
00101 
00102 #include "elf64-target.h"