summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-18 11:12:46 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-18 11:14:59 -0800
commite55d03dd47c221f631fe518c623cdd8a703076b2 (patch)
treea8dad51972e4dd49b401afcc0f08ce4b53b331f1 /output
parent8c17bb2fc4d61675b6775e78fbb37b48f19379d3 (diff)
downloadnasm-e55d03dd47c221f631fe518c623cdd8a703076b2.tar.gz
Clean up the handling of various passes
The use of pass0, pass1, pass2, and "pass" passed as an argument is really confusing and already caused a severe bug in the 2.14.01 release cycle. Clean them up and be far more explicit about what various passes mean. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'output')
-rw-r--r--output/nullout.c3
-rw-r--r--output/outaout.c5
-rw-r--r--output/outas86.c5
-rw-r--r--output/outbin.c15
-rw-r--r--output/outcoff.c23
-rw-r--r--output/outdbg.c23
-rw-r--r--output/outelf.c24
-rw-r--r--output/outieee.c20
-rw-r--r--output/outlib.h2
-rw-r--r--output/outmacho.c24
-rw-r--r--output/outobj.c28
-rw-r--r--output/outrdf2.c10
12 files changed, 87 insertions, 95 deletions
diff --git a/output/nullout.c b/output/nullout.c
index ad451e8b..121fe70b 100644
--- a/output/nullout.c
+++ b/output/nullout.c
@@ -36,11 +36,10 @@
#include "outlib.h"
enum directive_result
-null_directive(enum directive directive, char *value, int pass)
+null_directive(enum directive directive, char *value)
{
(void)directive;
(void)value;
- (void)pass;
return DIRR_UNKNOWN;
}
diff --git a/output/outaout.c b/output/outaout.c
index 4eca36db..61f21119 100644
--- a/output/outaout.c
+++ b/output/outaout.c
@@ -236,11 +236,8 @@ static void aout_cleanup(void)
saa_free(strs);
}
-static int32_t aout_section_names(char *name, int pass, int *bits)
+static int32_t aout_section_names(char *name, int *bits)
{
-
- (void)pass;
-
/*
* Default to 32 bits.
*/
diff --git a/output/outas86.c b/output/outas86.c
index 4d2a92ab..eed0396d 100644
--- a/output/outas86.c
+++ b/output/outas86.c
@@ -159,11 +159,8 @@ static void as86_cleanup(void)
saa_free(strs);
}
-static int32_t as86_section_names(char *name, int pass, int *bits)
+static int32_t as86_section_names(char *name, int *bits)
{
-
- (void)pass;
-
/*
* Default is 16 bits.
*/
diff --git a/output/outbin.c b/output/outbin.c
index 5e0dbdbc..4bf13fa4 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -1202,7 +1202,7 @@ static void bin_define_section_labels(void)
labels_defined = 1;
}
-static int32_t bin_secname(char *name, int pass, int *bits)
+static int32_t bin_secname(char *name, int *bits)
{
char *p;
struct Section *sec;
@@ -1211,14 +1211,15 @@ static int32_t bin_secname(char *name, int pass, int *bits)
* pass. Use this opportunity to establish the default section
* (default is BITS-16 ".text" segment).
*/
- if (!name) { /* Reset ORG and section attributes at the start of each pass. */
+ if (!name) {
+ /* Reset ORG and section attributes at the start of each pass. */
origin_defined = 0;
list_for_each(sec, sections)
sec->flags &= ~(START_DEFINED | VSTART_DEFINED |
ALIGN_DEFINED | VALIGN_DEFINED);
/* Define section start and vstart labels. */
- if (pass != 1)
+ if (!pass_first())
bin_define_section_labels();
/* Establish the default (.text) section. */
@@ -1247,14 +1248,14 @@ static int32_t bin_secname(char *name, int pass, int *bits)
}
/* Handle attribute assignments. */
- if (pass != 1)
+ if (!pass_first())
bin_assign_attributes(sec, p);
#ifndef ABIN_SMART_ADAPT
/* The following line disables smart adaptation of
* PROGBITS/NOBITS section types (it forces sections to
* default to PROGBITS). */
- if ((pass != 1) && !(sec->flags & TYPE_DEFINED))
+ if (!pass_first() && !(sec->flags & TYPE_DEFINED))
sec->flags |= TYPE_DEFINED | TYPE_PROGBITS;
#endif
@@ -1262,7 +1263,7 @@ static int32_t bin_secname(char *name, int pass, int *bits)
}
static enum directive_result
-bin_directive(enum directive directive, char *args, int pass)
+bin_directive(enum directive directive, char *args)
{
switch (directive) {
case D_ORG:
@@ -1300,7 +1301,7 @@ bin_directive(enum directive directive, char *args, int pass)
* and symbol information to stdout, stderr, or to a file. */
char *p;
- if (pass != 1)
+ if (!pass_first())
return DIRR_OK;
args += strspn(args, " \t");
while (*args) {
diff --git a/output/outcoff.c b/output/outcoff.c
index 3979d93f..a90e355e 100644
--- a/output/outcoff.c
+++ b/output/outcoff.c
@@ -291,7 +291,7 @@ static inline int32_t coff_sectalign_flags(unsigned int align)
return (ilog2_32(align) + 1) << 20;
}
-static int32_t coff_section_names(char *name, int pass, int *bits)
+static int32_t coff_section_names(char *name, int *bits)
{
char *p;
uint32_t flags, align_and = ~0L, align_or = 0L;
@@ -402,7 +402,7 @@ static int32_t coff_section_names(char *name, int pass, int *bits)
coff_sects[i]->flags = flags;
coff_sects[i]->flags &= align_and;
coff_sects[i]->flags |= align_or;
- } else if (pass == 1) {
+ } else if (pass_first()) {
/* Check if any flags are specified */
if (flags) {
unsigned int align_flags = flags & IMAGE_SCN_ALIGN_MASK;
@@ -566,7 +566,7 @@ static void coff_out(int32_t segto, const void *data,
}
if (!s) {
int tempint; /* ignored */
- if (segto != coff_section_names(".text", 2, &tempint))
+ if (segto != coff_section_names(".text", &tempint))
nasm_panic("strange segment conditions in COFF driver");
else
s = coff_sects[coff_nsects - 1];
@@ -751,14 +751,21 @@ static void BuildExportTable(STRING **rvp)
}
static enum directive_result
-coff_directives(enum directive directive, char *value, int pass)
+coff_directives(enum directive directive, char *value)
{
switch (directive) {
case D_EXPORT:
{
char *q, *name;
- if (pass == 2)
+ /*
+ * XXX: pass_first() is really wrong here, but AddExport()
+ * needs to be modified to handle duplicate calls for the
+ * same value in order to change that. The right thing to do
+ * is probably to mark a label as an export in the label
+ * structure, in case the label doesn't actually exist.
+ */
+ if (!pass_first())
return DIRR_OK; /* ignore in pass two */
name = q = value;
while (*q && !nasm_isspace(*q))
@@ -798,10 +805,10 @@ coff_directives(enum directive directive, char *value, int pass)
sxseg = i;
}
/*
- * pass0 == 2 is the only time when the full set of symbols are
- * guaranteed to be present; it is the final output pass.
+ * pass_final() is the only time when the full set of symbols are
+ * guaranteed to be present as it is the final output pass.
*/
- if (pass0 == 2) {
+ if (pass_final()) {
uint32_t n;
saa_rewind(coff_syms);
for (n = 0; n < coff_nsyms; n++) {
diff --git a/output/outdbg.c b/output/outdbg.c
index b5496b98..e5f15ef7 100644
--- a/output/outdbg.c
+++ b/output/outdbg.c
@@ -75,8 +75,8 @@ static void dbg_init(void)
static void dbg_reset(void)
{
- fprintf(ofile, "*** pass reset: pass0 = %d, passn = %"PRId64"\n",
- pass0, passn);
+ fprintf(ofile, "*** pass reset: pass = %"PRId64" (%s)\n",
+ pass_count(), pass_type_name());
}
static void dbg_cleanup(void)
@@ -90,8 +90,7 @@ static void dbg_cleanup(void)
}
}
-static int32_t dbg_add_section(char *name, int pass, int *bits,
- const char *whatwecallit)
+static int32_t dbg_add_section(char *name, int *bits, const char *whatwecallit)
{
int seg;
@@ -121,8 +120,8 @@ static int32_t dbg_add_section(char *name, int pass, int *bits,
s->number = seg = seg_alloc();
s->next = dbgsect;
dbgsect = s;
- fprintf(ofile, "%s %s (%s) pass %d: returning %d\n",
- whatwecallit, name, tail, pass, seg);
+ fprintf(ofile, "%s %s (%s) pass %"PRId64" (%s) : returning %d\n",
+ whatwecallit, name, tail, pass_count(), pass_type_name(), seg);
if (section_labels)
backend_label(s->name, s->number + 1, 0);
@@ -131,9 +130,9 @@ static int32_t dbg_add_section(char *name, int pass, int *bits,
return seg;
}
-static int32_t dbg_section_names(char *name, int pass, int *bits)
+static int32_t dbg_section_names(char *name, int *bits)
{
- return dbg_add_section(name, pass, bits, "section_names");
+ return dbg_add_section(name, bits, "section_names");
}
static int32_t dbg_herelabel(const char *name, enum label_type type,
@@ -323,7 +322,7 @@ static void dbg_sectalign(int32_t seg, unsigned int value)
}
static enum directive_result
-dbg_directive(enum directive directive, char *value, int pass)
+dbg_directive(enum directive directive, char *value)
{
switch (directive) {
/*
@@ -334,7 +333,7 @@ dbg_directive(enum directive directive, char *value, int pass)
case D_GROUP:
{
int dummy;
- dbg_add_section(value, pass, &dummy, "directive:group");
+ dbg_add_section(value, &dummy, "directive:group");
break;
}
@@ -342,8 +341,8 @@ dbg_directive(enum directive directive, char *value, int pass)
break;
}
- fprintf(ofile, "directive [%s] value [%s] (pass %d)\n",
- directive_dname(directive), value, pass);
+ fprintf(ofile, "directive [%s] value [%s] pass %"PRId64" (%s)\n",
+ directive_dname(directive), value, pass_count(), pass_type_name());
return DIRR_OK;
}
diff --git a/output/outelf.c b/output/outelf.c
index 2f609c83..cd77901f 100644
--- a/output/outelf.c
+++ b/output/outelf.c
@@ -209,7 +209,7 @@ const struct elf_known_section elf_known_sections[] = {
};
/* parse section attributes */
-static void elf_section_attrib(char *name, char *attr, int pass,
+static void elf_section_attrib(char *name, char *attr,
uint32_t *flags_and, uint32_t *flags_or,
uint64_t *align, int *type)
{
@@ -258,7 +258,7 @@ static void elf_section_attrib(char *name, char *attr, int pass,
*type = SHT_PROGBITS;
} else if (!nasm_stricmp(opt, "nobits")) {
*type = SHT_NOBITS;
- } else if (pass == 1) {
+ } else if (pass_first()) {
nasm_warn(WARN_OTHER, "Unknown section attribute '%s' ignored on"
" declaration of section `%s'", opt, name);
}
@@ -267,7 +267,7 @@ static void elf_section_attrib(char *name, char *attr, int pass,
}
static enum directive_result
-elf_directive(enum directive directive, char *value, int pass)
+elf_directive(enum directive directive, char *value)
{
int64_t n;
bool err;
@@ -275,8 +275,8 @@ elf_directive(enum directive directive, char *value, int pass)
switch (directive) {
case D_OSABI:
- if (pass == 2)
- return DIRR_OK; /* ignore in pass 2 */
+ if (!pass_first()) /* XXX: Why? */
+ return DIRR_OK;
n = readnum(value, &err);
if (err) {
@@ -413,7 +413,7 @@ static int elf_make_section(char *name, int type, int flags, int align)
return nsects - 1;
}
-static int32_t elf_section_names(char *name, int pass, int *bits)
+static int32_t elf_section_names(char *name, int *bits)
{
char *p;
uint32_t flags, flags_and, flags_or;
@@ -430,7 +430,7 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
*p++ = '\0';
flags_and = flags_or = type = align = 0;
- elf_section_attrib(name, p, pass, &flags_and,
+ elf_section_attrib(name, p, &flags_and,
&flags_or, &align, &type);
if (!strcmp(name, ".shstrtab") ||
@@ -458,7 +458,7 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
flags = (ks->flags & ~flags_and) | flags_or;
i = elf_make_section(name, type, flags, align);
- } else if (pass == 1) {
+ } else if (pass_first()) {
if ((type && sects[i]->type != type)
|| (align && sects[i]->align != align)
|| (flags_and && ((sects[i]->flags & flags_and) != flags_or)))
@@ -549,7 +549,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
if (segment == def_seg) {
/* we have to be sure at least text section is there */
int tempint;
- if (segment != elf_section_names(".text", 2, &tempint))
+ if (segment != elf_section_names(".text", &tempint))
nasm_panic("strange segment conditions in ELF driver");
}
for (i = 0; i < nsects; i++) {
@@ -803,7 +803,7 @@ static void elf32_out(int32_t segto, const void *data,
}
if (!s) {
int tempint; /* ignored */
- if (segto != elf_section_names(".text", 2, &tempint))
+ if (segto != elf_section_names(".text", &tempint))
nasm_panic("strange segment conditions in ELF driver");
else {
s = sects[nsects - 1];
@@ -1014,7 +1014,7 @@ static void elf64_out(int32_t segto, const void *data,
}
if (!s) {
int tempint; /* ignored */
- if (segto != elf_section_names(".text", 2, &tempint))
+ if (segto != elf_section_names(".text", &tempint))
nasm_panic("strange segment conditions in ELF driver");
else {
s = sects[nsects - 1];
@@ -1292,7 +1292,7 @@ static void elfx32_out(int32_t segto, const void *data,
}
if (!s) {
int tempint; /* ignored */
- if (segto != elf_section_names(".text", 2, &tempint))
+ if (segto != elf_section_names(".text", &tempint))
nasm_panic("strange segment conditions in ELF driver");
else {
s = sects[nsects - 1];
diff --git a/output/outieee.c b/output/outieee.c
index 0078fa90..1247077e 100644
--- a/output/outieee.c
+++ b/output/outieee.c
@@ -146,7 +146,7 @@ static struct ieeeSection {
struct ieeeObjData *data, *datacurr;
struct ieeeFixupp *fptr, *flptr;
int32_t index; /* the NASM segment id */
- int32_t ieee_index; /* the OBJ-file segment index */
+ int32_t ieee_index; /* the IEEE-file segment index */
int32_t currentpos;
int32_t align; /* can be SEG_ABS + absolute addr */
int32_t startpos;
@@ -193,7 +193,7 @@ static void ieee_data_new(struct ieeeSection *);
static void ieee_write_fixup(int32_t, int32_t, struct ieeeSection *,
int, uint64_t, int32_t);
static void ieee_install_fixup(struct ieeeSection *, struct ieeeFixupp *);
-static int32_t ieee_segment(char *, int, int *);
+static int32_t ieee_segment(char *, int *);
static void ieee_write_file(void);
static void ieee_write_byte(struct ieeeSection *, int);
static void ieee_write_word(struct ieeeSection *, int);
@@ -403,7 +403,7 @@ static void ieee_out(int32_t segto, const void *data,
*/
if (!any_segs) {
int tempint; /* ignored */
- if (segto != ieee_segment("__NASMDEFSEG", 2, &tempint))
+ if (segto != ieee_segment("__NASMDEFSEG", &tempint))
nasm_panic("strange segment conditions in IEEE driver");
}
@@ -655,7 +655,7 @@ static void ieee_install_fixup(struct ieeeSection *seg,
/*
* segment registry
*/
-static int32_t ieee_segment(char *name, int pass, int *bits)
+static int32_t ieee_segment(char *name, int *bits)
{
/*
* We call the label manager here to define a name for the new
@@ -705,7 +705,7 @@ static int32_t ieee_segment(char *name, int pass, int *bits)
for (seg = seghead; seg; seg = seg->next) {
ieee_idx++;
if (!strcmp(seg->name, name)) {
- if (attrs > 0 && pass == 1)
+ if (attrs > 0 && pass_first())
nasm_warn(WARN_OTHER, "segment attributes specified on"
" redeclaration of segment: ignoring");
if (seg->use32)
@@ -807,11 +807,9 @@ static int32_t ieee_segment(char *name, int pass, int *bits)
* directives supported
*/
static enum directive_result
-ieee_directive(enum directive directive, char *value, int pass)
+ieee_directive(enum directive directive, char *value)
{
-
(void)value;
- (void)pass;
switch (directive) {
case D_UPPERCASE:
@@ -1275,7 +1273,7 @@ static void dbgls_init(void)
arrindex = ARRAY_BOT;
arrhead = NULL;
arrtail = &arrhead;
- ieee_segment("??LINE", 2, &tempint);
+ ieee_segment("??LINE", &tempint);
any_segs = false;
}
static void dbgls_cleanup(void)
@@ -1323,8 +1321,8 @@ static void dbgls_linnum(const char *lnfname, int32_t lineno, int32_t segto)
*/
if (!any_segs) {
int tempint; /* ignored */
- if (segto != ieee_segment("__NASMDEFSEG", 2, &tempint))
- nasm_panic("strange segment conditions in OBJ driver");
+ if (segto != ieee_segment("__NASMDEFSEG", &tempint))
+ nasm_panic("strange segment conditions in IEEE driver");
}
/*
diff --git a/output/outlib.h b/output/outlib.h
index 6dc7bdad..30f2c0b2 100644
--- a/output/outlib.h
+++ b/output/outlib.h
@@ -41,7 +41,7 @@ uint64_t realsize(enum out_type type, uint64_t size);
/* Do-nothing versions of some output routines */
enum directive_result
-null_directive(enum directive directive, char *value, int pass);
+null_directive(enum directive directive, char *value);
void null_sectalign(int32_t seg, unsigned int value);
void null_reset(void);
int32_t null_segbase(int32_t seg);
diff --git a/output/outmacho.c b/output/outmacho.c
index 820136f6..6482be09 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -788,7 +788,7 @@ lookup_known_section(const char *name, bool by_sectname)
return NULL;
}
-static int32_t macho_section(char *name, int pass, int *bits)
+static int32_t macho_section(char *name, int *bits)
{
const struct macho_known_section *known_section;
const struct macho_known_section_attr *sa;
@@ -801,8 +801,6 @@ static int32_t macho_section(char *name, int pass, int *bits)
bool new_seg;
- (void)pass;
-
/* Default to the appropriate number of bits. */
if (!name) {
*bits = fmt.ptrsize << 3;
@@ -986,8 +984,9 @@ static void macho_symdef(char *name, int32_t section, int64_t offset,
#if defined(DEBUG) && DEBUG>2
nasm_error(ERR_DEBUG,
- " macho_symdef: %s, pass0=%d, passn=%"PRId64", sec=%"PRIx32", off=%"PRIx64", is_global=%d, %s\n",
- name, pass0, passn, section, offset, is_global, special);
+ " macho_symdef: %s, pass=%"PRId64" type %s, sec=%"PRIx32", off=%"PRIx64", is_global=%d, %s\n",
+ name, pass_count(), pass_types[pass_type()],
+ section, offset, is_global, special);
#endif
if (is_global == 3) {
@@ -1767,7 +1766,6 @@ static enum directive_result macho_no_dead_strip(const char *labels)
char *s, *p, *ep;
char ec;
enum directive_result rv = DIRR_ERROR;
- bool real = passn > 1;
p = s = nasm_strdup(labels);
while (*p) {
@@ -1782,7 +1780,7 @@ static enum directive_result macho_no_dead_strip(const char *labels)
goto err;
}
*ep = '\0';
- if (real) {
+ if (!pass_first()) {
if (!macho_set_section_attribute_by_symbol(p, S_ATTR_NO_DEAD_STRIP))
rv = DIRR_ERROR;
}
@@ -1805,14 +1803,12 @@ err:
static enum directive_result
macho_pragma(const struct pragma *pragma)
{
- bool real = passn > 1;
-
switch (pragma->opcode) {
case D_SUBSECTIONS_VIA_SYMBOLS:
if (*pragma->tail)
return DIRR_BADPARAM;
- if (real)
+ if (!pass_first())
head_flags |= MH_SUBSECTIONS_VIA_SYMBOLS;
/* Jmp-match optimization conflicts */
@@ -1844,10 +1840,10 @@ static void macho_dbg_generate(void)
/* debug section defines */
{
int bits = 0;
- macho_section(".debug_abbrev", 0, &bits);
- macho_section(".debug_info", 0, &bits);
- macho_section(".debug_line", 0, &bits);
- macho_section(".debug_str", 0, &bits);
+ macho_section(".debug_abbrev", &bits);
+ macho_section(".debug_info", &bits);
+ macho_section(".debug_line", &bits);
+ macho_section(".debug_str", &bits);
}
/* dw section walk to find high_addr and total_len */
diff --git a/output/outobj.c b/output/outobj.c
index 9fd4ddca..e861754e 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -634,9 +634,9 @@ static const struct dfmt borland_debug_form;
/* The current segment */
static struct Segment *current_seg;
-static int32_t obj_segment(char *, int, int *);
+static int32_t obj_segment(char *, int *);
static void obj_write_file(void);
-static enum directive_result obj_directive(enum directive, char *, int);
+static enum directive_result obj_directive(enum directive, char *);
static void obj_init(void)
{
@@ -837,7 +837,7 @@ static void obj_deflabel(char *name, int32_t segment,
*/
if (!any_segs && segment == first_seg) {
int tempint; /* ignored */
- if (segment != obj_segment("__NASMDEFSEG", 2, &tempint))
+ if (segment != obj_segment("__NASMDEFSEG", &tempint))
nasm_panic("strange segment conditions in OBJ driver");
}
@@ -1029,7 +1029,7 @@ static void obj_out(int32_t segto, const void *data,
*/
if (!any_segs) {
int tempint; /* ignored */
- if (segto != obj_segment("__NASMDEFSEG", 2, &tempint))
+ if (segto != obj_segment("__NASMDEFSEG", &tempint))
nasm_panic("strange segment conditions in OBJ driver");
}
@@ -1323,7 +1323,7 @@ static void obj_write_fixup(ObjRecord * orp, int bytes,
obj_commit(forp);
}
-static int32_t obj_segment(char *name, int pass, int *bits)
+static int32_t obj_segment(char *name, int *bits)
{
/*
* We call the label manager here to define a name for the new
@@ -1379,7 +1379,7 @@ static int32_t obj_segment(char *name, int pass, int *bits)
break;
if (!strcmp(seg->name, name)) {
- if (attrs > 0 && pass == 1)
+ if (attrs > 0 && pass_first())
nasm_warn(WARN_OTHER, "segment attributes specified on"
" redeclaration of segment: ignoring");
if (seg->use32)
@@ -1455,7 +1455,7 @@ static int32_t obj_segment(char *name, int pass, int *bits)
if (!strcmp(grp->name, "FLAT"))
break;
if (!grp) {
- obj_directive(D_GROUP, "FLAT", 1);
+ obj_directive(D_GROUP, "FLAT");
for (grp = grphead; grp; grp = grp->next)
if (!strcmp(grp->name, "FLAT"))
break;
@@ -1570,13 +1570,13 @@ static int32_t obj_segment(char *name, int pass, int *bits)
}
static enum directive_result
-obj_directive(enum directive directive, char *value, int pass)
+obj_directive(enum directive directive, char *value)
{
switch (directive) {
case D_GROUP:
{
char *p, *q, *v;
- if (pass == 1) {
+ if (pass_first()) { /* XXX */
struct Group *grp;
struct Segment *seg;
struct External **extp;
@@ -1690,8 +1690,8 @@ obj_directive(enum directive directive, char *value, int pass)
{
char *q, *extname, *libname, *impname;
- if (pass == 2)
- return 1; /* ignore in pass two */
+ if (!pass_first()) /* XXX */
+ return DIRR_OK;
extname = q = value;
while (*q && !nasm_isspace(*q))
q++;
@@ -1740,7 +1740,7 @@ obj_directive(enum directive directive, char *value, int pass)
int flags = 0;
unsigned int ordinal = 0;
- if (pass == 2)
+ if (!pass_first())
return DIRR_OK; /* ignore in pass two */
intname = q = value;
while (*q && !nasm_isspace(*q))
@@ -1887,7 +1887,7 @@ static int32_t obj_segbase(int32_t segment)
e = eb->exts[i];
if (!e) {
/* Not available yet, probably a forward reference */
- nasm_assert(pass0 < 2); /* Convergence failure */
+ nasm_assert(!pass_final());
return NO_SEG;
}
@@ -2502,7 +2502,7 @@ static void dbgbi_linnum(const char *lnfname, int32_t lineno, int32_t segto)
*/
if (!any_segs) {
int tempint; /* ignored */
- if (segto != obj_segment("__NASMDEFSEG", 2, &tempint))
+ if (segto != obj_segment("__NASMDEFSEG", &tempint))
nasm_panic("strange segment conditions in OBJ driver");
}
diff --git a/output/outrdf2.c b/output/outrdf2.c
index 456d1bdf..c649a5a6 100644
--- a/output/outrdf2.c
+++ b/output/outrdf2.c
@@ -151,7 +151,7 @@ static void rdf2_init(void)
headerlength = 0;
}
-static int32_t rdf2_section_names(char *name, int pass, int *bits)
+static int32_t rdf2_section_names(char *name, int *bits)
{
int i;
bool err;
@@ -159,8 +159,6 @@ static int32_t rdf2_section_names(char *name, int pass, int *bits)
int code = -1;
int reserved = 0;
- (void)pass;
-
/*
* Default is 32 bits, in the text segment.
*/
@@ -705,7 +703,7 @@ static void rdf2_cleanup(void)
* Handle RDOFF2 specific directives
*/
static enum directive_result
-rdf2_directive(enum directive directive, char *value, int pass)
+rdf2_directive(enum directive directive, char *value)
{
size_t n;
@@ -716,7 +714,7 @@ rdf2_directive(enum directive directive, char *value, int pass)
nasm_error(ERR_NONFATAL, "name size exceeds %d bytes", MODLIB_NAME_MAX);
return DIRR_ERROR;
}
- if (pass == 1) {
+ if (pass_first()) { /* XXX */
struct DLLRec r;
r.type = RDFREC_DLL;
r.reclen = n + 1;
@@ -730,7 +728,7 @@ rdf2_directive(enum directive directive, char *value, int pass)
nasm_error(ERR_NONFATAL, "name size exceeds %d bytes", MODLIB_NAME_MAX);
return DIRR_ERROR;
}
- if (pass == 1) {
+ if (pass_first()) { /* XXX */
struct ModRec r;
r.type = RDFREC_MODNAME;
r.reclen = n + 1;