1 /* ----------------------------------------------------------------------- *
3 * Copyright 1996-2011 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
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
70 /* -------------- USER MODIFIABLE PART ---------------- */
73 * Insert #defines here in accordance with the configuration
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... */
95 #define OF_ALL /* default is to have all formats */
99 #ifdef OF_ALL /* set all formats on... */
150 /* turn on groups of formats specified.... */
159 #define OF_COFF /* COFF is used by DJGPP */
211 /* finally... override any format specifically specified to be off */
262 #define OF_DEFAULT of_bin
265 extern const struct ofmt of_bin
;
266 extern const struct ofmt of_ith
;
267 extern const struct ofmt of_srec
;
268 extern const struct ofmt of_aout
;
269 extern const struct ofmt of_aoutb
;
270 extern const struct ofmt of_coff
;
271 extern const struct ofmt of_elf32
;
272 extern const struct ofmt of_elfx32
;
273 extern const struct ofmt of_elf64
;
274 extern const struct ofmt of_as86
;
275 extern const struct ofmt of_obj
;
276 extern const struct ofmt of_win32
;
277 extern const struct ofmt of_win64
;
278 extern const struct ofmt of_rdf2
;
279 extern const struct ofmt of_ieee
;
280 extern const struct ofmt of_macho32
;
281 extern const struct ofmt of_macho64
;
282 extern const struct ofmt of_dbg
;
284 #ifdef BUILD_DRIVERS_ARRAY /* only if included from outform.c */
287 * pull in the externs for the different formats, then make the
288 * drivers array based on the above defines
291 static const struct ofmt
* const drivers
[] = {
346 static const struct ofmt_alias ofmt_aliases
[] = {
348 { "elf", &of_elf32
},
351 { "macho", &of_macho32
},
354 { "win", &of_win32
},
359 #endif /* BUILD_DRIVERS_ARRAY */
361 const struct ofmt
*ofmt_find(const char *name
, const struct ofmt_alias
**ofmt_alias
);
362 const struct dfmt
*dfmt_find(const struct ofmt
*, const char *);
363 void ofmt_list(const struct ofmt
*, FILE *);
364 void dfmt_list(FILE *);
365 extern const struct dfmt null_debug_form
;
367 #endif /* NASM_OUTFORM_H */