History

update

bellard committed 22 years ago

Commit bb07bf31 parent eb794714 files · +23 −23Browse files

Unified · Split

4 files
  1. Changelog +3 −0
  2. tcccoff.c +9 −23
  3. tcctest.c +9 −0
  4. tcctok.h +2 −0
Changelog+3−0
@@ -14,6 +14,9 @@ version 0.9.21: · 13 unmodified lines
1414 - '-Ttext' linker option
1515 - section alignment fixes
1616 - bit fields fixes
17+- do not generate code for unused inline functions
18+- '-oformat' linker option.
19+- added 'binary' output format.
1720
1821 version 0.9.20:
1922
tcccoff.c+9−23
@@ -73,9 +73,8 @@ typedef struct { · 72 unmodified lines
7373 unsigned short dummy4;
7474 } AUXEF;
7575
76−int tcc_output_coff(TCCState *s1, const char *OutFile)
76+int tcc_output_coff(TCCState *s1, FILE *f)
7777 {
78− FILE *f;
7978 Section *tcc_sect;
8079 SCNHDR *coff_sec;
8180 int file_pointer;
@@ -84,12 +83,6 @@ int tcc_output_coff(TCCState *s1, const char *OutFile) · 2 unmodified lines
8483 FILHDR file_hdr; /* FILE HEADER STRUCTURE */
8584 Section *stext, *sdata, *sbss;
8685
87− f = fopen(OutFile, "wb");
88−
89− if (!f) {
90− error("Unable to open output file");
91− }
92−
9386 stext = FindSection(s1, ".text");
9487 sdata = FindSection(s1, ".data");
9588 sbss = FindSection(s1, ".bss");
@@ -237,7 +230,7 @@ int tcc_output_coff(TCCState *s1, const char *OutFile) · 141 unmodified lines
237230 EndAddress[nFuncs] = pc;
238231 FuncEntries[nFuncs] =
239232 (file_pointer -
240− LineNoFilePtr[nFuncs]) / LINESZ;
233+ LineNoFilePtr[nFuncs]) / LINESZ - 1;
241234 LastLineNo[nFuncs++] = last_line_num + 1;
242235 } else {
243236 // beginning of function
@@ -703,8 +696,6 @@ int tcc_output_coff(TCCState *s1, const char *OutFile) · 459 unmodified lines
703696 tcc_free(Coff_str_table);
704697 }
705698
706− fclose(f);
707−
708699 return 0;
709700 }
710701
@@ -843,18 +834,13 @@ int FindCoffSymbolIndex(const char *func_name) · 132 unmodified lines
843834 return n; // total number of symbols
844835 }
845836
846−
847−
848−
849−
850−
851837 BOOL OutputTheSection(Section * sect)
852838 {
853839 const char *s = sect->name;
854840
855− if (s == ".text")
841+ if (!strcmp(s, ".text"))
856842 return true;
857− else if (s == ".data")
843+ else if (!strcmp(s, ".data"))
858844 return true;
859845 else
860846 return 0;
@@ -862,15 +848,15 @@ BOOL OutputTheSection(Section * sect) · 1 unmodified line
862848
863849 short int GetCoffFlags(const char *s)
864850 {
865− if (s == ".text")
851+ if (!strcmp(s, ".text"))
866852 return STYP_TEXT | STYP_DATA | STYP_ALIGN | 0x400;
867− else if (s == ".data")
853+ else if (!strcmp(s, ".data"))
868854 return STYP_DATA;
869− else if (s == ".bss")
855+ else if (!strcmp(s, ".bss"))
870856 return STYP_BSS;
871− else if (s == ".stack")
857+ else if (!strcmp(s, ".stack"))
872858 return STYP_BSS | STYP_ALIGN | 0x200;
873− else if (s == ".cinit")
859+ else if (!strcmp(s, ".cinit"))
874860 return STYP_COPY | STYP_DATA | STYP_ALIGN | 0x200;
875861 else
876862 return 0;
tcctest.c+9−0
@@ -1599,6 +1599,15 @@ void longlong_test(void) · 1598 unmodified lines
15991599 printf("%lld\n", value(&a));
16001600 }
16011601 lloptest(0x80000000, 0);
1602+
1603+ /* another long long spill test */
1604+ {
1605+ long long *p, v;
1606+ v = 1;
1607+ p = &v;
1608+ p[0]++;
1609+ printf("%lld\n", *p);
1610+ }
16021611 }
16031612
16041613 void vprintf1(const char *fmt, ...)
tcctok.h+2−0
@@ -181,6 +181,8 @@ · 180 unmodified lines
181181 DEF_ASM(skip)
182182 DEF_ASM(space)
183183 DEF_ASM(string)
184+ DEF_ASM(asciz)
185+ DEF_ASM(ascii)
184186 DEF_ASM(globl)
185187 DEF_ASM(global)
186188 DEF_ASM(text)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t