1 | /* BFD library support routines for the H8/500 architecture.
|
---|
2 | Copyright 1993, 1995, 2000 Free Software Foundation, Inc.
|
---|
3 | Hacked by Steve Chamberlain of Cygnus Support.
|
---|
4 |
|
---|
5 | This file is part of BFD, the Binary File Descriptor library.
|
---|
6 |
|
---|
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.
|
---|
11 |
|
---|
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.
|
---|
16 |
|
---|
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
|
---|
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
---|
20 |
|
---|
21 | #include "bfd.h"
|
---|
22 | #include "sysdep.h"
|
---|
23 | #include "libbfd.h"
|
---|
24 |
|
---|
25 | #if 0
|
---|
26 |
|
---|
27 | /*
|
---|
28 | Relocations for the Z8K
|
---|
29 |
|
---|
30 | */
|
---|
31 | static bfd_reloc_status_type
|
---|
32 | howto16_callback (abfd, reloc_entry, symbol_in, data,
|
---|
33 | ignore_input_section, ignore_bfd)
|
---|
34 | bfd *abfd;
|
---|
35 | arelent *reloc_entry;
|
---|
36 | struct symbol_cache_entry *symbol_in;
|
---|
37 | PTR data;
|
---|
38 | asection *ignore_input_section;
|
---|
39 | bfd *ignore_bfd;
|
---|
40 | {
|
---|
41 | long relocation = 0;
|
---|
42 | bfd_vma addr = reloc_entry->address;
|
---|
43 | long x = bfd_get_16 (abfd, (bfd_byte *)data + addr);
|
---|
44 |
|
---|
45 | HOWTO_PREPARE(relocation, symbol_in);
|
---|
46 |
|
---|
47 | x = (x + relocation + reloc_entry->addend);
|
---|
48 |
|
---|
49 | bfd_put_16 (abfd, x, (bfd_byte *)data + addr);
|
---|
50 | return bfd_reloc_ok;
|
---|
51 | }
|
---|
52 |
|
---|
53 | static bfd_reloc_status_type
|
---|
54 | howto8_callback (abfd, reloc_entry, symbol_in, data,
|
---|
55 | ignore_input_section, ignore_bfd)
|
---|
56 | bfd *abfd;
|
---|
57 | arelent *reloc_entry;
|
---|
58 | struct symbol_cache_entry *symbol_in;
|
---|
59 | PTR data;
|
---|
60 | asection *ignore_input_section;
|
---|
61 | bfd *ignore_bfd;
|
---|
62 | {
|
---|
63 | long relocation = 0;
|
---|
64 | bfd_vma addr = reloc_entry->address;
|
---|
65 | long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
|
---|
66 |
|
---|
67 | HOWTO_PREPARE(relocation, symbol_in);
|
---|
68 |
|
---|
69 | x = (x + relocation + reloc_entry->addend);
|
---|
70 |
|
---|
71 | bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
|
---|
72 | return bfd_reloc_ok;
|
---|
73 | }
|
---|
74 |
|
---|
75 | static bfd_reloc_status_type
|
---|
76 | howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
|
---|
77 | ignore_input_section, ignore_bfd)
|
---|
78 | bfd *abfd;
|
---|
79 | arelent *reloc_entry;
|
---|
80 | struct symbol_cache_entry *symbol_in;
|
---|
81 | PTR data;
|
---|
82 | asection *ignore_input_section;
|
---|
83 | bfd *ignore_bfd;
|
---|
84 | {
|
---|
85 | long relocation = 0;
|
---|
86 | bfd_vma addr = reloc_entry->address;
|
---|
87 |
|
---|
88 | long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
|
---|
89 | abort ();
|
---|
90 | HOWTO_PREPARE(relocation, symbol_in);
|
---|
91 |
|
---|
92 | x = (x + relocation + reloc_entry->addend);
|
---|
93 |
|
---|
94 | bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
|
---|
95 | return bfd_reloc_ok;
|
---|
96 | }
|
---|
97 |
|
---|
98 | static bfd_reloc_status_type
|
---|
99 | howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
|
---|
100 | ignore_input_section, ignore_bfd)
|
---|
101 | bfd *abfd;
|
---|
102 | arelent *reloc_entry;
|
---|
103 | struct symbol_cache_entry *symbol_in;
|
---|
104 | PTR data;
|
---|
105 | asection *ignore_input_section;
|
---|
106 | bfd *ignore_bfd;
|
---|
107 | {
|
---|
108 | long relocation = 0;
|
---|
109 | bfd_vma addr = reloc_entry->address;
|
---|
110 | long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
|
---|
111 | abort ();
|
---|
112 | HOWTO_PREPARE(relocation, symbol_in);
|
---|
113 |
|
---|
114 | x = (x + relocation + reloc_entry->addend);
|
---|
115 |
|
---|
116 | bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
|
---|
117 | return bfd_reloc_ok;
|
---|
118 | }
|
---|
119 |
|
---|
120 | static reloc_howto_type howto_16
|
---|
121 | = NEWHOWTO(howto16_callback,"abs16",1,false,false);
|
---|
122 | static reloc_howto_type howto_8
|
---|
123 | = NEWHOWTO(howto8_callback,"abs8",0,false,false);
|
---|
124 |
|
---|
125 | static reloc_howto_type howto_8_FFnn
|
---|
126 | = NEWHOWTO(howto8_FFnn_callback,"ff00+abs8",0,false,false);
|
---|
127 |
|
---|
128 | static reloc_howto_type howto_8_pcrel
|
---|
129 | = NEWHOWTO(howto8_pcrel_callback,"pcrel8",0,false,true);
|
---|
130 |
|
---|
131 | static reloc_howto_type *
|
---|
132 | local_bfd_reloc_type_lookup (arch, code)
|
---|
133 | const struct bfd_arch_info *arch;
|
---|
134 | bfd_reloc_code_real_type code;
|
---|
135 | {
|
---|
136 | switch (code) {
|
---|
137 | case BFD_RELOC_16:
|
---|
138 | return &howto_16;
|
---|
139 | case BFD_RELOC_8_FFnn:
|
---|
140 | return &howto_8_FFnn;
|
---|
141 | case BFD_RELOC_8:
|
---|
142 | return &howto_8;
|
---|
143 | case BFD_RELOC_8_PCREL:
|
---|
144 | return &howto_8_pcrel;
|
---|
145 | }
|
---|
146 | return (reloc_howto_type *)NULL;
|
---|
147 | }
|
---|
148 | #endif
|
---|
149 |
|
---|
150 | int bfd_default_scan_num_mach();
|
---|
151 |
|
---|
152 | static boolean
|
---|
153 | scan_mach (info, string)
|
---|
154 | const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
|
---|
155 | const char *string;
|
---|
156 | {
|
---|
157 | if (strcmp(string,"h8/500") == 0) return true;
|
---|
158 | if (strcmp(string,"H8/500") == 0) return true;
|
---|
159 | if (strcmp(string,"h8500") == 0) return true;
|
---|
160 | if (strcmp(string,"H8500") == 0) return true;
|
---|
161 | return false;
|
---|
162 | }
|
---|
163 |
|
---|
164 | #if 0 /* not used currently */
|
---|
165 | /* This routine is provided two arch_infos and returns whether
|
---|
166 | they'd be compatible */
|
---|
167 |
|
---|
168 | static const bfd_arch_info_type *
|
---|
169 | compatible (a,b)
|
---|
170 | const bfd_arch_info_type *a;
|
---|
171 | const bfd_arch_info_type *b;
|
---|
172 | {
|
---|
173 | if (a->arch != b->arch || a->mach != b->mach)
|
---|
174 | return NULL;
|
---|
175 | return a;
|
---|
176 | }
|
---|
177 | #endif
|
---|
178 |
|
---|
179 | const bfd_arch_info_type bfd_h8500_arch =
|
---|
180 | {
|
---|
181 | 16, /* 16 bits in a word */
|
---|
182 | 24, /* 24 bits in an address */
|
---|
183 | 8, /* 8 bits in a byte */
|
---|
184 | bfd_arch_h8500,
|
---|
185 | 0, /* only 1 machine */
|
---|
186 | "h8500", /* arch_name */
|
---|
187 | "h8500", /* printable name */
|
---|
188 | 1,
|
---|
189 | true, /* the default machine */
|
---|
190 | bfd_default_compatible,
|
---|
191 | scan_mach,
|
---|
192 | 0,
|
---|
193 | };
|
---|