mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-10-10 00:25:06 -04:00
output: centralize the null definition of ofmt->segbase
Only two output formats (obj and ieee) actually need ofmt->segbase, so move the common dummy definion into nullout.c. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
@@ -54,3 +54,8 @@ void null_reset(void)
|
|||||||
{
|
{
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t null_segbase(int32_t segment)
|
||||||
|
{
|
||||||
|
return segment;
|
||||||
|
}
|
||||||
|
|||||||
@@ -889,11 +889,6 @@ static void aout_sect_write(struct Section *sect,
|
|||||||
sect->len += len;
|
sect->len += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t aout_segbase(int32_t segment)
|
|
||||||
{
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern macros_t aout_stdmac[];
|
extern macros_t aout_stdmac[];
|
||||||
|
|
||||||
#endif /* OF_AOUT || OF_AOUTB */
|
#endif /* OF_AOUT || OF_AOUTB */
|
||||||
@@ -917,7 +912,7 @@ const struct ofmt of_aout = {
|
|||||||
aout_section_names,
|
aout_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
null_sectalign,
|
null_sectalign,
|
||||||
aout_segbase,
|
null_segbase,
|
||||||
null_directive,
|
null_directive,
|
||||||
aout_cleanup,
|
aout_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
@@ -944,7 +939,7 @@ const struct ofmt of_aoutb = {
|
|||||||
aout_section_names,
|
aout_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
null_sectalign,
|
null_sectalign,
|
||||||
aout_segbase,
|
null_segbase,
|
||||||
null_directive,
|
null_directive,
|
||||||
aout_cleanup,
|
aout_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
|
|||||||
@@ -605,11 +605,6 @@ static void as86_sect_write(struct Section *sect,
|
|||||||
sect->datalen += len;
|
sect->datalen += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t as86_segbase(int32_t segment)
|
|
||||||
{
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern macros_t as86_stdmac[];
|
extern macros_t as86_stdmac[];
|
||||||
|
|
||||||
const struct ofmt of_as86 = {
|
const struct ofmt of_as86 = {
|
||||||
@@ -629,7 +624,7 @@ const struct ofmt of_as86 = {
|
|||||||
as86_section_names,
|
as86_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
null_sectalign,
|
null_sectalign,
|
||||||
as86_segbase,
|
null_segbase,
|
||||||
null_directive,
|
null_directive,
|
||||||
as86_cleanup,
|
as86_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
|
|||||||
@@ -1373,11 +1373,6 @@ bin_directive(enum directive directive, char *args, int pass)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t bin_segbase(int32_t segment)
|
|
||||||
{
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
const struct ofmt of_bin, of_ith, of_srec;
|
const struct ofmt of_bin, of_ith, of_srec;
|
||||||
static void binfmt_init(void);
|
static void binfmt_init(void);
|
||||||
static void do_output_bin(void);
|
static void do_output_bin(void);
|
||||||
@@ -1645,7 +1640,7 @@ const struct ofmt of_bin = {
|
|||||||
bin_secname,
|
bin_secname,
|
||||||
NULL,
|
NULL,
|
||||||
bin_sectalign,
|
bin_sectalign,
|
||||||
bin_segbase,
|
null_segbase,
|
||||||
bin_directive,
|
bin_directive,
|
||||||
bin_cleanup,
|
bin_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
@@ -1668,7 +1663,7 @@ const struct ofmt of_ith = {
|
|||||||
bin_secname,
|
bin_secname,
|
||||||
NULL,
|
NULL,
|
||||||
bin_sectalign,
|
bin_sectalign,
|
||||||
bin_segbase,
|
null_segbase,
|
||||||
bin_directive,
|
bin_directive,
|
||||||
bin_cleanup,
|
bin_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
@@ -1691,7 +1686,7 @@ const struct ofmt of_srec = {
|
|||||||
bin_secname,
|
bin_secname,
|
||||||
NULL,
|
NULL,
|
||||||
bin_sectalign,
|
bin_sectalign,
|
||||||
bin_segbase,
|
null_segbase,
|
||||||
bin_directive,
|
bin_directive,
|
||||||
bin_cleanup,
|
bin_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
|
|||||||
@@ -1135,11 +1135,6 @@ static void coff_sectalign(int32_t seg, unsigned int value)
|
|||||||
s->flags = (s->flags & ~IMAGE_SCN_ALIGN_MASK) | value;
|
s->flags = (s->flags & ~IMAGE_SCN_ALIGN_MASK) | value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t coff_segbase(int32_t segment)
|
|
||||||
{
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern macros_t coff_stdmac[];
|
extern macros_t coff_stdmac[];
|
||||||
|
|
||||||
#endif /* defined(OF_COFF) || defined(OF_WIN32) */
|
#endif /* defined(OF_COFF) || defined(OF_WIN32) */
|
||||||
@@ -1163,7 +1158,7 @@ const struct ofmt of_coff = {
|
|||||||
coff_section_names,
|
coff_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
coff_sectalign,
|
coff_sectalign,
|
||||||
coff_segbase,
|
null_segbase,
|
||||||
coff_directives,
|
coff_directives,
|
||||||
coff_cleanup,
|
coff_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
@@ -1194,7 +1189,7 @@ const struct ofmt of_win32 = {
|
|||||||
coff_section_names,
|
coff_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
coff_sectalign,
|
coff_sectalign,
|
||||||
coff_segbase,
|
null_segbase,
|
||||||
coff_directives,
|
coff_directives,
|
||||||
coff_cleanup,
|
coff_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
@@ -1223,7 +1218,7 @@ const struct ofmt of_win64 = {
|
|||||||
coff_section_names,
|
coff_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
coff_sectalign,
|
coff_sectalign,
|
||||||
coff_segbase,
|
null_segbase,
|
||||||
coff_directives,
|
coff_directives,
|
||||||
coff_cleanup,
|
coff_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
|
|||||||
@@ -318,11 +318,6 @@ static void dbg_sectalign(int32_t seg, unsigned int value)
|
|||||||
seg, value);
|
seg, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t dbg_segbase(int32_t segment)
|
|
||||||
{
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum directive_result
|
static enum directive_result
|
||||||
dbg_directive(enum directive directive, char *value, int pass)
|
dbg_directive(enum directive directive, char *value, int pass)
|
||||||
{
|
{
|
||||||
@@ -480,7 +475,7 @@ const struct ofmt of_dbg = {
|
|||||||
dbg_section_names,
|
dbg_section_names,
|
||||||
dbg_herelabel,
|
dbg_herelabel,
|
||||||
dbg_sectalign,
|
dbg_sectalign,
|
||||||
dbg_segbase,
|
null_segbase,
|
||||||
dbg_directive,
|
dbg_directive,
|
||||||
dbg_cleanup,
|
dbg_cleanup,
|
||||||
dbg_pragma_list
|
dbg_pragma_list
|
||||||
|
|||||||
@@ -2220,11 +2220,6 @@ static void elf_sectalign(int32_t seg, unsigned int value)
|
|||||||
s->align = value;
|
s->align = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t elf_segbase(int32_t segment)
|
|
||||||
{
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern macros_t elf_stdmac[];
|
extern macros_t elf_stdmac[];
|
||||||
|
|
||||||
/* Claim "elf" as a pragma namespace, for the future */
|
/* Claim "elf" as a pragma namespace, for the future */
|
||||||
@@ -2281,7 +2276,7 @@ const struct ofmt of_elf32 = {
|
|||||||
elf_section_names,
|
elf_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
elf_sectalign,
|
elf_sectalign,
|
||||||
elf_segbase,
|
null_segbase,
|
||||||
elf_directive,
|
elf_directive,
|
||||||
elf_cleanup,
|
elf_cleanup,
|
||||||
elf_pragma_list,
|
elf_pragma_list,
|
||||||
@@ -2333,7 +2328,7 @@ const struct ofmt of_elf64 = {
|
|||||||
elf_section_names,
|
elf_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
elf_sectalign,
|
elf_sectalign,
|
||||||
elf_segbase,
|
null_segbase,
|
||||||
elf_directive,
|
elf_directive,
|
||||||
elf_cleanup,
|
elf_cleanup,
|
||||||
elf_pragma_list,
|
elf_pragma_list,
|
||||||
@@ -2385,7 +2380,7 @@ const struct ofmt of_elfx32 = {
|
|||||||
elf_section_names,
|
elf_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
elf_sectalign,
|
elf_sectalign,
|
||||||
elf_segbase,
|
null_segbase,
|
||||||
elf_directive,
|
elf_directive,
|
||||||
elf_cleanup,
|
elf_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ enum directive_result
|
|||||||
null_directive(enum directive directive, char *value, int pass);
|
null_directive(enum directive directive, char *value, int pass);
|
||||||
void null_sectalign(int32_t seg, unsigned int value);
|
void null_sectalign(int32_t seg, unsigned int value);
|
||||||
void null_reset(void);
|
void null_reset(void);
|
||||||
|
int32_t null_segbase(int32_t seg);
|
||||||
|
|
||||||
/* Do-nothing versions of all the debug routines */
|
/* Do-nothing versions of all the debug routines */
|
||||||
void null_debug_init(void);
|
void null_debug_init(void);
|
||||||
|
|||||||
@@ -1191,11 +1191,6 @@ static void macho_sectalign(int32_t seg, unsigned int value)
|
|||||||
s->align = align;
|
s->align = align;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t macho_segbase(int32_t section)
|
|
||||||
{
|
|
||||||
return section;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern macros_t macho_stdmac[];
|
extern macros_t macho_stdmac[];
|
||||||
|
|
||||||
/* Comparison function for qsort symbol layout. */
|
/* Comparison function for qsort symbol layout. */
|
||||||
@@ -2394,7 +2389,7 @@ const struct ofmt of_macho32 = {
|
|||||||
macho_section,
|
macho_section,
|
||||||
macho_herelabel,
|
macho_herelabel,
|
||||||
macho_sectalign,
|
macho_sectalign,
|
||||||
macho_segbase,
|
null_segbase,
|
||||||
null_directive,
|
null_directive,
|
||||||
macho_cleanup,
|
macho_cleanup,
|
||||||
macho_pragma_list
|
macho_pragma_list
|
||||||
@@ -2461,7 +2456,7 @@ const struct ofmt of_macho64 = {
|
|||||||
macho_section,
|
macho_section,
|
||||||
macho_herelabel,
|
macho_herelabel,
|
||||||
macho_sectalign,
|
macho_sectalign,
|
||||||
macho_segbase,
|
null_segbase,
|
||||||
null_directive,
|
null_directive,
|
||||||
macho_cleanup,
|
macho_cleanup,
|
||||||
macho_pragma_list,
|
macho_pragma_list,
|
||||||
|
|||||||
@@ -712,11 +712,6 @@ static void rdf2_cleanup(void)
|
|||||||
fwriteint16_t(0, ofile);
|
fwriteint16_t(0, ofile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t rdf2_segbase(int32_t segment)
|
|
||||||
{
|
|
||||||
return segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle RDOFF2 specific directives
|
* Handle RDOFF2 specific directives
|
||||||
*/
|
*/
|
||||||
@@ -779,7 +774,7 @@ const struct ofmt of_rdf2 = {
|
|||||||
rdf2_section_names,
|
rdf2_section_names,
|
||||||
NULL,
|
NULL,
|
||||||
null_sectalign,
|
null_sectalign,
|
||||||
rdf2_segbase,
|
null_segbase,
|
||||||
rdf2_directive,
|
rdf2_directive,
|
||||||
rdf2_cleanup,
|
rdf2_cleanup,
|
||||||
NULL /* pragma list */
|
NULL /* pragma list */
|
||||||
|
|||||||
Reference in New Issue
Block a user