summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
Diffstat (limited to 'output')
-rw-r--r--output/outbin.c22
-rw-r--r--output/outelf.c9
-rw-r--r--output/outobj.c14
3 files changed, 22 insertions, 23 deletions
diff --git a/output/outbin.c b/output/outbin.c
index 95885b26..6b617096 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -228,11 +228,11 @@ static void bin_cleanup(void)
uint64_t pend;
int h;
-#ifdef DEBUG
- nasm_debug("bin_cleanup: Sections were initially referenced in this order:\n");
- for (h = 0, s = sections; s; h++, s = s->next)
- fprintf(stdout, "%i. %s\n", h, s->name);
-#endif
+ if (debug_level(1)) {
+ nasm_debug("bin_cleanup: Sections were initially referenced in this order:\n");
+ for (h = 0, s = sections; s; h++, s = s->next)
+ nasm_debug("%i. %s\n", h, s->name);
+ }
/* Assembly has completed, so now we need to generate the output file.
* Step 1: Separate progbits and nobits sections into separate lists.
@@ -511,12 +511,12 @@ static void bin_cleanup(void)
if (h)
nasm_fatal("circular vfollows path detected");
-#ifdef DEBUG
- nasm_debug("bin_cleanup: Confirm final section order for output file:\n");
- for (h = 0, s = sections; s && (s->flags & TYPE_PROGBITS);
- h++, s = s->next)
- fprintf(stdout, "%i. %s\n", h, s->name);
-#endif
+ if (debug_level(1)) {
+ nasm_debug("bin_cleanup: Confirm final section order for output file:\n");
+ for (h = 0, s = sections; s && (s->flags & TYPE_PROGBITS);
+ h++, s = s->next)
+ nasm_debug("%i. %s\n", h, s->name);
+ }
/* Step 5: Apply relocations. */
diff --git a/output/outelf.c b/output/outelf.c
index 1ebb0262..ee7ab8bc 100644
--- a/output/outelf.c
+++ b/output/outelf.c
@@ -734,10 +734,11 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
struct elf_symbol *sym;
bool special_used = false;
-#if defined(DEBUG) && DEBUG>2
- nasm_debug(" elf_deflabel: %s, seg=%"PRIx32", off=%"PRIx64", is_global=%d, %s\n",
- name, segment, offset, is_global, special);
-#endif
+ if (debug_level(2)) {
+ nasm_debug(" elf_deflabel: %s, seg=%"PRIx32", off=%"PRIx64", is_global=%d, %s\n",
+ name, segment, offset, is_global, special);
+ }
+
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
/*
* This is a NASM special symbol. We never allow it into
diff --git a/output/outobj.c b/output/outobj.c
index a5936279..2612892a 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -771,10 +771,9 @@ static void obj_deflabel(char *name, int32_t segment,
int i;
bool used_special = false; /* have we used the special text? */
-#if defined(DEBUG) && DEBUG>2
- nasm_debug(" obj_deflabel: %s, seg=%"PRIx32", off=%"PRIx64", is_global=%d, %s\n",
- name, segment, offset, is_global, special);
-#endif
+ if (debug_level(2))
+ nasm_debug(" obj_deflabel: %s, seg=%"PRIx32", off=%"PRIx64", is_global=%d, %s\n",
+ name, segment, offset, is_global, special);
/*
* If it's a special-retry from pass two, discard it.
@@ -1330,10 +1329,9 @@ static int32_t obj_segment(char *name, int *bits)
* using the pointer it gets passed. That way we save memory,
* by sponging off the label manager.
*/
-#if defined(DEBUG) && DEBUG>=3
- nasm_debug(" obj_segment: < %s >, pass=%d, *bits=%d\n",
- name, pass, *bits);
-#endif
+ if (debug_level(3))
+ nasm_debug(" obj_segment: < %s >, *bits=%d\n", name, *bits);
+
if (!name) {
*bits = 16;
current_seg = NULL;