1 |
578 |
markom |
/* COFF specification for OpenRISC 1000.
|
2 |
|
|
Copyright (C) 1993-2000 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by David Wood @ New York University.
|
4 |
|
|
Modified by Johan Rydberg, <johan.rydberg@netinsight.se>
|
5 |
|
|
|
6 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
7 |
|
|
|
8 |
|
|
This program is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
This program is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with this program; if not, write to the Free Software
|
20 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
21 |
|
|
|
22 |
|
|
#ifndef OR32
|
23 |
|
|
# define OR32
|
24 |
|
|
#endif
|
25 |
|
|
|
26 |
|
|
#define L_LNNO_SIZE 2
|
27 |
|
|
#define INCLUDE_COMDAT_FIELDS_IN_AUXENT
|
28 |
|
|
#include "coff/external.h"
|
29 |
|
|
|
30 |
|
|
/* Magic numbers for OpenRISC 1000. As it is know we use the
|
31 |
|
|
numbers for Am29000.
|
32 |
|
|
|
33 |
|
|
(AT&T will assign the "real" magic number) */
|
34 |
|
|
#define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB) */
|
35 |
|
|
#define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB) */
|
36 |
|
|
|
37 |
|
|
#define OR32_MAGIC_BIG SIPFBOMAGIC
|
38 |
|
|
#define OR32_MAGIC_LITTLE SIPRBOMAGIC
|
39 |
|
|
#define OR32BADMAG(x) (((x).f_magic!=OR32_MAGIC_BIG) && \
|
40 |
|
|
((x).f_magic!=OR32_MAGIC_LITTLE))
|
41 |
|
|
|
42 |
|
|
#define OMAGIC OR32_MAGIC_BIG
|
43 |
|
|
|
44 |
|
|
/* aouthdr magic numbers */
|
45 |
|
|
#define NMAGIC 0410 /* separate i/d executable */
|
46 |
|
|
#define SHMAGIC 0406 /* NYU/Ultra3 shared data executable
|
47 |
|
|
(writable text) */
|
48 |
|
|
#undef _ETEXT
|
49 |
|
|
#define _ETEXT "_etext"
|
50 |
|
|
|
51 |
|
|
#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
|
52 |
|
|
#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
|
53 |
|
|
#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
|
54 |
|
|
|
55 |
|
|
/*
|
56 |
|
|
** Relocation information declaration and related definitions
|
57 |
|
|
*/
|
58 |
|
|
|
59 |
|
|
struct external_reloc
|
60 |
|
|
{
|
61 |
|
|
char r_vaddr[4]; /* (virtual) address of reference */
|
62 |
|
|
char r_symndx[4]; /* index into symbol table */
|
63 |
|
|
char r_type[2]; /* relocation type */
|
64 |
|
|
};
|
65 |
|
|
|
66 |
|
|
#define RELOC struct external_reloc
|
67 |
|
|
#define RELSZ 10 /* sizeof (RELOC) */
|
68 |
|
|
|
69 |
|
|
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
|
70 |
|
|
|
71 |
|
|
/*
|
72 |
|
|
** Relocation types for the Am29000
|
73 |
|
|
*/
|
74 |
|
|
|
75 |
|
|
#define R_ABS 0 /* reference is absolute */
|
76 |
|
|
|
77 |
|
|
#define R_IREL 030 /* instruction relative (jmp/call) */
|
78 |
|
|
#define R_IABS 031 /* instruction absolute (jmp/call) */
|
79 |
|
|
#define R_ILOHALF 032 /* instruction low half (const) */
|
80 |
|
|
#define R_IHIHALF 033 /* instruction high half (consth) part 1 */
|
81 |
|
|
#define R_IHCONST 034 /* instruction high half (consth) part 2 */
|
82 |
|
|
/* constant offset of R_IHIHALF relocation */
|
83 |
|
|
#define R_BYTE 035 /* relocatable byte value */
|
84 |
|
|
#define R_HWORD 036 /* relocatable halfword value */
|
85 |
|
|
#define R_WORD 037 /* relocatable word value */
|
86 |
|
|
|
87 |
|
|
#define R_IGLBLRC 040 /* instruction global register RC */
|
88 |
|
|
#define R_IGLBLRA 041 /* instruction global register RA */
|
89 |
|
|
#define R_IGLBLRB 042 /* instruction global register RB */
|
90 |
|
|
|
91 |
|
|
/*
|
92 |
|
|
NOTE:
|
93 |
|
|
All the "I" forms refer to 29000 instruction formats. The linker is
|
94 |
|
|
expected to know how the numeric information is split and/or aligned
|
95 |
|
|
within the instruction word(s). R_BYTE works for instructions, too.
|
96 |
|
|
|
97 |
|
|
If the parameter to a CONSTH instruction is a relocatable type, two
|
98 |
|
|
relocation records are written. The first has an r_type of R_IHIHALF
|
99 |
|
|
(33 octal) and a normal r_vaddr and r_symndx. The second relocation
|
100 |
|
|
record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which
|
101 |
|
|
is redundant), and an r_symndx containing the 32-bit constant offset
|
102 |
|
|
to the relocation instead of the actual symbol table index. This
|
103 |
|
|
second record is always written, even if the constant offset is zero.
|
104 |
|
|
The constant fields of the instruction are set to zero.
|
105 |
|
|
*/
|
106 |
|
|
|
107 |
|
|
/*--------------------------------------------------------------*/
|
108 |
|
|
|
109 |
|
|
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
|
110 |
|
|
|
111 |
|
|
/*
|
112 |
|
|
** Storage class definitions - new classes for global registers.
|
113 |
|
|
*/
|
114 |
|
|
|
115 |
|
|
#define C_GLBLREG 19 /* global register */
|
116 |
|
|
#define C_EXTREG 20 /* external global register */
|
117 |
|
|
#define C_DEFREG 21 /* ext. def. of global register */
|