xref: /openbsd/gnu/usr.bin/binutils/bfd/coff-we32k.c (revision 007c2a45)
12159047fSniklas /* BFD back-end for we32k COFF files.
2*007c2a45Smiod    Copyright 1992, 1993, 1994, 1999, 2000, 2002, 2003
3c074d1c9Sdrahn    Free Software Foundation, Inc.
42159047fSniklas    Contributed by Brendan Kehoe (brendan@cs.widener.edu).
52159047fSniklas 
62159047fSniklas This file is part of BFD, the Binary File Descriptor library.
72159047fSniklas 
82159047fSniklas This program is free software; you can redistribute it and/or modify
92159047fSniklas it under the terms of the GNU General Public License as published by
102159047fSniklas the Free Software Foundation; either version 2 of the License, or
112159047fSniklas (at your option) any later version.
122159047fSniklas 
132159047fSniklas This program is distributed in the hope that it will be useful,
142159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
152159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
162159047fSniklas GNU General Public License for more details.
172159047fSniklas 
182159047fSniklas You should have received a copy of the GNU General Public License
192159047fSniklas along with this program; if not, write to the Free Software
202159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
212159047fSniklas 
222159047fSniklas #include "bfd.h"
232159047fSniklas #include "sysdep.h"
242159047fSniklas #include "libbfd.h"
252159047fSniklas #include "coff/we32k.h"
262159047fSniklas #include "coff/internal.h"
272159047fSniklas #include "libcoff.h"
282159047fSniklas 
292159047fSniklas #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
302159047fSniklas 
312159047fSniklas static reloc_howto_type howto_table[] =
322159047fSniklas {
33b305b0f1Sespie     EMPTY_HOWTO (0),
34b305b0f1Sespie     EMPTY_HOWTO (1),
35b305b0f1Sespie     EMPTY_HOWTO (2),
36b305b0f1Sespie     EMPTY_HOWTO (3),
37b305b0f1Sespie     EMPTY_HOWTO (4),
38b305b0f1Sespie     EMPTY_HOWTO (5),
39c074d1c9Sdrahn   HOWTO(R_DIR32,	       0,  2, 	32, FALSE, 0,complain_overflow_bitfield, 0, "dir32",	TRUE, 0xffffffff,0xffffffff, FALSE),
40b305b0f1Sespie     EMPTY_HOWTO (7),
41b305b0f1Sespie     EMPTY_HOWTO (010),
42b305b0f1Sespie     EMPTY_HOWTO (011),
43b305b0f1Sespie     EMPTY_HOWTO (012),
44b305b0f1Sespie     EMPTY_HOWTO (013),
45b305b0f1Sespie     EMPTY_HOWTO (014),
46b305b0f1Sespie     EMPTY_HOWTO (015),
47b305b0f1Sespie     EMPTY_HOWTO (016),
48c074d1c9Sdrahn   HOWTO(R_RELBYTE,	       0,  0,  	8,  FALSE, 0, complain_overflow_bitfield, 0, "8",	TRUE, 0x000000ff,0x000000ff, FALSE),
49c074d1c9Sdrahn   HOWTO(R_RELWORD,	       0,  1, 	16, FALSE, 0, complain_overflow_bitfield, 0, "16",	TRUE, 0x0000ffff,0x0000ffff, FALSE),
50c074d1c9Sdrahn   HOWTO(R_RELLONG,	       0,  2, 	32, FALSE, 0, complain_overflow_bitfield, 0, "32",	TRUE, 0xffffffff,0xffffffff, FALSE),
51c074d1c9Sdrahn   HOWTO(R_PCRBYTE,	       0,  0, 	8,  TRUE,  0, complain_overflow_signed, 0, "DISP8",    TRUE, 0x000000ff,0x000000ff, FALSE),
52c074d1c9Sdrahn   HOWTO(R_PCRWORD,	       0,  1, 	16, TRUE,  0, complain_overflow_signed, 0, "DISP16",   TRUE, 0x0000ffff,0x0000ffff, FALSE),
53c074d1c9Sdrahn   HOWTO(R_PCRLONG,	       0,  2, 	32, TRUE,  0, complain_overflow_signed, 0, "DISP32",   TRUE, 0xffffffff,0xffffffff, FALSE),
542159047fSniklas };
552159047fSniklas 
562159047fSniklas /* Turn a howto into a reloc  nunmber */
572159047fSniklas 
582159047fSniklas #define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
592159047fSniklas #define BADMAG(x) WE32KBADMAG(x)
602159047fSniklas #define WE32K	1
612159047fSniklas 
622159047fSniklas #define RTYPE2HOWTO(cache_ptr, dst) \
632159047fSniklas 	    (cache_ptr)->howto = howto_table + (dst)->r_type;
642159047fSniklas 
652159047fSniklas #include "coffcode.h"
662159047fSniklas 
672159047fSniklas #define coff_write_armap bsd_write_armap
682159047fSniklas 
69*007c2a45Smiod CREATE_BIG_COFF_TARGET_VEC (we32kcoff_vec, "coff-we32k", 0, 0, 0, NULL, COFF_SWAP_TABLE)
70