511dfff44207bfcb27d5d15ff12b2561715b37fe
[deliverable/binutils-gdb.git] / bfd / coff-m88k.c
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"
27 #include "obstack.h"
28 #include "m88k-bcs.h"
29 #include "libcoff.h"
30
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
51 DEFUN(howto_hvrt16,(abfd, reloc_entry, symbol_in, data, ignore_input_section),
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_get_16(abfd, (bfd_byte *)data + addr);
61
62 HOWTO_PREPARE(relocation, symbol_in);
63
64 x = (x + relocation + reloc_entry->addend) >> 16;
65
66 bfd_put_16(abfd, x, (bfd_byte *)data + addr);
67 return bfd_reloc_ok;
68 }
69
70
71
72 static reloc_howto_type howto_table[] =
73 {
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),
80 };
81
82
83
84 #define BADMAG(x) MC88BADMAG(x)
85 #include "coffcode.h"
86
87
88
89
90 #define coff_write_armap bsd_write_armap
91
92
93 bfd_target m88k_bcs_vec =
94 {
95 "m88kbcs", /* name */
96 bfd_target_coff_flavour_enum,
97 true, /* data byte order is big */
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 */
105 '/', /* ar_pad_char */
106 15, /* ar_max_namelen */
107
108 _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
109 _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* 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},
115 {bfd_false, coff_write_object_contents, /* bfd_write_contents */
116 _bfd_write_archive_contents, bfd_false},
117
118 JUMP_TABLE(coff),
119 COFF_SWAP_TABLE
120 };
This page took 0.031763 seconds and 4 git commands to generate.