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