}
/* 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)
* 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.
}
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;
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,
}
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;
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"));
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);
}
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);
}