1
/* BFD library support routines for the H8/500 architecture.
2
Copyright 1993, 1995, 2000, 2001 Free Software Foundation, Inc.
3
Hacked by Steve Chamberlain of Cygnus Support.
5
This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
25
static boolean scan_mach PARAMS ((const struct bfd_arch_info *, const char *));
29
Relocations for the Z8K
32
static bfd_reloc_status_type
33
howto16_callback (abfd, reloc_entry, symbol_in, data,
34
ignore_input_section, ignore_bfd)
37
struct symbol_cache_entry *symbol_in;
39
asection *ignore_input_section;
43
bfd_vma addr = reloc_entry->address;
44
long x = bfd_get_16 (abfd, (bfd_byte *)data + addr);
46
HOWTO_PREPARE(relocation, symbol_in);
48
x = (x + relocation + reloc_entry->addend);
50
bfd_put_16 (abfd, x, (bfd_byte *)data + addr);
54
static bfd_reloc_status_type
55
howto8_callback (abfd, reloc_entry, symbol_in, data,
56
ignore_input_section, ignore_bfd)
59
struct symbol_cache_entry *symbol_in;
61
asection *ignore_input_section;
65
bfd_vma addr = reloc_entry->address;
66
long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
68
HOWTO_PREPARE(relocation, symbol_in);
70
x = (x + relocation + reloc_entry->addend);
72
bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
76
static bfd_reloc_status_type
77
howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
78
ignore_input_section, ignore_bfd)
81
struct symbol_cache_entry *symbol_in;
83
asection *ignore_input_section;
87
bfd_vma addr = reloc_entry->address;
89
long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
91
HOWTO_PREPARE(relocation, symbol_in);
93
x = (x + relocation + reloc_entry->addend);
95
bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
99
static bfd_reloc_status_type
100
howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
101
ignore_input_section, ignore_bfd)
103
arelent *reloc_entry;
104
struct symbol_cache_entry *symbol_in;
106
asection *ignore_input_section;
110
bfd_vma addr = reloc_entry->address;
111
long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
113
HOWTO_PREPARE(relocation, symbol_in);
115
x = (x + relocation + reloc_entry->addend);
117
bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
121
static reloc_howto_type howto_16
122
= NEWHOWTO(howto16_callback,"abs16",1,false,false);
123
static reloc_howto_type howto_8
124
= NEWHOWTO(howto8_callback,"abs8",0,false,false);
126
static reloc_howto_type howto_8_FFnn
127
= NEWHOWTO(howto8_FFnn_callback,"ff00+abs8",0,false,false);
129
static reloc_howto_type howto_8_pcrel
130
= NEWHOWTO(howto8_pcrel_callback,"pcrel8",0,false,true);
132
static reloc_howto_type *
133
local_bfd_reloc_type_lookup (arch, code)
134
const struct bfd_arch_info *arch;
135
bfd_reloc_code_real_type code;
140
case BFD_RELOC_8_FFnn:
141
return &howto_8_FFnn;
144
case BFD_RELOC_8_PCREL:
145
return &howto_8_pcrel;
147
return (reloc_howto_type *)NULL;
152
scan_mach (info, string)
153
const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
156
if (strcmp(string,"h8/500") == 0) return true;
157
if (strcmp(string,"H8/500") == 0) return true;
158
if (strcmp(string,"h8500") == 0) return true;
159
if (strcmp(string,"H8500") == 0) return true;
163
#if 0 /* not used currently */
164
/* This routine is provided two arch_infos and returns whether
165
they'd be compatible */
167
static const bfd_arch_info_type *
169
const bfd_arch_info_type *a;
170
const bfd_arch_info_type *b;
172
if (a->arch != b->arch || a->mach != b->mach)
178
const bfd_arch_info_type bfd_h8500_arch =
180
16, /* 16 bits in a word */
181
24, /* 24 bits in an address */
182
8, /* 8 bits in a byte */
184
0, /* only 1 machine */
185
"h8500", /* arch_name */
186
"h8500", /* printable name */
188
true, /* the default machine */
189
bfd_default_compatible,