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
14- '-Ttext' linker option14- '-Ttext' linker option
15- section alignment fixes15- section alignment fixes
16- bit fields fixes16- bit fields fixes
17- do not generate code for unused inline functions
18- '-oformat' linker option.
19- added 'binary' output format.
17 20
18version 0.9.20:21version 0.9.20:
19 22
tcccoff.c+9−23
@@ -73,9 +73,8 @@ typedef struct { · 72 unmodified lines
73 unsigned short dummy4;73 unsigned short dummy4;
74} AUXEF;74} AUXEF;
75 75
76int tcc_output_coff(TCCState *s1, const char *OutFile)76int tcc_output_coff(TCCState *s1, FILE *f)
77{77{
78 FILE *f;
79 Section *tcc_sect;78 Section *tcc_sect;
80 SCNHDR *coff_sec;79 SCNHDR *coff_sec;
81 int file_pointer;80 int file_pointer;
@@ -84,12 +83,6 @@ int tcc_output_coff(TCCState *s1, const char *OutFile) · 2 unmodified lines
84 FILHDR file_hdr; /* FILE HEADER STRUCTURE */83 FILHDR file_hdr; /* FILE HEADER STRUCTURE */
85 Section *stext, *sdata, *sbss;84 Section *stext, *sdata, *sbss;
86 85
87 f = fopen(OutFile, "wb");
88
89 if (!f) {
90 error("Unable to open output file");
91 }
92
93 stext = FindSection(s1, ".text");86 stext = FindSection(s1, ".text");
94 sdata = FindSection(s1, ".data");87 sdata = FindSection(s1, ".data");
95 sbss = FindSection(s1, ".bss");88 sbss = FindSection(s1, ".bss");
@@ -237,7 +230,7 @@ int tcc_output_coff(TCCState *s1, const char *OutFile) · 141 unmodified lines
237 EndAddress[nFuncs] = pc;230 EndAddress[nFuncs] = pc;
238 FuncEntries[nFuncs] =231 FuncEntries[nFuncs] =
239 (file_pointer -232 (file_pointer -
240 LineNoFilePtr[nFuncs]) / LINESZ;233 LineNoFilePtr[nFuncs]) / LINESZ - 1;
241 LastLineNo[nFuncs++] = last_line_num + 1;234 LastLineNo[nFuncs++] = last_line_num + 1;
242 } else {235 } else {
243 // beginning of function236 // beginning of function
@@ -703,8 +696,6 @@ int tcc_output_coff(TCCState *s1, const char *OutFile) · 459 unmodified lines
703 tcc_free(Coff_str_table);696 tcc_free(Coff_str_table);
704 }697 }
705 698
706 fclose(f);
707
708 return 0;699 return 0;
709}700}
710 701
@@ -843,18 +834,13 @@ int FindCoffSymbolIndex(const char *func_name) · 132 unmodified lines
843 return n; // total number of symbols834 return n; // total number of symbols
844}835}
845 836
846
847
848
849
850
851BOOL OutputTheSection(Section * sect)837BOOL OutputTheSection(Section * sect)
852{838{
853 const char *s = sect->name;839 const char *s = sect->name;
854 840
855 if (s == ".text")841 if (!strcmp(s, ".text"))
856 return true;842 return true;
857 else if (s == ".data")843 else if (!strcmp(s, ".data"))
858 return true;844 return true;
859 else845 else
860 return 0;846 return 0;
@@ -862,15 +848,15 @@ BOOL OutputTheSection(Section * sect) · 1 unmodified line
862 848
863short int GetCoffFlags(const char *s)849short int GetCoffFlags(const char *s)
864{850{
865 if (s == ".text")851 if (!strcmp(s, ".text"))
866 return STYP_TEXT | STYP_DATA | STYP_ALIGN | 0x400;852 return STYP_TEXT | STYP_DATA | STYP_ALIGN | 0x400;
867 else if (s == ".data")853 else if (!strcmp(s, ".data"))
868 return STYP_DATA;854 return STYP_DATA;
869 else if (s == ".bss")855 else if (!strcmp(s, ".bss"))
870 return STYP_BSS;856 return STYP_BSS;
871 else if (s == ".stack")857 else if (!strcmp(s, ".stack"))
872 return STYP_BSS | STYP_ALIGN | 0x200;858 return STYP_BSS | STYP_ALIGN | 0x200;
873 else if (s == ".cinit")859 else if (!strcmp(s, ".cinit"))
874 return STYP_COPY | STYP_DATA | STYP_ALIGN | 0x200;860 return STYP_COPY | STYP_DATA | STYP_ALIGN | 0x200;
875 else861 else
876 return 0;862 return 0;
tcctest.c+9−0
@@ -1599,6 +1599,15 @@ void longlong_test(void) · 1598 unmodified lines
1599 printf("%lld\n", value(&a));1599 printf("%lld\n", value(&a));
1600 }1600 }
1601 lloptest(0x80000000, 0);1601 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 }
1602}1611}
1603 1612
1604void vprintf1(const char *fmt, ...)1613void vprintf1(const char *fmt, ...)
tcctok.h+2−0
@@ -181,6 +181,8 @@ · 180 unmodified lines
181 DEF_ASM(skip)181 DEF_ASM(skip)
182 DEF_ASM(space)182 DEF_ASM(space)
183 DEF_ASM(string)183 DEF_ASM(string)
184 DEF_ASM(asciz)
185 DEF_ASM(ascii)
184 DEF_ASM(globl)186 DEF_ASM(globl)
185 DEF_ASM(global)187 DEF_ASM(global)
186 DEF_ASM(text)188 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