* coff-mips.c, coffcode.h: Peter Schauer's patch to kludge in
[external/binutils.git] / bfd / coff-mips.c
1 /* MIPS Extended-Coff back-end for BFD.
2    Copyright (C) 1990-1991 Free Software Foundation, Inc.
3    Written by Per Bothner.
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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
20
21 #include "bfd.h"
22 #include "sysdep.h"
23 #include "libbfd.h"
24 #include "coff-mips.h"
25 #include "internalcoff.h"
26 #include "libcoff.h"            /* to allow easier abstraction-breaking */
27 #include "trad-core.h"
28
29 #define BADMAG(x) ECOFFBADMAG(x)
30
31 /* Define NO_COFF_SYMBOLS and NO_COFF_LINENOS to avoid coffcode.h
32    defining a mess of useless functions.  */
33 #define NO_COFF_SYMBOLS
34 #define NO_COFF_LINENOS
35 /* Define MIPS to get MIPS magic numbers and such */
36 #define MIPS 1
37 /* Define additional MIPS section types */
38 #define STYP_OTHER_LOAD 0x98000300
39 #include "coffcode.h"
40
41 /* We do not implement symbols for ecoff. */
42 #define coff_get_symtab_upper_bound (PROTO(unsigned int, (*),(bfd *)))bfd_false
43 #define coff_get_symtab  (PROTO(unsigned int, (*), (bfd *, asymbol **)))bfd_0
44 #define coff_print_symbol \
45     (PROTO(void,(*),(bfd *, PTR, asymbol *, enum bfd_print_symbol))) bfd_void
46 #define coff_swap_sym_in (PROTO(void,(*),(bfd *,PTR,PTR))) bfd_void
47 #define coff_swap_aux_in (PROTO(void,(*),(bfd *,PTR,int,int,PTR))) bfd_void
48 #define coff_swap_sym_out (PROTO(unsigned,(*),(bfd *,PTR,PTR))) bfd_void
49 #define coff_swap_aux_out (PROTO(unsigned,(*),(bfd *,PTR,int,int,PTR))) bfd_void
50
51 /* We do not implement linenos for ecoff. */
52 #define coff_get_lineno (struct lineno_cache_entry *(*)()) bfd_nullvoidptr
53 #define coff_swap_lineno_in (PROTO(void,(*),(bfd *,PTR,PTR))) bfd_void
54 #define coff_find_nearest_line (PROTO(boolean, (*),(bfd*,asection*,asymbol**,bfd_vma, CONST char**, CONST char**, unsigned int *))) bfd_false
55 #define coff_swap_lineno_out  (PROTO(unsigned,(*),(bfd *,PTR,PTR))) bfd_void
56 bfd_target ecoff_little_vec =
57     {"ecoff-littlemips",      /* name */
58         bfd_target_coff_flavour,
59         false,                  /* data byte order is little */
60         false,                  /* header byte order is little */
61
62         (HAS_RELOC | EXEC_P |   /* object flags */
63          HAS_LINENO | HAS_DEBUG |
64          HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
65
66         (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
67         '/',                    /* ar_pad_char */
68         15,                     /* ar_max_namelen */
69            3,                   /* minimum alignment power */
70 _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* data */
71 _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs */
72
73         {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
74           bfd_generic_archive_p, _bfd_dummy_target},
75         {bfd_false, coff_mkobject, bfd_false, /* bfd_set_format */
76           bfd_false},
77         {bfd_false, coff_write_object_contents, bfd_false, bfd_false},
78         JUMP_TABLE (coff)
79 };
80
81 bfd_target ecoff_big_vec =
82     {"ecoff-bigmips",      /* name */
83         bfd_target_coff_flavour,
84         true,                   /* data byte order is big */
85         true,                   /* header byte order is big */
86
87         (HAS_RELOC | EXEC_P |   /* object flags */
88          HAS_LINENO | HAS_DEBUG |
89          HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
90
91         (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */
92         ' ',                    /* ar_pad_char */
93         16,                     /* ar_max_namelen */
94            3,                   /* minimum alignment power */
95         _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
96         _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
97         {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
98           bfd_generic_archive_p, _bfd_dummy_target},
99         {bfd_false, coff_mkobject, bfd_false, /* bfd_set_format */
100           bfd_false},
101         {bfd_false, coff_write_object_contents, /* bfd_write_contents */
102           bfd_false, bfd_false},
103         JUMP_TABLE(coff),
104           COFF_SWAP_TABLE
105 };