Touches most files in bfd/, so likely will be blamed for everything..
[deliverable/binutils-gdb.git] / bfd / elf32-gen.c
CommitLineData
252b5132 1/* Generic support for 32-bit ELF
a7b97311 2 Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc.
252b5132
RH
3
4This file is part of BFD, the Binary File Descriptor library.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, 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
28static 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
a7b97311
AM
43static void elf_generic_info_to_howto
44 PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
45static void elf_generic_info_to_howto_rel
46 PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
47static boolean elf32_generic_link_add_symbols
48 PARAMS ((bfd *, struct bfd_link_info *));
49
252b5132
RH
50static void
51elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
7442e600 52 bfd *abfd ATTRIBUTE_UNUSED;
252b5132 53 arelent *bfd_reloc;
7442e600 54 Elf32_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
252b5132
RH
55{
56 bfd_reloc->howto = &dummy;
57}
58
59static void
60elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
7442e600 61 bfd *abfd ATTRIBUTE_UNUSED;
252b5132 62 arelent *bfd_reloc;
7442e600 63 Elf32_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
252b5132
RH
64{
65 bfd_reloc->howto = &dummy;
66}
67
dc810e39 68static boolean
eb4a6e4f
L
69elf32_generic_link_add_symbols (abfd, info)
70 bfd *abfd;
b9d88996 71 struct bfd_link_info *info;
eb4a6e4f
L
72{
73 asection *o;
74
75 /* Check if there are any relocations. */
76 for (o = abfd->sections; o != NULL; o = o->next)
77 if ((o->flags & SEC_RELOC) != 0)
78 {
79 Elf_Internal_Ehdr *ehdrp;
80
81 ehdrp = elf_elfheader (abfd);
82 if (abfd->my_archive)
83 (*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"),
84 bfd_get_filename (abfd->my_archive),
85 bfd_get_filename (abfd),
86 ehdrp->e_machine);
87 else
88 (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
89 bfd_get_filename (abfd),
90 ehdrp->e_machine);
91
92 bfd_set_error (bfd_error_wrong_format);
93 return false;
94 }
95
96 return bfd_elf32_bfd_link_add_symbols (abfd, info);
97}
98
252b5132
RH
99#define TARGET_LITTLE_SYM bfd_elf32_little_generic_vec
100#define TARGET_LITTLE_NAME "elf32-little"
101#define TARGET_BIG_SYM bfd_elf32_big_generic_vec
102#define TARGET_BIG_NAME "elf32-big"
103#define ELF_ARCH bfd_arch_unknown
104#define ELF_MACHINE_CODE EM_NONE
79e5982f 105#define ELF_MAXPAGESIZE 0x1
252b5132 106#define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
eb4a6e4f 107#define bfd_elf32_bfd_link_add_symbols elf32_generic_link_add_symbols
252b5132
RH
108#define elf_info_to_howto elf_generic_info_to_howto
109#define elf_info_to_howto_rel elf_generic_info_to_howto_rel
110
111#include "elf32-target.h"
This page took 0.104997 seconds and 4 git commands to generate.