forked from Mirrors/tinycc
update
parent
eb79471184
commit
bb07bf31aa
|
@ -14,6 +14,9 @@ version 0.9.21:
|
||||||
- '-Ttext' linker option
|
- '-Ttext' linker option
|
||||||
- section alignment fixes
|
- section alignment fixes
|
||||||
- bit fields fixes
|
- bit fields fixes
|
||||||
|
- do not generate code for unused inline functions
|
||||||
|
- '-oformat' linker option.
|
||||||
|
- added 'binary' output format.
|
||||||
|
|
||||||
version 0.9.20:
|
version 0.9.20:
|
||||||
|
|
||||||
|
|
32
tcccoff.c
32
tcccoff.c
|
@ -73,9 +73,8 @@ typedef struct {
|
||||||
unsigned short dummy4;
|
unsigned short dummy4;
|
||||||
} AUXEF;
|
} AUXEF;
|
||||||
|
|
||||||
int tcc_output_coff(TCCState *s1, const char *OutFile)
|
int tcc_output_coff(TCCState *s1, FILE *f)
|
||||||
{
|
{
|
||||||
FILE *f;
|
|
||||||
Section *tcc_sect;
|
Section *tcc_sect;
|
||||||
SCNHDR *coff_sec;
|
SCNHDR *coff_sec;
|
||||||
int file_pointer;
|
int file_pointer;
|
||||||
|
@ -84,12 +83,6 @@ int tcc_output_coff(TCCState *s1, const char *OutFile)
|
||||||
FILHDR file_hdr; /* FILE HEADER STRUCTURE */
|
FILHDR file_hdr; /* FILE HEADER STRUCTURE */
|
||||||
Section *stext, *sdata, *sbss;
|
Section *stext, *sdata, *sbss;
|
||||||
|
|
||||||
f = fopen(OutFile, "wb");
|
|
||||||
|
|
||||||
if (!f) {
|
|
||||||
error("Unable to open output file");
|
|
||||||
}
|
|
||||||
|
|
||||||
stext = FindSection(s1, ".text");
|
stext = FindSection(s1, ".text");
|
||||||
sdata = FindSection(s1, ".data");
|
sdata = FindSection(s1, ".data");
|
||||||
sbss = FindSection(s1, ".bss");
|
sbss = FindSection(s1, ".bss");
|
||||||
|
@ -237,7 +230,7 @@ int tcc_output_coff(TCCState *s1, const char *OutFile)
|
||||||
EndAddress[nFuncs] = pc;
|
EndAddress[nFuncs] = pc;
|
||||||
FuncEntries[nFuncs] =
|
FuncEntries[nFuncs] =
|
||||||
(file_pointer -
|
(file_pointer -
|
||||||
LineNoFilePtr[nFuncs]) / LINESZ;
|
LineNoFilePtr[nFuncs]) / LINESZ - 1;
|
||||||
LastLineNo[nFuncs++] = last_line_num + 1;
|
LastLineNo[nFuncs++] = last_line_num + 1;
|
||||||
} else {
|
} else {
|
||||||
// beginning of function
|
// beginning of function
|
||||||
|
@ -703,8 +696,6 @@ int tcc_output_coff(TCCState *s1, const char *OutFile)
|
||||||
tcc_free(Coff_str_table);
|
tcc_free(Coff_str_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,18 +834,13 @@ int FindCoffSymbolIndex(const char *func_name)
|
||||||
return n; // total number of symbols
|
return n; // total number of symbols
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOL OutputTheSection(Section * sect)
|
BOOL OutputTheSection(Section * sect)
|
||||||
{
|
{
|
||||||
const char *s = sect->name;
|
const char *s = sect->name;
|
||||||
|
|
||||||
if (s == ".text")
|
if (!strcmp(s, ".text"))
|
||||||
return true;
|
return true;
|
||||||
else if (s == ".data")
|
else if (!strcmp(s, ".data"))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -862,15 +848,15 @@ BOOL OutputTheSection(Section * sect)
|
||||||
|
|
||||||
short int GetCoffFlags(const char *s)
|
short int GetCoffFlags(const char *s)
|
||||||
{
|
{
|
||||||
if (s == ".text")
|
if (!strcmp(s, ".text"))
|
||||||
return STYP_TEXT | STYP_DATA | STYP_ALIGN | 0x400;
|
return STYP_TEXT | STYP_DATA | STYP_ALIGN | 0x400;
|
||||||
else if (s == ".data")
|
else if (!strcmp(s, ".data"))
|
||||||
return STYP_DATA;
|
return STYP_DATA;
|
||||||
else if (s == ".bss")
|
else if (!strcmp(s, ".bss"))
|
||||||
return STYP_BSS;
|
return STYP_BSS;
|
||||||
else if (s == ".stack")
|
else if (!strcmp(s, ".stack"))
|
||||||
return STYP_BSS | STYP_ALIGN | 0x200;
|
return STYP_BSS | STYP_ALIGN | 0x200;
|
||||||
else if (s == ".cinit")
|
else if (!strcmp(s, ".cinit"))
|
||||||
return STYP_COPY | STYP_DATA | STYP_ALIGN | 0x200;
|
return STYP_COPY | STYP_DATA | STYP_ALIGN | 0x200;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1599,6 +1599,15 @@ void longlong_test(void)
|
||||||
printf("%lld\n", value(&a));
|
printf("%lld\n", value(&a));
|
||||||
}
|
}
|
||||||
lloptest(0x80000000, 0);
|
lloptest(0x80000000, 0);
|
||||||
|
|
||||||
|
/* another long long spill test */
|
||||||
|
{
|
||||||
|
long long *p, v;
|
||||||
|
v = 1;
|
||||||
|
p = &v;
|
||||||
|
p[0]++;
|
||||||
|
printf("%lld\n", *p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vprintf1(const char *fmt, ...)
|
void vprintf1(const char *fmt, ...)
|
||||||
|
|
Loading…
Reference in New Issue