NASM 2.09.06
[nasm/avx512.git] / output / outform.h
blobe703d99c6d0ab8be64252af64b57392a7fee91b0
1 /* ----------------------------------------------------------------------- *
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' & 'win64' are included.
49 * OF_UNIX -- ensure that 'aout', 'aoutb', 'coff', 'elf32' & 'elf64' are in.
50 * OF_OTHERS -- ensure that 'bin', 'as86', 'rdf' 'macho32' & 'macho64' 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,macho32,macho64 */
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_MACHO32
137 #define OF_MACHO32
138 #endif
139 #ifndef OF_MACHO64
140 #define OF_MACHO64
141 #endif
142 #ifndef OF_DBG
143 #define OF_DBG
144 #endif
145 #endif /* OF_ALL */
147 /* turn on groups of formats specified.... */
148 #ifdef OF_DOS
149 #ifndef OF_OBJ
150 #define OF_OBJ
151 #endif
152 #ifndef OF_BIN
153 #define OF_BIN
154 #endif
155 #ifndef OF_COFF
156 #define OF_COFF /* COFF is used by DJGPP */
157 #endif
158 #ifndef OF_WIN32
159 #define OF_WIN32
160 #endif
161 #ifndef OF_WIN64
162 #define OF_WIN64
163 #endif
164 #endif
166 #ifdef OF_UNIX
167 #ifndef OF_AOUT
168 #define OF_AOUT
169 #endif
170 #ifndef OF_AOUTB
171 #define OF_AOUTB
172 #endif
173 #ifndef OF_COFF
174 #define OF_COFF
175 #endif
176 #ifndef OF_ELF32
177 #define OF_ELF32
178 #endif
179 #ifndef OF_ELF64
180 #define OF_ELF64
181 #endif
182 #endif
184 #ifdef OF_OTHERS
185 #ifndef OF_BIN
186 #define OF_BIN
187 #endif
188 #ifndef OF_AS86
189 #define OF_AS86
190 #endif
191 #ifndef OF_RDF2
192 #define OF_RDF2
193 #endif
194 #ifndef OF_IEEE
195 #define OF_IEEE
196 #endif
197 #ifndef OF_MACHO32
198 #define OF_MACHO32
199 #endif
200 #ifndef OF_MACHO64
201 #define OF_MACHO64
202 #endif
203 #endif
205 /* finally... override any format specifically specified to be off */
206 #ifdef OF_NO_BIN
207 #undef OF_BIN
208 #endif
209 #ifdef OF_NO_OBJ
210 #undef OF_OBJ
211 #endif
212 #ifdef OF_NO_ELF32
213 #undef OF_ELF32
214 #endif
215 #ifdef OF_NO_ELF64
216 #undef OF_ELF64
217 #endif
218 #ifdef OF_NO_AOUT
219 #undef OF_AOUT
220 #endif
221 #ifdef OF_NO_AOUTB
222 #undef OF_AOUTB
223 #endif
224 #ifdef OF_NO_COFF
225 #undef OF_COFF
226 #endif
227 #ifdef OF_NO_WIN32
228 #undef OF_WIN32
229 #endif
230 #ifdef OF_NO_WIN64
231 #undef OF_WIN64
232 #endif
233 #ifdef OF_NO_AS86
234 #undef OF_AS86
235 #endif
236 #ifdef OF_NO_RDF2
237 #undef OF_RDF2
238 #endif
239 #ifdef OF_NO_IEEE
240 #undef OF_IEEE
241 #endif
242 #ifdef OF_NO_MACHO32
243 #undef OF_MACHO32
244 #endif
245 #ifdef OF_NO_MACHO64
246 #undef OF_MACHO64
247 #endif
248 #ifdef OF_NO_DBG
249 #undef OF_DBG
250 #endif
252 #ifndef OF_DEFAULT
253 #define OF_DEFAULT of_bin
254 #endif
256 extern struct ofmt of_bin;
257 extern struct ofmt of_ith;
258 extern struct ofmt of_srec;
259 extern struct ofmt of_aout;
260 extern struct ofmt of_aoutb;
261 extern struct ofmt of_coff;
262 extern struct ofmt of_elf32;
263 extern struct ofmt of_elf64;
264 extern struct ofmt of_as86;
265 extern struct ofmt of_obj;
266 extern struct ofmt of_win32;
267 extern struct ofmt of_win64;
268 extern struct ofmt of_rdf2;
269 extern struct ofmt of_ieee;
270 extern struct ofmt of_macho32;
271 extern struct ofmt of_macho64;
272 extern struct ofmt of_dbg;
274 #ifdef BUILD_DRIVERS_ARRAY /* only if included from outform.c */
277 * pull in the externs for the different formats, then make the
278 * drivers array based on the above defines
281 static struct ofmt *drivers[] = {
282 #ifdef OF_BIN
283 &of_bin,
284 &of_ith,
285 &of_srec,
286 #endif
287 #ifdef OF_AOUT
288 &of_aout,
289 #endif
290 #ifdef OF_AOUTB
291 &of_aoutb,
292 #endif
293 #ifdef OF_COFF
294 &of_coff,
295 #endif
296 #ifdef OF_ELF32
297 &of_elf32,
298 #endif
299 #ifdef OF_ELF64
300 &of_elf64,
301 #endif
302 #ifdef OF_AS86
303 &of_as86,
304 #endif
305 #ifdef OF_OBJ
306 &of_obj,
307 #endif
308 #ifdef OF_WIN32
309 &of_win32,
310 #endif
311 #ifdef OF_WIN64
312 &of_win64,
313 #endif
314 #ifdef OF_RDF2
315 &of_rdf2,
316 #endif
317 #ifdef OF_IEEE
318 &of_ieee,
319 #endif
320 #ifdef OF_MACHO32
321 &of_macho32,
322 #endif
323 #ifdef OF_MACHO64
324 &of_macho64,
325 #endif
326 #ifdef OF_DBG
327 &of_dbg,
328 #endif
330 NULL
333 static struct ofmt_alias {
334 const char *shortname;
335 const char *fullname;
336 struct ofmt *ofmt;
337 } ofmt_aliases[] = {
338 #ifdef OF_ELF32
340 "elf",
341 "ELF (short name for ELF32)",
342 &of_elf32,
344 #endif
345 #ifdef OF_MACHO32
347 "macho",
348 "MACHO (short name for MACHO32)",
349 &of_macho32,
351 #endif
352 #ifdef OF_WIN32
354 "win",
355 "WIN (short name for WIN32)",
356 &of_win32,
358 #endif
359 { NULL, NULL, NULL }
362 #endif /* BUILD_DRIVERS_ARRAY */
364 struct ofmt *ofmt_find(char *);
365 struct dfmt *dfmt_find(struct ofmt *, char *);
366 void ofmt_list(struct ofmt *, FILE *);
367 void dfmt_list(struct ofmt *ofmt, FILE * fp);
368 struct ofmt *ofmt_register(efunc error);
369 extern struct dfmt null_debug_form;
371 #endif /* NASM_OUTFORM_H */