4 * Definitions for Acorn Object Format
6 * © 1993-1998 Straylight
9 /*----- Licensing note ----------------------------------------------------*
11 * This file is part of Straylight's AOF library (aoflib).
13 * Aoflib is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * Aoflib is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with Aoflib. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #define aof_RELOC (0xC5E2D080ul) /* Relocatable object type */
35 unsigned long type; /* Type of object file */
36 int version; /* Version number of the format */
37 int areas; /* Number of AREAs defined */
38 int symbols; /* Number of symbols in table */
39 int entryArea; /* Index of AREA with ENTRY att */
40 int entryOff; /* Offset in AREA for ENTRY */
46 int name; /* AREA name (OBJ_STRT offset) */
48 int alignment :8; /* AREA alignment (must be 2) */
50 int :1; /* Reserved bit */
51 int code :1; /* AREA contains code */
52 int common :1; /* Common AREA definition */
53 int commonRef :1; /* Reference to common AREA */
54 int zinit :1; /* AREA is zero-initialised */
55 int readonly :1; /* AREA is (sort-of) readonly */
56 int :1; /* Reserved bit */
57 int debug :1; /* AREA contains debug tables */
58 int :16; /* Reserved shortword */
60 int size; /* Size of this AREA */
61 int relocs; /* Number of relocations */
62 int :32; /* Reserved word */
68 aof_fixedHeader hdr; /* The fixed header info */
69 aof_areaEntry table[1]; /* AREA table (unsized array) */
75 int name; /* Name string table entry */
77 int defined :1; /* Symbol defined in file */
78 int export :1; /* Symbol is exported globally */
79 int absolute :1; /* Symbol not relative to AREA */
80 int ignoreCase :1; /* Symbol is not case sensitive */
81 int weak :1; /* Symbol is weak external ref */
82 int strong :1; /* Symbol is strong global */
83 int common :1; /* Symbol is in a common AREA */
84 int :32-7; /* Pad out to integer boundary */
86 int value; /* Value of the symbol */
87 int area; /* Offset of AREA name */
93 int offset; /* Offset of word to relocate */
98 int symbol :16; /* Symbol to relocate by/to */
99 int field :2; /* Field size to alter */
100 int type :1; /* Relocation type */
101 int symreloc :1; /* Relocation is symbol-relative*/
102 int :12; /* Reserved bits */
104 type_1; /* Type 1 relocation directive */
108 int symbol :24; /* Symbol to relocate by/to */
109 int field :2; /* Field size to alter */
110 int type :1; /* Relocation type */
111 int symreloc :1; /* Relocation is symbol-relative*/
112 int :3; /* Reserved bits */
113 int set_me :1; /* Set this bit for type 2 */
115 type_2; /* Type 2 relocation directive */
136 char *p; /* Pointer to string table */
137 int size; /* Current allocated size */
138 int next; /* Next position to fill */
147 aof_chunkinfo *reloc;
151 int aof_fillBlock(void *p,size_t offset,size_t l,aof_chunkinfo *i);
153 int aof_addBlock(void *p,size_t l,aof_chunkinfo *i);
155 #define aof_string(string,i) \
156 (aof_addBlock(string,strlen(string)+1,i))
157 #define aof_add(z,i) \
158 (aof_addBlock(&(z),sizeof(z),i))
159 #define aof_fill(z,o,i) \
160 (aof_fillBlock(&(z),o,sizeof(z),i))
161 #define aof_int(x,i) \
162 (aof_addBlock((o=x,&o),sizeof(int),i))
163 #define aof_byte(x,i) \
164 (aof_addBlock((o=x,&o),1,i))
165 #define aof_align(i) \
166 (aof_addBlock((o=0,&o),(4-i.next)&3,&i))
168 int aof_branch(int from,int to);
170 void aof_reloc(char *name,int offset,int weak,aof_file *f);
172 void aof_reloc_b(char *name,int offset,aof_file *f);
174 void aof_roff(int offset,aof_file *f);
176 void aof_addsym(char *name,int offset,int local,int area,aof_file *f);