* Makefile.in: Only supply TARGET_DEFAULTS to targets.c, reducing
[deliverable/binutils-gdb.git] / bfd / coff-m88k.c
CommitLineData
a7fe4c59
SC
1/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
2
3This file is part of BFD, the Binary File Diddler.
4
5BFD is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 1, or (at your option)
8any later version.
9
10BFD is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BFD; see the file COPYING. If not, write to
17the 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
50static bfd_reloc_status_enum_type
a6ac0c59 51DEFUN(howto_hvrt16,(abfd, reloc_entry, symbol_in, data, ignore_input_section),
4cddd1c9
SC
52bfd *abfd AND
53arelent *reloc_entry AND
54asymbol *symbol_in AND
55unsigned char *data AND
56asection *ignore_input_section)
57{
58 long relocation;
59 bfd_vma addr = reloc_entry->address;
19b03b7a 60 long x = bfd_get_16(abfd, (bfd_byte *)data + addr);
4cddd1c9
SC
61
62 HOWTO_PREPARE(relocation, symbol_in);
63
64 x = (x + relocation + reloc_entry->addend) >> 16;
65
19b03b7a 66 bfd_put_16(abfd, x, (bfd_byte *)data + addr);
4cddd1c9
SC
67 return bfd_reloc_ok;
68}
69
a7fe4c59
SC
70
71
72static 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)
2700c3c7 85#include "coffcode.h"
a7fe4c59
SC
86
87
88
9872a49c
SC
89
90#define coff_write_armap bsd_write_armap
91
92
a7fe4c59
SC
93bfd_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
19b03b7a
SC
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 */
a7fe4c59
SC
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
2700c3c7
SC
118 JUMP_TABLE(coff),
119COFF_SWAP_TABLE
2b1d8a50 120};
This page took 0.036785 seconds and 4 git commands to generate.