]> granicus.if.org Git - yasm/commitdiff
Add all_syms parameter to objfmt->output() for debugging purposes.
authorPeter Johnson <peter@tortall.net>
Tue, 18 Mar 2003 06:25:30 +0000 (06:25 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 18 Mar 2003 06:25:30 +0000 (06:25 -0000)
svn path=/trunk/yasm/; revision=879

frontends/yasm/yasm.c
libyasm/objfmt.h
modules/objfmts/bin/bin-objfmt.c
modules/objfmts/coff/coff-objfmt.c
modules/objfmts/dbg/dbg-objfmt.c

index 815d01cf09e98476e391cfb4ac2639a2df40d724..498fd49431c35c4487bd71df9b618b99b0a29aa7 100644 (file)
@@ -434,7 +434,8 @@ main(int argc, char *argv[])
     }
 
     /* Write the object file */
-    cur_objfmt->output(obj?obj:stderr, sections);
+    cur_objfmt->output(obj?obj:stderr, sections,
+                      strcmp(cur_dbgfmt->keyword, "null"));
 
     /* Close object file */
     if (obj)
index 45522c5623d6ceedefdb296f25a04350471f695b..7cc73a53b9d72d081a44c70213b3befbec2ac48a 100644 (file)
@@ -68,7 +68,7 @@ struct yasm_objfmt {
      * This function may call symrec functions as necessary (including
      * symrec_traverse) to retrieve symbolic information.
      */
-    void (*output) (FILE *f, yasm_sectionhead *sections);
+    void (*output) (FILE *f, yasm_sectionhead *sections, int all_syms);
 
     /* Cleans up anything allocated by initialize.
      * May be NULL if not needed by the object format.
index adb9e30710efdd615558d27394b00d06f4524e7e..4007a363be2c89968c2cef324b010c756036a6f3 100644 (file)
@@ -216,7 +216,8 @@ bin_objfmt_output_bytecode(yasm_bytecode *bc, /*@null@*/ void *d)
 }
 
 static void
-bin_objfmt_output(FILE *f, yasm_sectionhead *sections)
+bin_objfmt_output(FILE *f, yasm_sectionhead *sections,
+                 /*@unused@*/ int all_syms)
 {
     /*@observer@*/ /*@null@*/ yasm_section *text, *data, *bss, *prevsect;
     /*@null@*/ yasm_expr *startexpr;
index d6da34060d21b725cf47af9641de523ffe8e1a0a..edd025f4ca403f7489bad3253715ecd3199eeaa5 100644 (file)
@@ -182,6 +182,15 @@ coff_objfmt_symtab_append(yasm_symrec *sym, coff_symrec_sclass sclass,
     return entry;
 }
 
+static int
+coff_objfmt_append_local_sym(yasm_symrec *sym, /*@unused@*/ /*@null@*/ void *d)
+{
+    if (!yasm_symrec_get_of_data(sym))
+       coff_objfmt_symtab_append(sym, COFF_SCL_STAT, NULL, 0,
+                                 COFF_SYMTAB_AUX_NONE);
+    return 1;
+}
+
 static void
 coff_objfmt_initialize(const char *in_filename,
                       /*@unused@*/ const char *obj_filename,
@@ -494,7 +503,7 @@ coff_objfmt_output_secthead(yasm_section *sect, /*@null@*/ void *d)
 }
 
 static void
-coff_objfmt_output(FILE *f, yasm_sectionhead *sections)
+coff_objfmt_output(FILE *f, yasm_sectionhead *sections, int all_syms)
 {
     coff_objfmt_output_info info;
     unsigned char *localbuf;
@@ -530,6 +539,10 @@ coff_objfmt_output(FILE *f, yasm_sectionhead *sections)
        return;
 
     /* Symbol table */
+    if (all_syms) {
+       /* Need to put all local syms into COFF symbol table */
+       yasm_symrec_traverse(NULL, coff_objfmt_append_local_sym);
+    }
     pos = ftell(f);
     if (pos == -1) {
        yasm__error(0, N_("could not get file position on output file"));
@@ -667,7 +680,9 @@ coff_objfmt_output(FILE *f, yasm_sectionhead *sections)
     YASM_WRITE_32_L(localbuf, symtab_pos);             /* file ptr to symtab */
     YASM_WRITE_32_L(localbuf, symtab_count);           /* number of symtabs */
     YASM_WRITE_16_L(localbuf, 0);      /* size of optional header (none) */
-    YASM_WRITE_16_L(localbuf, COFF_F_AR32WR|COFF_F_LNNO|COFF_F_LSYMS); /* flags */
+    /* flags */
+    YASM_WRITE_16_L(localbuf, COFF_F_AR32WR|COFF_F_LNNO
+                   |(all_syms?0:COFF_F_LSYMS));
     fwrite(info.buf, 20, 1, f);
 
     yasm_sections_traverse(sections, &info, coff_objfmt_output_secthead);
index 2cc1c13aa5956fa2d3f3fdb5ac7102ae70bd47db..06a587ee58db6b6bded60f9a1357c47579f19c36 100644 (file)
@@ -58,11 +58,12 @@ dbg_objfmt_initialize(const char *in_filename, const char *obj_filename,
 }
 
 static void
-dbg_objfmt_output(/*@unused@*/ FILE *f, yasm_sectionhead *sections)
+dbg_objfmt_output(/*@unused@*/ FILE *f, yasm_sectionhead *sections,
+                 int all_syms)
 {
     fprintf(dbg_objfmt_file, "output(f, sections->\n");
     yasm_sections_print(dbg_objfmt_file, 1, sections);
-    fprintf(dbg_objfmt_file, ")\n");
+    fprintf(dbg_objfmt_file, "%d)\n", all_syms);
     fprintf(dbg_objfmt_file, " Symbol Table:\n");
     yasm_symrec_print_all(dbg_objfmt_file, 1);
 }