From f568613c2a17838aa91f5730f3b8a36c610d1aa4 Mon Sep 17 00:00:00 2001 From: Victor van den Elzen Date: Wed, 5 Nov 2008 14:11:46 +0100 Subject: [PATCH] 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. --- nasm.c | 2 -- output/outdbg.c | 2 +- output/outelf32.c | 17 +++++++++++------ output/outelf64.c | 4 ++-- output/outieee.c | 2 +- output/outobj.c | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/nasm.c b/nasm.c index 56109e1..7d002d3 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 1646b4b..2007355 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 7a7a904..f5a7d20 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 4e2988a..4254585 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 36d0a67..74c1fc8 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 5a72724..f51dcd1 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, -- 2.7.4