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... */
147 /* turn on groups of formats specified.... */
156 #define OF_COFF /* COFF is used by DJGPP */
205 /* finally... override any format specifically specified to be off */
253 #define OF_DEFAULT of_bin
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
[] = {
333 static struct ofmt_alias ofmt_aliases
[] = {
337 "ELF (short name for ELF32)",
344 "MACHO (short name for MACHO32)",
351 "WIN (short name for WIN32)",
358 #endif /* BUILD_DRIVERS_ARRAY */
360 struct ofmt
*ofmt_find(char *name
, struct ofmt_alias
**ofmt_alias
);
361 struct dfmt
*dfmt_find(struct ofmt
*, char *);
362 void ofmt_list(struct ofmt
*, FILE *);
363 void dfmt_list(struct ofmt
*ofmt
, FILE * fp
);
364 struct ofmt
*ofmt_register(efunc error
);
365 extern struct dfmt null_debug_form
;
367 #endif /* NASM_OUTFORM_H */