| 1 | /* Generic support for 32-bit ELF | 
|---|
| 2 | Copyright 1993, 1995, 1998, 1999 Free Software Foundation, Inc. | 
|---|
| 3 |  | 
|---|
| 4 | This file is part of BFD, the Binary File Descriptor library. | 
|---|
| 5 |  | 
|---|
| 6 | This program is free software; you can redistribute it and/or modify | 
|---|
| 7 | it under the terms of the GNU General Public License as published by | 
|---|
| 8 | the Free Software Foundation; either version 2 of the License, or | 
|---|
| 9 | (at your option) any later version. | 
|---|
| 10 |  | 
|---|
| 11 | This program is distributed in the hope that it will be useful, | 
|---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 14 | GNU General Public License for more details. | 
|---|
| 15 |  | 
|---|
| 16 | You should have received a copy of the GNU General Public License | 
|---|
| 17 | along with this program; if not, write to the Free Software | 
|---|
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */ | 
|---|
| 19 |  | 
|---|
| 20 | #include "bfd.h" | 
|---|
| 21 | #include "sysdep.h" | 
|---|
| 22 | #include "libbfd.h" | 
|---|
| 23 | #include "elf-bfd.h" | 
|---|
| 24 |  | 
|---|
| 25 | /* This does not include any relocation information, but should be | 
|---|
| 26 | good enough for GDB or objdump to read the file.  */ | 
|---|
| 27 |  | 
|---|
| 28 | static reloc_howto_type dummy = | 
|---|
| 29 | HOWTO (0,                     /* type */ | 
|---|
| 30 | 0,                     /* rightshift */ | 
|---|
| 31 | 0,                     /* size (0 = byte, 1 = short, 2 = long) */ | 
|---|
| 32 | 0,                     /* bitsize */ | 
|---|
| 33 | false,                 /* pc_relative */ | 
|---|
| 34 | 0,                     /* bitpos */ | 
|---|
| 35 | complain_overflow_dont, /* complain_on_overflow */ | 
|---|
| 36 | NULL,                  /* special_function */ | 
|---|
| 37 | "UNKNOWN",             /* name */ | 
|---|
| 38 | false,                 /* partial_inplace */ | 
|---|
| 39 | 0,                     /* src_mask */ | 
|---|
| 40 | 0,                     /* dst_mask */ | 
|---|
| 41 | false);                /* pcrel_offset */ | 
|---|
| 42 |  | 
|---|
| 43 | static void | 
|---|
| 44 | elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc) | 
|---|
| 45 | bfd *abfd ATTRIBUTE_UNUSED; | 
|---|
| 46 | arelent *bfd_reloc; | 
|---|
| 47 | Elf32_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED; | 
|---|
| 48 | { | 
|---|
| 49 | bfd_reloc->howto = &dummy; | 
|---|
| 50 | } | 
|---|
| 51 |  | 
|---|
| 52 | static void | 
|---|
| 53 | elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc) | 
|---|
| 54 | bfd *abfd ATTRIBUTE_UNUSED; | 
|---|
| 55 | arelent *bfd_reloc; | 
|---|
| 56 | Elf32_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED; | 
|---|
| 57 | { | 
|---|
| 58 | bfd_reloc->howto = &dummy; | 
|---|
| 59 | } | 
|---|
| 60 |  | 
|---|
| 61 | static boolean | 
|---|
| 62 | elf32_generic_link_add_symbols (abfd, info) | 
|---|
| 63 | bfd *abfd; | 
|---|
| 64 | struct bfd_link_info *info; | 
|---|
| 65 | { | 
|---|
| 66 | asection *o; | 
|---|
| 67 |  | 
|---|
| 68 | /* Check if there are any relocations.  */ | 
|---|
| 69 | for (o = abfd->sections; o != NULL; o = o->next) | 
|---|
| 70 | if ((o->flags & SEC_RELOC) != 0) | 
|---|
| 71 | { | 
|---|
| 72 | Elf_Internal_Ehdr *ehdrp; | 
|---|
| 73 |  | 
|---|
| 74 | ehdrp = elf_elfheader (abfd); | 
|---|
| 75 | if (abfd->my_archive) | 
|---|
| 76 | (*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"), | 
|---|
| 77 | bfd_get_filename (abfd->my_archive), | 
|---|
| 78 | bfd_get_filename (abfd), | 
|---|
| 79 | ehdrp->e_machine); | 
|---|
| 80 | else | 
|---|
| 81 | (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), | 
|---|
| 82 | bfd_get_filename (abfd), | 
|---|
| 83 | ehdrp->e_machine); | 
|---|
| 84 |  | 
|---|
| 85 | bfd_set_error (bfd_error_wrong_format); | 
|---|
| 86 | return false; | 
|---|
| 87 | } | 
|---|
| 88 |  | 
|---|
| 89 | return bfd_elf32_bfd_link_add_symbols (abfd, info); | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|
| 92 | #define TARGET_LITTLE_SYM               bfd_elf32_little_generic_vec | 
|---|
| 93 | #define TARGET_LITTLE_NAME              "elf32-little" | 
|---|
| 94 | #define TARGET_BIG_SYM                  bfd_elf32_big_generic_vec | 
|---|
| 95 | #define TARGET_BIG_NAME                 "elf32-big" | 
|---|
| 96 | #define ELF_ARCH                        bfd_arch_unknown | 
|---|
| 97 | #define ELF_MACHINE_CODE                EM_NONE | 
|---|
| 98 | #define ELF_MAXPAGESIZE                 0x1 | 
|---|
| 99 | #define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup | 
|---|
| 100 | #define bfd_elf32_bfd_link_add_symbols  elf32_generic_link_add_symbols | 
|---|
| 101 | #define elf_info_to_howto               elf_generic_info_to_howto | 
|---|
| 102 | #define elf_info_to_howto_rel           elf_generic_info_to_howto_rel | 
|---|
| 103 |  | 
|---|
| 104 | #include "elf32-target.h" | 
|---|