nasm/outform.h

290 lines
5.7 KiB
C
Raw Normal View History

2002-05-01 04:51:32 +08:00
/* outform.h header file for binding output format drivers to the
* remainder of the code in the Netwide Assembler
*
* The Netwide Assembler is copyright (C) 1996 Simon Tatham and
* Julian Hall. All rights reserved. The software is
* redistributable under the license given in the file "LICENSE"
2002-05-01 04:51:32 +08:00
* distributed in the NASM archive.
*/
/*
* This header file allows configuration of which output formats
* get compiled into the NASM binary. You can configure by defining
* various preprocessor symbols beginning with "OF_", either on the
* compiler command line or at the top of this file.
*
* OF_ONLY -- only include specified object formats
* OF_name -- ensure that output format 'name' is included
* OF_NO_name -- remove output format 'name'
* OF_DOS -- ensure that 'obj', 'bin' & 'win32' are included.
2007-04-28 14:18:48 +08:00
* OF_UNIX -- ensure that 'aout', 'aoutb', 'coff', 'elf32' 'elf64' are in.
2002-05-01 04:52:49 +08:00
* OF_OTHERS -- ensure that 'bin', 'as86' & 'rdf' are in.
2002-05-01 04:51:32 +08:00
* OF_ALL -- ensure that all formats are included.
2002-05-01 04:53:55 +08:00
* note that this doesn't include 'dbg', which is
* only really useful if you're doing development
* work on NASM. Define OF_DBG if you want this.
2002-05-01 04:51:32 +08:00
*
* OF_DEFAULT=of_name -- ensure that 'name' is the default format.
*
2007-04-28 14:18:48 +08:00
* eg: -DOF_UNIX -DOF_ELF32 -DOF_DEFAULT=of_elf32 would be a suitable config
2002-05-01 04:51:32 +08:00
* for an average linux system.
*
* Default config = -DOF_ALL -DOF_DEFAULT=of_bin
*
* You probably only want to set these options while compiling 'nasm.c'. */
#ifndef NASM_OUTFORM_H
#define NASM_OUTFORM_H
#include "nasm.h"
/* -------------- USER MODIFIABLE PART ---------------- */
/*
* Insert #defines here in accordance with the configuration
* instructions above.
*
* E.g.
*
* #define OF_ONLY
* #define OF_OBJ
* #define OF_BIN
*
* for a 16-bit DOS assembler with no extraneous formats.
*/
/* ------------ END USER MODIFIABLE PART -------------- */
/* ====configurable info begins here==== */
/* formats configurable:
2007-04-28 14:18:48 +08:00
* bin,obj,elf32,elf64,aout,aoutb,coff,win32,as86,rdf2,macho */
2002-05-01 04:51:32 +08:00
/* process options... */
#ifndef OF_ONLY
#ifndef OF_ALL
2005-01-16 06:15:51 +08:00
#define OF_ALL /* default is to have all formats */
2002-05-01 04:51:32 +08:00
#endif
#endif
2005-01-16 06:15:51 +08:00
#ifdef OF_ALL /* set all formats on... */
2002-05-01 04:51:32 +08:00
#ifndef OF_BIN
#define OF_BIN
#endif
#ifndef OF_OBJ
#define OF_OBJ
#endif
2007-04-28 14:18:48 +08:00
#ifndef OF_ELF32
#define OF_ELF32
#endif
#ifndef OF_ELF64
#define OF_ELF64
2002-05-01 04:51:32 +08:00
#endif
#ifndef OF_COFF
#define OF_COFF
#endif
#ifndef OF_AOUT
#define OF_AOUT
#endif
2002-05-01 04:52:49 +08:00
#ifndef OF_AOUTB
#define OF_AOUTB
#endif
2002-05-01 04:51:32 +08:00
#ifndef OF_WIN32
#define OF_WIN32
#endif
#ifndef OF_WIN64
#define OF_WIN64
#endif
2002-05-01 04:51:32 +08:00
#ifndef OF_AS86
#define OF_AS86
#endif
2002-05-01 04:53:55 +08:00
#ifndef OF_RDF2
#define OF_RDF2
2002-05-01 04:51:32 +08:00
#endif
2002-05-01 04:54:58 +08:00
#ifndef OF_IEEE
#define OF_IEEE
#endif
#ifndef OF_MACHO
#define OF_MACHO
#endif
2005-01-16 06:15:51 +08:00
#endif /* OF_ALL */
2002-05-01 04:51:32 +08:00
/* turn on groups of formats specified.... */
#ifdef OF_DOS
#ifndef OF_OBJ
#define OF_OBJ
#endif
#ifndef OF_BIN
#define OF_BIN
#endif
#ifndef OF_COFF
#define OF_COFF /* COFF is used by DJGPP */
#endif
2002-05-01 04:51:32 +08:00
#ifndef OF_WIN32
#define OF_WIN32
#endif
#ifndef OF_WIN64
#define OF_WIN64
#endif
2002-05-01 04:51:32 +08:00
#endif
#ifdef OF_UNIX
#ifndef OF_AOUT
#define OF_AOUT
#endif
2002-05-01 04:52:49 +08:00
#ifndef OF_AOUTB
#define OF_AOUTB
#endif
2002-05-01 04:51:32 +08:00
#ifndef OF_COFF
#define OF_COFF
#endif
2007-04-28 14:18:48 +08:00
#ifndef OF_ELF32
#define OF_ELF32
#endif
#ifndef OF_ELF64
#define OF_ELF64
2002-05-01 04:51:32 +08:00
#endif
#endif
#ifdef OF_OTHERS
#ifndef OF_BIN
#define OF_BIN
#endif
#ifndef OF_AS86
#define OF_AS86
#endif
2002-05-01 04:53:55 +08:00
#ifndef OF_RDF2
#define OF_RDF2
#endif
2002-05-01 04:54:58 +08:00
#ifndef OF_IEEE
#define OF_IEEE
#endif
#ifndef OF_MACHO
#define OF_MACHO
#endif
2002-05-01 04:51:32 +08:00
#endif
2002-05-01 05:01:08 +08:00
/* finally... override any format specifically specified to be off */
2002-05-01 04:51:32 +08:00
#ifdef OF_NO_BIN
#undef OF_BIN
#endif
#ifdef OF_NO_OBJ
#undef OF_OBJ
#endif
2007-04-28 14:18:48 +08:00
#ifdef OF_NO_ELF32
#undef OF_ELF32
#endif
#ifdef OF_NO_ELF64
#undef OF_ELF64
2002-05-01 04:51:32 +08:00
#endif
#ifdef OF_NO_AOUT
#undef OF_AOUT
#endif
2002-05-01 04:52:49 +08:00
#ifdef OF_NO_AOUTB
#undef OF_AOUTB
#endif
2002-05-01 04:51:32 +08:00
#ifdef OF_NO_COFF
#undef OF_COFF
#endif
#ifdef OF_NO_WIN32
#undef OF_WIN32
#endif
#ifdef OF_NO_WIN64
#undef OF_WIN64
#endif
2002-05-01 04:51:32 +08:00
#ifdef OF_NO_AS86
#undef OF_AS86
#endif
2002-05-01 04:53:55 +08:00
#ifdef OF_NO_RDF2
#undef OF_RDF
#endif
2002-05-01 04:58:18 +08:00
#ifdef OF_NO_IEEE
#undef OF_IEEE
#endif
#ifdef OF_NO_MACHO
#undef OF_MACHO
#endif
2002-05-01 04:51:32 +08:00
#ifndef OF_DEFAULT
#define OF_DEFAULT of_bin
#endif
2005-01-16 06:15:51 +08:00
#ifdef BUILD_DRIVERS_ARRAY /* only if included from outform.c */
2002-05-01 04:53:55 +08:00
/* pull in the externs for the different formats, then make the *drivers
* array based on the above defines */
extern struct ofmt of_bin;
extern struct ofmt of_aout;
extern struct ofmt of_aoutb;
extern struct ofmt of_coff;
2007-04-28 14:18:48 +08:00
extern struct ofmt of_elf32;
extern struct ofmt of_elf;
2007-04-28 14:18:48 +08:00
extern struct ofmt of_elf64;
2002-05-01 04:53:55 +08:00
extern struct ofmt of_as86;
extern struct ofmt of_obj;
extern struct ofmt of_win32;
extern struct ofmt of_win64;
2002-05-01 04:53:55 +08:00
extern struct ofmt of_rdf2;
2002-05-01 04:54:58 +08:00
extern struct ofmt of_ieee;
extern struct ofmt of_macho;
2002-05-01 04:53:55 +08:00
extern struct ofmt of_dbg;
2005-01-16 06:15:51 +08:00
struct ofmt *drivers[] = {
2002-05-01 04:53:55 +08:00
#ifdef OF_BIN
&of_bin,
#endif
#ifdef OF_AOUT
&of_aout,
#endif
#ifdef OF_AOUTB
&of_aoutb,
#endif
#ifdef OF_COFF
&of_coff,
#endif
2007-04-28 14:18:48 +08:00
#ifdef OF_ELF32
&of_elf32,
&of_elf,
2007-04-28 14:18:48 +08:00
#endif
#ifdef OF_ELF64
&of_elf64,
2002-05-01 04:53:55 +08:00
#endif
#ifdef OF_AS86
&of_as86,
#endif
#ifdef OF_OBJ
&of_obj,
#endif
#ifdef OF_WIN32
&of_win32,
#endif
#ifdef OF_WIN64
&of_win64,
#endif
2002-05-01 04:53:55 +08:00
#ifdef OF_RDF2
&of_rdf2,
#endif
2002-05-01 04:54:58 +08:00
#ifdef OF_IEEE
&of_ieee,
#endif
#ifdef OF_MACHO
&of_macho,
#endif
2002-05-01 04:53:55 +08:00
#ifdef OF_DBG
&of_dbg,
#endif
2005-01-16 06:15:51 +08:00
NULL
2002-05-01 04:53:55 +08:00
};
2005-01-16 06:15:51 +08:00
#endif /* BUILD_DRIVERS_ARRAY */
2002-05-01 04:53:55 +08:00
struct ofmt *ofmt_find(char *);
struct dfmt *dfmt_find(struct ofmt *, char *);
2002-05-01 04:53:55 +08:00
void ofmt_list(struct ofmt *, FILE *);
2005-01-16 06:15:51 +08:00
void dfmt_list(struct ofmt *ofmt, FILE * fp);
struct ofmt *ofmt_register(efunc error);
2002-05-01 04:53:55 +08:00
2005-01-16 06:15:51 +08:00
#endif /* NASM_OUTFORM_H */