mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-30 16:41:05 +08:00
Add a generic pragma-handling infrastructure
Add infrastructure for handling %pragmas with a variety of namespaces, etc., etc... Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
bb4524cf9a
commit
a6e26d9cca
@ -107,6 +107,7 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
||||
asm/error.$(O) \
|
||||
asm/float.$(O) \
|
||||
asm/directiv.$(O) asm/directbl.$(O) \
|
||||
asm/pragma.$(O) \
|
||||
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
|
||||
asm/preproc.$(O) asm/quote.$(O) asm/pptok.$(O) \
|
||||
asm/listing.$(O) asm/eval.$(O) asm/exprlib.$(O) asm/exprdump.$(O) \
|
||||
@ -450,6 +451,11 @@ asm/parser.$(O): asm/parser.c asm/assemble.h asm/directiv.h asm/eval.h \
|
||||
asm/pptok.$(O): asm/pptok.c asm/pptok.h asm/preproc.h config/config.h \
|
||||
config/msvc.h config/unknown.h config/watcom.h include/compiler.h \
|
||||
include/hashtbl.h include/nasmint.h include/nasmlib.h
|
||||
asm/pragma.$(O): asm/pragma.c asm/directiv.h asm/pptok.h asm/preproc.h \
|
||||
config/config.h config/msvc.h config/unknown.h config/watcom.h \
|
||||
include/compiler.h include/error.h include/nasm.h include/nasmint.h \
|
||||
include/nasmlib.h include/opflags.h include/strlist.h include/tables.h \
|
||||
x86/insnsi.h x86/regs.h
|
||||
asm/preproc-nop.$(O): asm/preproc-nop.c asm/directiv.h asm/listing.h \
|
||||
asm/pptok.h asm/preproc.h config/config.h config/msvc.h config/unknown.h \
|
||||
config/watcom.h include/compiler.h include/error.h include/nasm.h \
|
||||
|
@ -75,6 +75,7 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
||||
asm/error.$(O) \
|
||||
asm/float.$(O) \
|
||||
asm/directiv.$(O) asm/directbl.$(O) \
|
||||
asm/pragma.$(O) \
|
||||
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
|
||||
asm/preproc.$(O) asm/quote.$(O) asm/pptok.$(O) \
|
||||
asm/listing.$(O) asm/eval.$(O) asm/exprlib.$(O) asm/exprdump.$(O) \
|
||||
@ -335,6 +336,11 @@ asm/parser.$(O): asm/parser.c asm/assemble.h asm/directiv.h asm/eval.h \
|
||||
asm/pptok.$(O): asm/pptok.c asm/pptok.h asm/preproc.h config/msvc.h \
|
||||
config/unknown.h config/watcom.h include/compiler.h include/hashtbl.h \
|
||||
include/nasmint.h include/nasmlib.h
|
||||
asm/pragma.$(O): asm/pragma.c asm/directiv.h asm/pptok.h asm/preproc.h \
|
||||
config/msvc.h config/unknown.h config/watcom.h include/compiler.h \
|
||||
include/error.h include/nasm.h include/nasmint.h include/nasmlib.h \
|
||||
include/opflags.h include/strlist.h include/tables.h x86/insnsi.h \
|
||||
x86/regs.h
|
||||
asm/preproc-nop.$(O): asm/preproc-nop.c asm/directiv.h asm/listing.h \
|
||||
asm/pptok.h asm/preproc.h config/msvc.h config/unknown.h config/watcom.h \
|
||||
include/compiler.h include/error.h include/nasm.h include/nasmint.h \
|
||||
|
@ -52,6 +52,7 @@ LIBOBJ = snprintf.o vsnprintf.o strlcpy.o \
|
||||
error.o \
|
||||
float.o \
|
||||
directiv.o directbl.o \
|
||||
pragma.o \
|
||||
assemble.o labels.o parser.o \
|
||||
preproc.o quote.o pptok.o \
|
||||
listing.o eval.o exprlib.o exprdump.o \
|
||||
@ -195,6 +196,9 @@ parser.o: parser.c assemble.h directiv.h eval.h float.h parser.h pptok.h \
|
||||
tables.h iflaggen.h insnsi.h regs.h
|
||||
pptok.o: pptok.c pptok.h preproc.h config.h msvc.h unknown.h watcom.h \
|
||||
compiler.h hashtbl.h nasmint.h nasmlib.h
|
||||
pragma.o: pragma.c directiv.h pptok.h preproc.h config.h msvc.h unknown.h \
|
||||
watcom.h compiler.h error.h nasm.h nasmint.h nasmlib.h opflags.h strlist.h \
|
||||
tables.h insnsi.h regs.h
|
||||
preproc-nop.o: preproc-nop.c directiv.h listing.h pptok.h preproc.h config.h \
|
||||
msvc.h unknown.h watcom.h compiler.h error.h nasm.h nasmint.h nasmlib.h \
|
||||
opflags.h strlist.h tables.h insnsi.h regs.h
|
||||
|
@ -68,6 +68,7 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) &
|
||||
asm/error.$(O) &
|
||||
asm/float.$(O) &
|
||||
asm/directiv.$(O) asm/directbl.$(O) &
|
||||
asm/pragma.$(O) &
|
||||
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) &
|
||||
asm/preproc.$(O) asm/quote.$(O) asm/pptok.$(O) &
|
||||
asm/listing.$(O) asm/eval.$(O) asm/exprlib.$(O) asm/exprdump.$(O) &
|
||||
@ -337,6 +338,11 @@ asm/parser.$(O): asm/parser.c asm/assemble.h asm/directiv.h asm/eval.h &
|
||||
asm/pptok.$(O): asm/pptok.c asm/pptok.h asm/preproc.h config/msvc.h &
|
||||
config/unknown.h config/watcom.h include/compiler.h include/hashtbl.h &
|
||||
include/nasmint.h include/nasmlib.h
|
||||
asm/pragma.$(O): asm/pragma.c asm/directiv.h asm/pptok.h asm/preproc.h &
|
||||
config/msvc.h config/unknown.h config/watcom.h include/compiler.h &
|
||||
include/error.h include/nasm.h include/nasmint.h include/nasmlib.h &
|
||||
include/opflags.h include/strlist.h include/tables.h x86/insnsi.h &
|
||||
x86/regs.h
|
||||
asm/preproc-nop.$(O): asm/preproc-nop.c asm/directiv.h asm/listing.h &
|
||||
asm/pptok.h asm/preproc.h config/msvc.h config/unknown.h config/watcom.h &
|
||||
include/compiler.h include/error.h include/nasm.h include/nasmint.h &
|
||||
|
@ -79,6 +79,7 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
||||
asm/error.$(O) \
|
||||
asm/float.$(O) \
|
||||
asm/directiv.$(O) asm/directbl.$(O) \
|
||||
asm/pragma.$(O) \
|
||||
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
|
||||
asm/preproc.$(O) asm/quote.$(O) asm/pptok.$(O) \
|
||||
asm/listing.$(O) asm/eval.$(O) asm/exprlib.$(O) asm/exprdump.$(O) \
|
||||
@ -327,6 +328,11 @@ asm/parser.$(O): asm/parser.c asm/assemble.h asm/directiv.h asm/eval.h \
|
||||
asm/pptok.$(O): asm/pptok.c asm/pptok.h asm/preproc.h config/config.h \
|
||||
config/msvc.h config/unknown.h config/watcom.h include/compiler.h \
|
||||
include/hashtbl.h include/nasmint.h include/nasmlib.h
|
||||
asm/pragma.$(O): asm/pragma.c asm/directiv.h asm/pptok.h asm/preproc.h \
|
||||
config/config.h config/msvc.h config/unknown.h config/watcom.h \
|
||||
include/compiler.h include/error.h include/nasm.h include/nasmint.h \
|
||||
include/nasmlib.h include/opflags.h include/strlist.h include/tables.h \
|
||||
x86/insnsi.h x86/regs.h
|
||||
asm/preproc-nop.$(O): asm/preproc-nop.c asm/directiv.h asm/listing.h \
|
||||
asm/pptok.h asm/preproc.h config/config.h config/msvc.h config/unknown.h \
|
||||
config/watcom.h include/compiler.h include/error.h include/nasm.h \
|
||||
|
@ -48,4 +48,7 @@ extern struct location absolute;
|
||||
int64_t insn_size(int32_t segment, int64_t offset, int bits, insn *instruction);
|
||||
int64_t assemble(int32_t segment, int64_t offset, int bits, insn *instruction);
|
||||
|
||||
bool process_directives(char *);
|
||||
void process_pragma(char *);
|
||||
|
||||
#endif
|
||||
|
@ -182,12 +182,12 @@ static enum directives parse_directive_line(char **directive, char **value)
|
||||
return find_directive(*directive);
|
||||
}
|
||||
|
||||
static void process_pragma(char *str)
|
||||
{
|
||||
(void)str;
|
||||
}
|
||||
|
||||
enum directives process_directives(char *directive)
|
||||
/*
|
||||
* Process a line from the assembler and try to handle it if it
|
||||
* is a directive. Return true if the line was handled (including
|
||||
* if it was an error), false otherwise.
|
||||
*/
|
||||
bool process_directives(char *directive)
|
||||
{
|
||||
enum directives d;
|
||||
char *value, *p, *q, *special;
|
||||
@ -563,5 +563,5 @@ enum directives process_directives(char *directive)
|
||||
directive);
|
||||
}
|
||||
|
||||
return d;
|
||||
return d != D_none;
|
||||
}
|
||||
|
@ -88,7 +88,6 @@ if ($output eq 'h') {
|
||||
printf H "extern const char * const directives[%d];\n",
|
||||
scalar(@directives)+scalar(@specials);
|
||||
print H "enum directives find_directive(const char *token);\n\n";
|
||||
print H "enum directives process_directives(char *line); /* in asm/directiv.c */\n";
|
||||
print H "#endif /* NASM_DIRECTIV_H */\n";
|
||||
} elsif ($output eq 'c') {
|
||||
%directive = ();
|
||||
|
@ -65,6 +65,9 @@ const struct warning warnings[ERR_WARN_MAX+1] = {
|
||||
{"bnd", "invalid bnd prefixes", true},
|
||||
{"zext-reloc", "relocation zero-extended to match output format", true},
|
||||
{"ptr", "non-NASM keyword used in other assemblers", true},
|
||||
{"bad-pragma", "empty or malformed %pragma", false},
|
||||
{"unknown-pragma", "unknown %pragma facility or directive", false},
|
||||
{"not-my-pragma", "%pragma not applicable to this compilation", false}
|
||||
};
|
||||
bool warning_on[ERR_WARN_MAX+1]; /* Current state */
|
||||
bool warning_on_global[ERR_WARN_MAX+1]; /* Command-line state, for reset */
|
||||
|
@ -1260,7 +1260,7 @@ static void assemble_file(char *fname, StrList **depend_ptr)
|
||||
* Here we parse our directives; this is not handled by the
|
||||
* main parser.
|
||||
*/
|
||||
if (process_directives(line) != D_none)
|
||||
if (process_directives(line))
|
||||
goto end_of_line; /* Just do final cleanup */
|
||||
|
||||
/* Not a directive, or even something that starts with [ */
|
||||
|
176
asm/pragma.c
Normal file
176
asm/pragma.c
Normal file
@ -0,0 +1,176 @@
|
||||
/* ----------------------------------------------------------------------- *
|
||||
*
|
||||
* Copyright 1996-2017 The NASM Authors - All Rights Reserved
|
||||
* See the file AUTHORS included with the NASM distribution for
|
||||
* the specific copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Parse and handle [pragma] directives. The preprocessor handles
|
||||
* %pragma preproc directives separately, all other namespaces are
|
||||
* simply converted to [pragma].
|
||||
*/
|
||||
|
||||
#include "compiler.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "nasm.h"
|
||||
#include "nasmlib.h"
|
||||
#include "error.h"
|
||||
|
||||
/*
|
||||
* Handle [pragma] directives. [pragma] is generally produced by
|
||||
* the %pragma preprocessor directive, which simply passes on any
|
||||
* string that it finds *except* %pragma preproc. The idea is
|
||||
* that pragmas are of the form:
|
||||
*
|
||||
* %pragma <facility> <opname> [<options>...]
|
||||
*
|
||||
* ... where "facility" can be either a generic facility or a backend
|
||||
* name.
|
||||
*
|
||||
* The following names are currently reserved for global facilities;
|
||||
* so far none of these have any defined pragmas at all:
|
||||
*
|
||||
* preproc - preprocessor
|
||||
* asm - assembler
|
||||
* list - listing generator
|
||||
* file - generic file handling
|
||||
* input - input file handling
|
||||
* output - backend-independent output handling
|
||||
* debug - backend-independent debug handling
|
||||
* ignore - dummy pragma (can be used to "comment out")
|
||||
*
|
||||
* This function should generally not error out if it doesn't understand
|
||||
* what a pragma is for, for unknown arguments, etc; the whole point of
|
||||
* a pragma is that future releases might add new ones that should be
|
||||
* ignored rather than be an error. Erroring out is acceptable for
|
||||
* known pragmas suffering from parsing errors and so on.
|
||||
*
|
||||
* Adding default-suppressed warnings would, however, be a good idea
|
||||
* at some point.
|
||||
*/
|
||||
static struct pragma_facility global_pragmas[] =
|
||||
{
|
||||
{ "preproc", NULL }, /* This shouldn't happen... */
|
||||
{ "asm", NULL },
|
||||
{ "list", NULL },
|
||||
{ "file", NULL },
|
||||
{ "input", NULL },
|
||||
{ "output", NULL },
|
||||
{ "debug", NULL },
|
||||
{ "ignore", NULL },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Search a pragma list for a known pragma facility and if so, invoke
|
||||
* the handler. Return true if processing is complete.
|
||||
* The "default name", if set, matches the final NULL entry (used
|
||||
* for backends, so multiple backends can share the same list under
|
||||
* some circumstances.)
|
||||
*/
|
||||
static bool search_pragma_list(const struct pragma_facility *list,
|
||||
const char *default_name,
|
||||
struct pragma *pragma)
|
||||
{
|
||||
const struct pragma_facility *pf;
|
||||
|
||||
if (!list)
|
||||
return false;
|
||||
|
||||
for (pf = list; pf->name; pf++) {
|
||||
if (!nasm_stricmp(pragma->facility_name, pf->name))
|
||||
goto found_it;
|
||||
}
|
||||
|
||||
if (default_name && !nasm_stricmp(pragma->facility_name, default_name))
|
||||
goto found_it;
|
||||
|
||||
return false;
|
||||
|
||||
found_it:
|
||||
if (!pf->handler)
|
||||
return true;
|
||||
|
||||
pragma->facility = pf;
|
||||
pf->handler(pragma);
|
||||
return true;
|
||||
}
|
||||
|
||||
void process_pragma(char *str)
|
||||
{
|
||||
struct pragma pragma;
|
||||
char *p;
|
||||
|
||||
nasm_zero(&pragma);
|
||||
|
||||
pragma.facility_name = nasm_get_word(str, &p);
|
||||
if (!pragma.facility_name) {
|
||||
nasm_error(ERR_WARNING|ERR_PASS2|ERR_WARN_BAD_PRAGMA,
|
||||
"empty pragma directive");
|
||||
return; /* Empty pragma */
|
||||
}
|
||||
|
||||
pragma.operation = nasm_get_word(p, &p);
|
||||
if (!pragma.operation) {
|
||||
nasm_error(ERR_WARNING|ERR_PASS2|ERR_WARN_BAD_PRAGMA,
|
||||
"pragma directive contains only facility namespace");
|
||||
return; /* Facility name only */
|
||||
}
|
||||
|
||||
pragma.tail = nasm_skip_spaces(p);
|
||||
|
||||
/* Look for a global pragma namespace */
|
||||
if (search_pragma_list(global_pragmas, NULL, &pragma))
|
||||
return;
|
||||
|
||||
/* Look to see if it is an output backend pragma */
|
||||
if (search_pragma_list(ofmt->pragmas, ofmt->shortname, &pragma))
|
||||
return;
|
||||
|
||||
/* Look to see if it is a debug format pragma */
|
||||
if (search_pragma_list(dfmt->pragmas, dfmt->shortname, &pragma))
|
||||
return;
|
||||
|
||||
/*
|
||||
* Note: it would be nice to warn for an unknown namespace,
|
||||
* but in order to do so we need to walk *ALL* the backends
|
||||
* in order to make sure we aren't dealing with a pragma that
|
||||
* is for another backend. On the other hand, that could
|
||||
* also be a warning with a separate warning flag.
|
||||
*
|
||||
* Leave this for the future, however, the warning classes are
|
||||
* already defined for future compatibility.
|
||||
*/
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/* ----------------------------------------------------------------------- *
|
||||
*
|
||||
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||
* Copyright 1996-2017 The NASM Authors - All Rights Reserved
|
||||
* See the file AUTHORS included with the NASM distribution for
|
||||
* the specific copyright holders.
|
||||
*
|
||||
|
@ -107,7 +107,10 @@ static inline vefunc nasm_set_verror(vefunc ve)
|
||||
#define ERR_WARN_BND WARN(14) /* bad BND prefixes */
|
||||
#define ERR_WARN_ZEXTRELOC WARN(15) /* relocation zero-extended */
|
||||
#define ERR_WARN_PTR WARN(16) /* not a NASM keyword */
|
||||
#define ERR_WARN_MAX 16 /* the highest numbered one */
|
||||
#define ERR_WARN_BAD_PRAGMA WARN(17) /* malformed pragma */
|
||||
#define ERR_WARN_UNKNOWN_PRAGMA WARN(18) /* unknown pragma */
|
||||
#define ERR_WARN_NOTMY_PRAGMA WARN(19) /* pragma inapplicable */
|
||||
#define ERR_WARN_MAX 19 /* the highest numbered one */
|
||||
|
||||
struct warning {
|
||||
const char *name;
|
||||
|
@ -684,6 +684,33 @@ enum geninfo { GI_SWITCH };
|
||||
/* Instruction flags type: IF_* flags are defined in insns.h */
|
||||
typedef uint64_t iflags_t;
|
||||
|
||||
/*
|
||||
* A pragma facility: this structure is used to request passing a
|
||||
* parsed pragma directive for a specific facility. If the handler is
|
||||
* NULL then this pragma facility is recognized but ignored; pragma
|
||||
* processing stops at that point, as if the handler had returned true.
|
||||
*
|
||||
* Note that the handler is passed a pointer to the facility structure
|
||||
* as part of the struct pragma.
|
||||
*/
|
||||
struct pragma;
|
||||
|
||||
struct pragma_facility {
|
||||
const char *name;
|
||||
void (*handler)(const struct pragma *);
|
||||
};
|
||||
|
||||
/*
|
||||
* This structure defines how a pragma directive is passed to a
|
||||
* facility. This structure may be augmented in the future.
|
||||
*/
|
||||
struct pragma {
|
||||
const struct pragma_facility *facility;
|
||||
const char *facility_name; /* Facility name exactly as entered by user */
|
||||
const char *operation; /* First word after the facility name */
|
||||
const char *tail; /* Anything after the operation */
|
||||
};
|
||||
|
||||
/*
|
||||
* The data structure defining an output format driver, and the
|
||||
* interfaces to the functions therein.
|
||||
@ -881,6 +908,11 @@ struct ofmt {
|
||||
* the output file pointer.
|
||||
*/
|
||||
void (*cleanup)(void);
|
||||
|
||||
/*
|
||||
* List of pragma facility names that apply to this backend.
|
||||
*/
|
||||
const struct pragma_facility *pragmas;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -960,6 +992,11 @@ struct dfmt {
|
||||
* cleanup - called after processing of file is complete
|
||||
*/
|
||||
void (*cleanup)(void);
|
||||
|
||||
/*
|
||||
* List of pragma facility names that apply to this backend.
|
||||
*/
|
||||
const struct pragma_facility *pragmas;
|
||||
};
|
||||
|
||||
extern const struct dfmt *dfmt;
|
||||
|
@ -71,6 +71,7 @@ const struct dfmt df_cv8 = {
|
||||
cv8_typevalue, /* .debug_typevalue */
|
||||
cv8_output, /* .debug_output */
|
||||
cv8_cleanup, /* .cleanup */
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -86,7 +86,8 @@ const struct dfmt null_debug_form = {
|
||||
null_debug_directive,
|
||||
null_debug_typevalue,
|
||||
null_debug_output,
|
||||
null_debug_cleanup
|
||||
null_debug_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
const struct dfmt * const null_debug_arr[2] = { &null_debug_form, NULL };
|
||||
|
@ -923,7 +923,8 @@ const struct ofmt of_aout = {
|
||||
aout_segbase,
|
||||
null_directive,
|
||||
aout_filename,
|
||||
aout_cleanup
|
||||
aout_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -948,7 +949,8 @@ const struct ofmt of_aoutb = {
|
||||
aout_segbase,
|
||||
null_directive,
|
||||
aout_filename,
|
||||
aout_cleanup
|
||||
aout_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -644,7 +644,8 @@ const struct ofmt of_as86 = {
|
||||
as86_segbase,
|
||||
null_directive,
|
||||
as86_filename,
|
||||
as86_cleanup
|
||||
as86_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif /* OF_AS86 */
|
||||
|
@ -1671,7 +1671,8 @@ const struct ofmt of_bin = {
|
||||
bin_segbase,
|
||||
bin_directive,
|
||||
bin_filename,
|
||||
bin_cleanup
|
||||
bin_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
const struct ofmt of_ith = {
|
||||
@ -1692,7 +1693,8 @@ const struct ofmt of_ith = {
|
||||
bin_segbase,
|
||||
bin_directive,
|
||||
ith_filename,
|
||||
bin_cleanup
|
||||
bin_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
const struct ofmt of_srec = {
|
||||
@ -1713,7 +1715,8 @@ const struct ofmt of_srec = {
|
||||
bin_segbase,
|
||||
bin_directive,
|
||||
srec_filename,
|
||||
bin_cleanup
|
||||
bin_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif /* #ifdef OF_BIN */
|
||||
|
@ -1184,7 +1184,8 @@ const struct ofmt of_coff = {
|
||||
coff_segbase,
|
||||
coff_directives,
|
||||
coff_std_filename,
|
||||
coff_cleanup
|
||||
coff_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -1213,7 +1214,8 @@ const struct ofmt of_win32 = {
|
||||
coff_segbase,
|
||||
coff_directives,
|
||||
coff_win32_filename,
|
||||
coff_cleanup
|
||||
coff_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -1240,7 +1242,8 @@ const struct ofmt of_win64 = {
|
||||
coff_segbase,
|
||||
coff_directives,
|
||||
coff_win32_filename,
|
||||
coff_cleanup
|
||||
coff_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -251,6 +251,7 @@ static const struct dfmt debug_debug_form = {
|
||||
dbgdbg_typevalue,
|
||||
dbgdbg_output,
|
||||
dbgdbg_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt * const debug_debug_arr[3] = {
|
||||
@ -277,7 +278,8 @@ const struct ofmt of_dbg = {
|
||||
dbg_segbase,
|
||||
dbg_directive,
|
||||
dbg_filename,
|
||||
dbg_cleanup
|
||||
dbg_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif /* OF_DBG */
|
||||
|
@ -2235,7 +2235,8 @@ static const struct dfmt elf32_df_dwarf = {
|
||||
null_debug_directive,
|
||||
debug_typevalue,
|
||||
dwarf_output,
|
||||
dwarf_cleanup
|
||||
dwarf_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt elf32_df_stabs = {
|
||||
@ -2247,7 +2248,8 @@ static const struct dfmt elf32_df_stabs = {
|
||||
null_debug_directive,
|
||||
debug_typevalue,
|
||||
stabs_output,
|
||||
stabs_cleanup
|
||||
stabs_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt * const elf32_debugs_arr[3] =
|
||||
@ -2271,7 +2273,8 @@ const struct ofmt of_elf32 = {
|
||||
elf_segbase,
|
||||
elf_directive,
|
||||
elf_filename,
|
||||
elf_cleanup
|
||||
elf_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt elf64_df_dwarf = {
|
||||
@ -2283,7 +2286,8 @@ static const struct dfmt elf64_df_dwarf = {
|
||||
null_debug_directive,
|
||||
debug_typevalue,
|
||||
dwarf_output,
|
||||
dwarf_cleanup
|
||||
dwarf_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt elf64_df_stabs = {
|
||||
@ -2295,7 +2299,8 @@ static const struct dfmt elf64_df_stabs = {
|
||||
null_debug_directive,
|
||||
debug_typevalue,
|
||||
stabs_output,
|
||||
stabs_cleanup
|
||||
stabs_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt * const elf64_debugs_arr[3] =
|
||||
@ -2319,7 +2324,8 @@ const struct ofmt of_elf64 = {
|
||||
elf_segbase,
|
||||
elf_directive,
|
||||
elf_filename,
|
||||
elf_cleanup
|
||||
elf_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt elfx32_df_dwarf = {
|
||||
@ -2331,7 +2337,8 @@ static const struct dfmt elfx32_df_dwarf = {
|
||||
null_debug_directive,
|
||||
debug_typevalue,
|
||||
dwarf_output,
|
||||
dwarf_cleanup
|
||||
dwarf_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt elfx32_df_stabs = {
|
||||
@ -2343,7 +2350,8 @@ static const struct dfmt elfx32_df_stabs = {
|
||||
null_debug_directive,
|
||||
debug_typevalue,
|
||||
stabs_output,
|
||||
stabs_cleanup
|
||||
stabs_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt * const elfx32_debugs_arr[3] =
|
||||
@ -2367,7 +2375,8 @@ const struct ofmt of_elfx32 = {
|
||||
elf_segbase,
|
||||
elf_directive,
|
||||
elf_filename,
|
||||
elf_cleanup
|
||||
elf_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static bool is_elf64(void)
|
||||
@ -2387,12 +2396,16 @@ static bool is_elfx32(void)
|
||||
|
||||
static bool dfmt_is_stabs(void)
|
||||
{
|
||||
return dfmt == &elf32_df_stabs || dfmt == &elfx32_df_stabs || dfmt == &elf64_df_stabs;
|
||||
return dfmt == &elf32_df_stabs ||
|
||||
dfmt == &elfx32_df_stabs ||
|
||||
dfmt == &elf64_df_stabs;
|
||||
}
|
||||
|
||||
static bool dfmt_is_dwarf(void)
|
||||
{
|
||||
return dfmt == &elf32_df_dwarf || dfmt == &elfx32_df_dwarf || dfmt == &elf64_df_dwarf;
|
||||
return dfmt == &elf32_df_dwarf ||
|
||||
dfmt == &elfx32_df_dwarf ||
|
||||
dfmt == &elf64_df_dwarf;
|
||||
}
|
||||
|
||||
/* common debugging routines */
|
||||
|
@ -1507,6 +1507,7 @@ static const struct dfmt ladsoft_debug_form = {
|
||||
dbgls_typevalue,
|
||||
dbgls_output,
|
||||
dbgls_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
static const struct dfmt * const ladsoft_debug_arr[3] = {
|
||||
&ladsoft_debug_form,
|
||||
@ -1531,7 +1532,8 @@ const struct ofmt of_ieee = {
|
||||
ieee_segbase,
|
||||
ieee_directive,
|
||||
ieee_filename,
|
||||
ieee_cleanup
|
||||
ieee_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif /* OF_IEEE */
|
||||
|
@ -1636,7 +1636,8 @@ const struct ofmt of_macho32 = {
|
||||
macho_segbase,
|
||||
null_directive,
|
||||
macho_filename,
|
||||
macho_cleanup
|
||||
macho_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -1684,7 +1685,8 @@ const struct ofmt of_macho64 = {
|
||||
macho_segbase,
|
||||
null_directive,
|
||||
macho_filename,
|
||||
macho_cleanup
|
||||
macho_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -2647,6 +2647,7 @@ static const struct dfmt borland_debug_form = {
|
||||
dbgbi_typevalue,
|
||||
dbgbi_output,
|
||||
dbgbi_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
static const struct dfmt * const borland_debug_arr[3] = {
|
||||
@ -2673,6 +2674,7 @@ const struct ofmt of_obj = {
|
||||
obj_segbase,
|
||||
obj_directive,
|
||||
obj_filename,
|
||||
obj_cleanup
|
||||
obj_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
#endif /* OF_OBJ */
|
||||
|
@ -791,7 +791,8 @@ const struct ofmt of_rdf2 = {
|
||||
rdf2_segbase,
|
||||
rdf2_directive,
|
||||
rdf2_filename,
|
||||
rdf2_cleanup
|
||||
rdf2_cleanup,
|
||||
NULL /* pragma list */
|
||||
};
|
||||
|
||||
#endif /* OF_RDF2 */
|
||||
|
Loading…
Reference in New Issue
Block a user