summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor van den Elzen <victor.vde@gmail.com>2008-11-05 14:11:46 +0100
committerVictor van den Elzen <victor.vde@gmail.com>2008-11-05 14:19:15 +0100
commitf568613c2a17838aa91f5730f3b8a36c610d1aa4 (patch)
tree4c41caab76149f2c7d7b842e34f2df56b881bf32
parent67a405e2f495982cac724fd95e1db8ee68b12c13 (diff)
downloadnasm-f568613c2a17838aa91f5730f3b8a36c610d1aa4.tar.gz
Fix BR #916647
nasm.c should respect the default debug format of the output format, instead of replacing it with the first format in the list. This is cleaner and allows the list to be sorted normally. This commit rewrites commit 116994111b which was very fragile.
-rw-r--r--nasm.c2
-rw-r--r--output/outdbg.c2
-rw-r--r--output/outelf32.c17
-rw-r--r--output/outelf64.c4
-rw-r--r--output/outieee.c2
-rw-r--r--output/outobj.c2
6 files changed, 16 insertions, 13 deletions
diff --git a/nasm.c b/nasm.c
index 56109e1b..7d002d33 100644
--- a/nasm.c
+++ b/nasm.c
@@ -632,8 +632,6 @@ static bool process_arg(char *p, char *q)
report_error(ERR_FATAL | ERR_NOFILE | ERR_USAGE,
"unrecognised output format `%s' - "
"use -hf for a list", param);
- } else {
- ofmt->current_dfmt = ofmt->debug_formats[0];
}
break;
diff --git a/output/outdbg.c b/output/outdbg.c
index 1646b4b7..20073558 100644
--- a/output/outdbg.c
+++ b/output/outdbg.c
@@ -231,7 +231,7 @@ struct ofmt of_dbg = {
"dbg",
NULL,
debug_debug_arr,
- &null_debug_form,
+ &debug_debug_form,
NULL,
dbg_init,
dbg_set_info,
diff --git a/output/outelf32.c b/output/outelf32.c
index 7a7a9046..f5a7d20c 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -299,8 +299,6 @@ static int32_t elf_sym_sect, elf_tlsie_sect;
static void elf_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
{
- if (of_elf.current_dfmt != &null_debug_form)
- of_elf32.current_dfmt = of_elf.current_dfmt;
elffp = fp;
error = errfunc;
evaluate = eval;
@@ -342,6 +340,13 @@ static void elf_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval)
def_seg = seg_alloc();
}
+static void elf_init_hack(FILE * fp, efunc errfunc, ldfunc ldef,
+ evalfunc eval)
+{
+ of_elf32.current_dfmt = of_elf.current_dfmt; /* Sync debugging format */
+ elf_init(fp, errfunc, ldef, eval);
+}
+
static void elf_cleanup(int debuginfo)
{
struct Reloc *r;
@@ -1533,14 +1538,14 @@ static struct dfmt df_stabs = {
stabs32_cleanup
};
-struct dfmt *elf32_debugs_arr[3] = { &df_stabs, &df_dwarf, NULL };
+struct dfmt *elf32_debugs_arr[3] = { &df_dwarf, &df_stabs, NULL };
struct ofmt of_elf32 = {
"ELF32 (i386) object files (e.g. Linux)",
"elf32",
NULL,
elf32_debugs_arr,
- &null_debug_form,
+ &df_stabs,
elf_stdmac,
elf_init,
elf_set_info,
@@ -1558,9 +1563,9 @@ struct ofmt of_elf = {
"elf",
NULL,
elf32_debugs_arr,
- &null_debug_form,
+ &df_stabs,
elf_stdmac,
- elf_init,
+ elf_init_hack,
elf_set_info,
elf_out,
elf_deflabel,
diff --git a/output/outelf64.c b/output/outelf64.c
index 4e2988af..4254585c 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -1659,14 +1659,14 @@ static struct dfmt df_stabs = {
stabs64_cleanup
};
-struct dfmt *elf64_debugs_arr[3] = { &df_stabs, &df_dwarf, NULL };
+struct dfmt *elf64_debugs_arr[3] = { &df_dwarf, &df_stabs, NULL };
struct ofmt of_elf64 = {
"ELF64 (x86_64) object files (e.g. Linux)",
"elf64",
NULL,
elf64_debugs_arr,
- &null_debug_form,
+ &df_stabs,
elf_stdmac,
elf_init,
elf_set_info,
diff --git a/output/outieee.c b/output/outieee.c
index 36d0a674..74c1fc85 100644
--- a/output/outieee.c
+++ b/output/outieee.c
@@ -1473,7 +1473,7 @@ struct ofmt of_ieee = {
"ieee",
NULL,
ladsoft_debug_arr,
- &null_debug_form,
+ &ladsoft_debug_form,
NULL,
ieee_init,
ieee_set_info,
diff --git a/output/outobj.c b/output/outobj.c
index 5a727248..f51dcd11 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -2524,7 +2524,7 @@ struct ofmt of_obj = {
"obj",
NULL,
borland_debug_arr,
- &null_debug_form,
+ &borland_debug_form,
obj_stdmac,
obj_init,
obj_set_info,