]>
Commit | Line | Data |
---|---|---|
a7fe4c59 SC |
1 | /* Copyright (C) 1990, 1991 Free Software Foundation, Inc. |
2 | ||
3 | This file is part of BFD, the Binary File Diddler. | |
4 | ||
5 | BFD is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 1, or (at your option) | |
8 | any later version. | |
9 | ||
10 | BFD is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with BFD; see the file COPYING. If not, write to | |
17 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 | ||
19 | ||
20 | /* $Id$ */ | |
21 | ||
22 | #define M88 1 | |
23 | #include <ansidecl.h> | |
24 | #include <sysdep.h> | |
25 | #include "bfd.h" | |
26 | #include "libbfd.h" | |
9872a49c | 27 | #include "obstack.h" |
a7fe4c59 | 28 | #include "m88k-bcs.h" |
9872a49c SC |
29 | #include "libcoff.h" |
30 | ||
4cddd1c9 SC |
31 | /* Provided the symbol, returns the value reffed */ |
32 | #define HOWTO_PREPARE(relocation, symbol) \ | |
33 | { \ | |
34 | if (symbol != (asymbol *)NULL) { \ | |
35 | if (symbol->flags & BSF_FORT_COMM) { \ | |
36 | relocation = 0; \ | |
37 | } \ | |
38 | else { \ | |
39 | relocation = symbol->value; \ | |
40 | } \ | |
41 | } \ | |
42 | if (symbol->section != (asection *)NULL) { \ | |
43 | relocation += symbol->section->output_section->vma + \ | |
44 | symbol->section->output_offset; \ | |
45 | } \ | |
46 | } | |
47 | ||
48 | ||
49 | ||
50 | static bfd_reloc_status_enum_type | |
a6ac0c59 | 51 | DEFUN(howto_hvrt16,(abfd, reloc_entry, symbol_in, data, ignore_input_section), |
4cddd1c9 SC |
52 | bfd *abfd AND |
53 | arelent *reloc_entry AND | |
54 | asymbol *symbol_in AND | |
55 | unsigned char *data AND | |
56 | asection *ignore_input_section) | |
57 | { | |
58 | long relocation; | |
59 | bfd_vma addr = reloc_entry->address; | |
60 | long x = bfd_getshort(abfd, (bfd_byte *)data + addr); | |
61 | ||
62 | HOWTO_PREPARE(relocation, symbol_in); | |
63 | ||
64 | x = (x + relocation + reloc_entry->addend) >> 16; | |
65 | ||
66 | bfd_putshort(abfd, x, (bfd_byte *)data + addr); | |
67 | return bfd_reloc_ok; | |
68 | } | |
69 | ||
a7fe4c59 SC |
70 | |
71 | ||
72 | static reloc_howto_type howto_table[] = | |
73 | { | |
4cddd1c9 SC |
74 | HOWTO(R_PCR16L,02,1,16,true, 0,false,true,0,"PCR16L",false,0x0000ffff,0x0000ffff,true), |
75 | HOWTO(R_PCR26L,02,2,16,true, 0,false,true,0,"PCR26L",false,0x03ffffff,0x03ffffff,true), | |
76 | HOWTO(R_VRT16, 00,1,16,false,0,false,true,0,"VRT16", false,0x0000ffff,0x0000ffff,true), | |
77 | HOWTO(R_HVRT16,16,1,16,false,0,false,true,howto_hvrt16,"HVRT16",false,0x0000ffff,0x0000ffff,true), | |
78 | HOWTO(R_LVRT16,00,1,16,false,0,false,true,0,"LVRT16",false,0x0000ffff,0x0000ffff,true), | |
79 | HOWTO(R_VRT32, 00,2,32,false,0,false,true,0,"VRT32", false,0xffffffff,0xffffffff,true), | |
a7fe4c59 SC |
80 | }; |
81 | ||
82 | ||
83 | ||
84 | #define BADMAG(x) MC88BADMAG(x) | |
85 | #include "coff-code.h" | |
86 | ||
87 | ||
88 | ||
9872a49c SC |
89 | |
90 | #define coff_write_armap bsd_write_armap | |
91 | ||
92 | ||
a7fe4c59 SC |
93 | bfd_target m88k_bcs_vec = |
94 | { | |
9872a49c | 95 | "m88kbcs", /* name */ |
a7fe4c59 | 96 | bfd_target_coff_flavour_enum, |
9872a49c | 97 | true, /* data byte order is big */ |
a7fe4c59 SC |
98 | true, /* header byte order is big */ |
99 | ||
100 | (HAS_RELOC | EXEC_P | /* object flags */ | |
101 | HAS_LINENO | HAS_DEBUG | | |
102 | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT), | |
103 | ||
104 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ | |
a7fe4c59 SC |
105 | '/', /* ar_pad_char */ |
106 | 15, /* ar_max_namelen */ | |
a7fe4c59 | 107 | |
4cddd1c9 | 108 | _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* data */ |
a7fe4c59 SC |
109 | _do_getblong, _do_putblong, _do_getbshort, _do_putbshort, /* hdrs */ |
110 | ||
111 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ | |
112 | bfd_generic_archive_p, _bfd_dummy_target}, | |
113 | {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ | |
114 | bfd_false}, | |
2b1d8a50 JG |
115 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ |
116 | _bfd_write_archive_contents, bfd_false}, | |
9872a49c | 117 | |
2b1d8a50 JG |
118 | JUMP_TABLE(coff) |
119 | }; |