55 lines
No EOL
970 B
C
55 lines
No EOL
970 B
C
#include <tcc.h>
|
|
#include <tcc/object/coff.h>
|
|
|
|
#define COFF_DEFAULT_ENTRYNAME "_start"
|
|
|
|
int
|
|
tcc_output_coff(TCCState *s1, FILE *f)
|
|
{
|
|
COFFFileHeader coffhdr;
|
|
AOutHeader aouthdr;
|
|
COFFSectionHeader coffsec;
|
|
const char *entry_name = COFF_DEFAULT_ENTRYNAME;
|
|
|
|
memset(&coffhdr, 0, sizeof(COFFFileHeader));
|
|
|
|
coffhdr.flags = COFF_F_LITTLE | COFF_F_LNNO;
|
|
coffhdr.magic = COFF_MAGIC;
|
|
coffhdr.nscns = s1->nb_sections;
|
|
|
|
if (s1->output_type == TCC_OUTPUT_EXE)
|
|
{
|
|
coffhdr.flags |= COFF_F_RELFLG | COFF_F_EXEC | COFF_F_LSYMS;
|
|
coffhdr.nsyms = 0;
|
|
|
|
memset(&aouthdr, 0, sizeof(AOutHeader));
|
|
|
|
aouthdr.magic = AOUT_ZMAGIC;
|
|
coffhdr.opthdr = sizeof(AOutHeader);
|
|
|
|
if (s1->entryname != NULL)
|
|
{
|
|
entry_name = s1->entryname;
|
|
}
|
|
aouthdr.entry = get_sym_addr(s1, entry_name, 1, 0);
|
|
|
|
if (s1->nb_errors)
|
|
{
|
|
return (-1);
|
|
}
|
|
}
|
|
|
|
return (0);
|
|
}
|
|
|
|
int
|
|
coff_output_object(TCCState *s, const char *filename)
|
|
{
|
|
|
|
}
|
|
|
|
int
|
|
coff_output_exe(TCCState *s, const char *filename)
|
|
{
|
|
|
|
} |