Beginnings of a crude utility to dump the contents of an OMF file
[nasm/avx512.git] / output / outform.h
blob24a4e1b15d2337e36977fce054aecc377196db45
1 /* ----------------------------------------------------------------------- *
2 *
3 * Copyright 1996-2009 The NASM Authors - All Rights Reserved
4 * See the file AUTHORS included with the NASM distribution for
5 * the specific copyright holders.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following
9 * conditions are met:
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * ----------------------------------------------------------------------- */
35 * outform.h header file for binding output format drivers to the
36 * remainder of the code in the Netwide Assembler
40 * This header file allows configuration of which output formats
41 * get compiled into the NASM binary. You can configure by defining
42 * various preprocessor symbols beginning with "OF_", either on the
43 * compiler command line or at the top of this file.
45 * OF_ONLY -- only include specified object formats
46 * OF_name -- ensure that output format 'name' is included
47 * OF_NO_name -- remove output format 'name'
48 * OF_DOS -- ensure that 'obj', 'bin' & 'win32' are included.
49 * OF_UNIX -- ensure that 'aout', 'aoutb', 'coff', 'elf32' 'elf64' are in.
50 * OF_OTHERS -- ensure that 'bin', 'as86' & 'rdf' are in.
51 * OF_ALL -- ensure that all formats are included.
52 * note that this doesn't include 'dbg', which is
53 * only really useful if you're doing development
54 * work on NASM. Define OF_DBG if you want this.
56 * OF_DEFAULT=of_name -- ensure that 'name' is the default format.
58 * eg: -DOF_UNIX -DOF_ELF32 -DOF_DEFAULT=of_elf32 would be a suitable config
59 * for an average linux system.
61 * Default config = -DOF_ALL -DOF_DEFAULT=of_bin
63 * You probably only want to set these options while compiling 'nasm.c'. */
65 #ifndef NASM_OUTFORM_H
66 #define NASM_OUTFORM_H
68 #include "nasm.h"
70 /* -------------- USER MODIFIABLE PART ---------------- */
73 * Insert #defines here in accordance with the configuration
74 * instructions above.
76 * E.g.
78 * #define OF_ONLY
79 * #define OF_OBJ
80 * #define OF_BIN
82 * for a 16-bit DOS assembler with no extraneous formats.
85 /* ------------ END USER MODIFIABLE PART -------------- */
87 /* ====configurable info begins here==== */
88 /* formats configurable:
89 * bin,obj,elf32,elf64,aout,aoutb,coff,win32,as86,rdf2,macho */
91 /* process options... */
93 #ifndef OF_ONLY
94 #ifndef OF_ALL
95 #define OF_ALL /* default is to have all formats */
96 #endif
97 #endif
99 #ifdef OF_ALL /* set all formats on... */
100 #ifndef OF_BIN
101 #define OF_BIN
102 #endif
103 #ifndef OF_OBJ
104 #define OF_OBJ
105 #endif
106 #ifndef OF_ELF32
107 #define OF_ELF32
108 #endif
109 #ifndef OF_ELF64
110 #define OF_ELF64
111 #endif
112 #ifndef OF_COFF
113 #define OF_COFF
114 #endif
115 #ifndef OF_AOUT
116 #define OF_AOUT
117 #endif
118 #ifndef OF_AOUTB
119 #define OF_AOUTB
120 #endif
121 #ifndef OF_WIN32
122 #define OF_WIN32
123 #endif
124 #ifndef OF_WIN64
125 #define OF_WIN64
126 #endif
127 #ifndef OF_AS86
128 #define OF_AS86
129 #endif
130 #ifndef OF_RDF2
131 #define OF_RDF2
132 #endif
133 #ifndef OF_IEEE
134 #define OF_IEEE
135 #endif
136 #ifndef OF_MACHO
137 #define OF_MACHO
138 #endif
139 #ifndef OF_DBG
140 #define OF_DBG
141 #endif
142 #endif /* OF_ALL */
144 /* turn on groups of formats specified.... */
145 #ifdef OF_DOS
146 #ifndef OF_OBJ
147 #define OF_OBJ
148 #endif
149 #ifndef OF_BIN
150 #define OF_BIN
151 #endif
152 #ifndef OF_COFF
153 #define OF_COFF /* COFF is used by DJGPP */
154 #endif
155 #ifndef OF_WIN32
156 #define OF_WIN32
157 #endif
158 #ifndef OF_WIN64
159 #define OF_WIN64
160 #endif
161 #endif
163 #ifdef OF_UNIX
164 #ifndef OF_AOUT
165 #define OF_AOUT
166 #endif
167 #ifndef OF_AOUTB
168 #define OF_AOUTB
169 #endif
170 #ifndef OF_COFF
171 #define OF_COFF
172 #endif
173 #ifndef OF_ELF32
174 #define OF_ELF32
175 #endif
176 #ifndef OF_ELF64
177 #define OF_ELF64
178 #endif
179 #endif
181 #ifdef OF_OTHERS
182 #ifndef OF_BIN
183 #define OF_BIN
184 #endif
185 #ifndef OF_AS86
186 #define OF_AS86
187 #endif
188 #ifndef OF_RDF2
189 #define OF_RDF2
190 #endif
191 #ifndef OF_IEEE
192 #define OF_IEEE
193 #endif
194 #ifndef OF_MACHO
195 #define OF_MACHO
196 #endif
197 #endif
199 /* finally... override any format specifically specified to be off */
200 #ifdef OF_NO_BIN
201 #undef OF_BIN
202 #endif
203 #ifdef OF_NO_OBJ
204 #undef OF_OBJ
205 #endif
206 #ifdef OF_NO_ELF32
207 #undef OF_ELF32
208 #endif
209 #ifdef OF_NO_ELF64
210 #undef OF_ELF64
211 #endif
212 #ifdef OF_NO_AOUT
213 #undef OF_AOUT
214 #endif
215 #ifdef OF_NO_AOUTB
216 #undef OF_AOUTB
217 #endif
218 #ifdef OF_NO_COFF
219 #undef OF_COFF
220 #endif
221 #ifdef OF_NO_WIN32
222 #undef OF_WIN32
223 #endif
224 #ifdef OF_NO_WIN64
225 #undef OF_WIN64
226 #endif
227 #ifdef OF_NO_AS86
228 #undef OF_AS86
229 #endif
230 #ifdef OF_NO_RDF2
231 #undef OF_RDF
232 #endif
233 #ifdef OF_NO_IEEE
234 #undef OF_IEEE
235 #endif
236 #ifdef OF_NO_MACHO
237 #undef OF_MACHO
238 #endif
239 #ifdef OF_NO_DBG
240 #undef OF_DBG
241 #endif
243 #ifndef OF_DEFAULT
244 #define OF_DEFAULT of_bin
245 #endif
247 #ifdef BUILD_DRIVERS_ARRAY /* only if included from outform.c */
249 /* pull in the externs for the different formats, then make the *drivers
250 * array based on the above defines */
252 extern struct ofmt of_bin;
253 extern struct ofmt of_aout;
254 extern struct ofmt of_aoutb;
255 extern struct ofmt of_coff;
256 extern struct ofmt of_elf32;
257 extern struct ofmt of_elf;
258 extern struct ofmt of_elf64;
259 extern struct ofmt of_as86;
260 extern struct ofmt of_obj;
261 extern struct ofmt of_win32;
262 extern struct ofmt of_win64;
263 extern struct ofmt of_rdf2;
264 extern struct ofmt of_ieee;
265 extern struct ofmt of_macho;
266 extern struct ofmt of_dbg;
268 struct ofmt *drivers[] = {
269 #ifdef OF_BIN
270 &of_bin,
271 #endif
272 #ifdef OF_AOUT
273 &of_aout,
274 #endif
275 #ifdef OF_AOUTB
276 &of_aoutb,
277 #endif
278 #ifdef OF_COFF
279 &of_coff,
280 #endif
281 #ifdef OF_ELF32
282 &of_elf32,
283 &of_elf,
284 #endif
285 #ifdef OF_ELF64
286 &of_elf64,
287 #endif
288 #ifdef OF_AS86
289 &of_as86,
290 #endif
291 #ifdef OF_OBJ
292 &of_obj,
293 #endif
294 #ifdef OF_WIN32
295 &of_win32,
296 #endif
297 #ifdef OF_WIN64
298 &of_win64,
299 #endif
300 #ifdef OF_RDF2
301 &of_rdf2,
302 #endif
303 #ifdef OF_IEEE
304 &of_ieee,
305 #endif
306 #ifdef OF_MACHO
307 &of_macho,
308 #endif
309 #ifdef OF_DBG
310 &of_dbg,
311 #endif
313 NULL
316 #endif /* BUILD_DRIVERS_ARRAY */
318 struct ofmt *ofmt_find(char *);
319 struct dfmt *dfmt_find(struct ofmt *, char *);
320 void ofmt_list(struct ofmt *, FILE *);
321 void dfmt_list(struct ofmt *ofmt, FILE * fp);
322 struct ofmt *ofmt_register(efunc error);
323 extern struct dfmt null_debug_form;
325 #endif /* NASM_OUTFORM_H */