History

Merge branch 'mob' of git://repo.or.cz/tinycc into mypatch

Add Visual Studio processor identification

Christian Jullien committed 10 years ago

Commit 6db7a212 parents 30238b1 ff158bf5 files · +20 −20Browse files

Unified · Split

5 files
  1. libtcc.c +6 −6
  2. tcc.h +3 −3
  3. tccelf.c +2 −2
  4. tccpp.c +2 −2
  5. x86_64-gen.c +7 −7
libtcc.c+6−6
@@ -135,7 +135,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) · 134 unmodified lines
135 135
136/********************************************************/136/********************************************************/
137/* copy a string and truncate it. */137/* copy a string and truncate it. */
138PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)138ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
139{139{
140 char *q, *q_end;140 char *q, *q_end;
141 int c;141 int c;
@@ -155,7 +155,7 @@ PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s) · 13 unmodified lines
155}155}
156 156
157/* strcat and truncate. */157/* strcat and truncate. */
158PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s)158ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
159{159{
160 int len;160 int len;
161 len = strlen(buf);161 len = strlen(buf);
@@ -164,7 +164,7 @@ PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s) · 2 unmodified lines
164 return buf;164 return buf;
165}165}
166 166
167PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num)167ST_FUNC char *pstrncpy(char *out, const char *in, size_t num)
168{168{
169 memcpy(out, in, num);169 memcpy(out, in, num);
170 out[num] = '\0';170 out[num] = '\0';
@@ -1544,7 +1544,7 @@ typedef struct stat file_info_t; · 1373 unmodified lines
1544typedef BY_HANDLE_FILE_INFORMATION file_info_t;1544typedef BY_HANDLE_FILE_INFORMATION file_info_t;
1545#endif1545#endif
1546 1546
1547int get_file_info(const char *fname, file_info_t *out_info)1547static int get_file_info(const char *fname, file_info_t *out_info)
1548{1548{
1549#ifndef _WIN321549#ifndef _WIN32
1550 return stat(fname, out_info);1550 return stat(fname, out_info);
@@ -1561,7 +1561,7 @@ int get_file_info(const char *fname, file_info_t *out_info) · 10 unmodified lines
1561#endif1561#endif
1562}1562}
1563 1563
1564int is_dir(file_info_t *info)1564static int is_dir(file_info_t *info)
1565{1565{
1566#ifndef _WIN321566#ifndef _WIN32
1567 return S_ISDIR(info->st_mode);1567 return S_ISDIR(info->st_mode);
@@ -1571,7 +1571,7 @@ int is_dir(file_info_t *info) · 3 unmodified lines
1571#endif1571#endif
1572}1572}
1573 1573
1574int is_same_file(const file_info_t *fi1, const file_info_t *fi2)1574static int is_same_file(const file_info_t *fi1, const file_info_t *fi2)
1575{1575{
1576#ifndef _WIN321576#ifndef _WIN32
1577 return fi1->st_dev == fi2->st_dev &&1577 return fi1->st_dev == fi2->st_dev &&
tcc.h+3−3
@@ -1167,9 +1167,9 @@ ST_DATA struct TCCState *tcc_state; · 1166 unmodified lines
1167#define AFF_PREPROCESS 0x0004 /* preprocess file */1167#define AFF_PREPROCESS 0x0004 /* preprocess file */
1168 1168
1169/* public functions currently used by the tcc main function */1169/* public functions currently used by the tcc main function */
1170PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);1170ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
1171PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s);1171ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
1172PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num);1172ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
1173PUB_FUNC char *tcc_basename(const char *name);1173PUB_FUNC char *tcc_basename(const char *name);
1174PUB_FUNC char *tcc_fileextension (const char *name);1174PUB_FUNC char *tcc_fileextension (const char *name);
1175 1175
tccelf.c+2−2
@@ -1729,7 +1729,7 @@ static void tcc_output_binary(TCCState *s1, FILE *f, · 1728 unmodified lines
1729#define EXTRA_RELITEMS 141729#define EXTRA_RELITEMS 14
1730 1730
1731/* move the relocation value from .dynsym to .got */1731/* move the relocation value from .dynsym to .got */
1732void patch_dynsym_undef(TCCState *s1, Section *s)1732static void patch_dynsym_undef(TCCState *s1, Section *s)
1733{1733{
1734 uint32_t *gotd = (void *)s1->got->data;1734 uint32_t *gotd = (void *)s1->got->data;
1735 ElfW(Sym) *sym;1735 ElfW(Sym) *sym;
@@ -1748,7 +1748,7 @@ void patch_dynsym_undef(TCCState *s1, Section *s) · 12 unmodified lines
1748#define EXTRA_RELITEMS 91748#define EXTRA_RELITEMS 9
1749 1749
1750/* zero plt offsets of weak symbols in .dynsym */1750/* zero plt offsets of weak symbols in .dynsym */
1751void patch_dynsym_undef(TCCState *s1, Section *s)1751static void patch_dynsym_undef(TCCState *s1, Section *s)
1752{1752{
1753 ElfW(Sym) *sym;1753 ElfW(Sym) *sym;
1754 1754
tccpp.c+2−2
@@ -2048,7 +2048,7 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long · 2047 unmodified lines
2048 cstr_wccat(outstr, '\0');2048 cstr_wccat(outstr, '\0');
2049}2049}
2050 2050
2051void parse_string(const char *s, int len)2051static void parse_string(const char *s, int len)
2052{2052{
2053 uint8_t buf[1000], *p = buf;2053 uint8_t buf[1000], *p = buf;
2054 int is_long, sep;2054 int is_long, sep;
@@ -3208,7 +3208,7 @@ static int macro_subst_tok( · 1153 unmodified lines
3208 return 0;3208 return 0;
3209}3209}
3210 3210
3211int paste_tokens(int t1, CValue *v1, int t2, CValue *v2)3211static int paste_tokens(int t1, CValue *v1, int t2, CValue *v2)
3212{3212{
3213 CString cstr;3213 CString cstr;
3214 int n;3214 int n;
x86_64-gen.c+7−7
@@ -156,7 +156,7 @@ static unsigned long func_sub_sp_offset; · 155 unmodified lines
156static int func_ret_sub;156static int func_ret_sub;
157 157
158/* XXX: make it faster ? */158/* XXX: make it faster ? */
159void g(int c)159ST_FUNC void g(int c)
160{160{
161 int ind1;161 int ind1;
162 ind1 = ind + 1;162 ind1 = ind + 1;
@@ -166,7 +166,7 @@ void g(int c) · 3 unmodified lines
166 ind = ind1;166 ind = ind1;
167}167}
168 168
169void o(unsigned int c)169ST_FUNC void o(unsigned int c)
170{170{
171 while (c) {171 while (c) {
172 g(c);172 g(c);
@@ -174,13 +174,13 @@ void o(unsigned int c) · 1 unmodified line
174 }174 }
175}175}
176 176
177void gen_le16(int v)177ST_FUNC void gen_le16(int v)
178{178{
179 g(v);179 g(v);
180 g(v >> 8);180 g(v >> 8);
181}181}
182 182
183void gen_le32(int c)183ST_FUNC void gen_le32(int c)
184{184{
185 g(c);185 g(c);
186 g(c >> 8);186 g(c >> 8);
@@ -188,7 +188,7 @@ void gen_le32(int c) · 1 unmodified line
188 g(c >> 24);188 g(c >> 24);
189}189}
190 190
191void gen_le64(int64_t c)191ST_FUNC void gen_le64(int64_t c)
192{192{
193 g(c);193 g(c);
194 g(c >> 8);194 g(c >> 8);
@@ -200,7 +200,7 @@ void gen_le64(int64_t c) · 5 unmodified lines
200 g(c >> 56);200 g(c >> 56);
201}201}
202 202
203void orex(int ll, int r, int r2, int b)203static void orex(int ll, int r, int r2, int b)
204{204{
205 if ((r & VT_VALMASK) >= VT_CONST)205 if ((r & VT_VALMASK) >= VT_CONST)
206 r = 0;206 r = 0;
@@ -212,7 +212,7 @@ void orex(int ll, int r, int r2, int b) · 5 unmodified lines
212}212}
213 213
214/* output a symbol and patch all calls to it */214/* output a symbol and patch all calls to it */
215void gsym_addr(int t, int a)215ST_FUNC void gsym_addr(int t, int a)
216{216{
217 while (t) {217 while (t) {
218 unsigned char *ptr = cur_text_section->data + t;218 unsigned char *ptr = cur_text_section->data + t;

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