From 2d115448b4f3a0133f97cf93b75dec7ed0bc9e42 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 27 Jun 2009 21:54:10 -0700 Subject: [PATCH] output: call debug init from a central location We already call current_dfmt->init in the same place (at the very end of ofmt->init) in all the backends that do it; instead call it centrally in nasm.c after ofmt->init. This fixes invalid ELF files with when compiling with -F dwarf, since the dwarf initialization routine never got called. Signed-off-by: H. Peter Anvin --- nasm.c | 1 + output/outdbg.c | 2 -- output/outieee.c | 2 +- output/outobj.c | 2 -- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/nasm.c b/nasm.c index 9d3776af..632d7949 100644 --- a/nasm.c +++ b/nasm.c @@ -429,6 +429,7 @@ int main(int argc, char **argv) init_labels(); ofmt->init(ofile, report_error, define_label, evaluate); + ofmt->current_dfmt->init(ofmt, NULL, ofile, report_error); assemble_file(inname, depend_ptr); diff --git a/output/outdbg.c b/output/outdbg.c index 72f952e3..102e422a 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -40,8 +40,6 @@ static void dbg_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) dbgsect = NULL; (void)ldef; fprintf(fp, "NASM Output format debug dump\n"); - of_dbg.current_dfmt->init(&of_dbg, 0, fp, errfunc); - } static void dbg_cleanup(int debuginfo) diff --git a/output/outieee.c b/output/outieee.c index 74c1fc85..abf493c6 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -196,8 +196,8 @@ static void ieee_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) ieee_entry_seg = NO_SEG; ieee_uppercase = false; checksum = 0; - of_ieee.current_dfmt->init(&of_ieee, NULL, fp, errfunc); } + static int ieee_set_info(enum geninfo type, char **val) { (void)type; diff --git a/output/outobj.c b/output/outobj.c index f51dcd11..fe2de3e1 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -634,8 +634,6 @@ static void obj_init(FILE * fp, efunc errfunc, ldfunc ldef, evalfunc eval) obj_use32 = false; passtwo = 0; current_seg = NULL; - - of_obj.current_dfmt->init(&of_obj, NULL, fp, errfunc); } static int obj_set_info(enum geninfo type, char **val) -- 2.11.4.GIT