mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-10 06:50:10 +08:00
Merge branch 'mob' of git://repo.or.cz/tinycc into mypatch
Add Visual Studio processor identification
This commit is contained in:
commit
6db7a2157b
12
libtcc.c
12
libtcc.c
@ -135,7 +135,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
/* copy a string and truncate it. */
|
/* copy a string and truncate it. */
|
||||||
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
|
ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
|
||||||
{
|
{
|
||||||
char *q, *q_end;
|
char *q, *q_end;
|
||||||
int c;
|
int c;
|
||||||
@ -155,7 +155,7 @@ PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* strcat and truncate. */
|
/* strcat and truncate. */
|
||||||
PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
|
ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
@ -164,7 +164,7 @@ PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num)
|
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num)
|
||||||
{
|
{
|
||||||
memcpy(out, in, num);
|
memcpy(out, in, num);
|
||||||
out[num] = '\0';
|
out[num] = '\0';
|
||||||
@ -1544,7 +1544,7 @@ typedef struct stat file_info_t;
|
|||||||
typedef BY_HANDLE_FILE_INFORMATION file_info_t;
|
typedef BY_HANDLE_FILE_INFORMATION file_info_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int get_file_info(const char *fname, file_info_t *out_info)
|
static int get_file_info(const char *fname, file_info_t *out_info)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
return stat(fname, out_info);
|
return stat(fname, out_info);
|
||||||
@ -1561,7 +1561,7 @@ int get_file_info(const char *fname, file_info_t *out_info)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_dir(file_info_t *info)
|
static int is_dir(file_info_t *info)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
return S_ISDIR(info->st_mode);
|
return S_ISDIR(info->st_mode);
|
||||||
@ -1571,7 +1571,7 @@ int is_dir(file_info_t *info)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_same_file(const file_info_t *fi1, const file_info_t *fi2)
|
static int is_same_file(const file_info_t *fi1, const file_info_t *fi2)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
return fi1->st_dev == fi2->st_dev &&
|
return fi1->st_dev == fi2->st_dev &&
|
||||||
|
6
tcc.h
6
tcc.h
@ -1167,9 +1167,9 @@ ST_DATA struct TCCState *tcc_state;
|
|||||||
#define AFF_PREPROCESS 0x0004 /* preprocess file */
|
#define AFF_PREPROCESS 0x0004 /* preprocess file */
|
||||||
|
|
||||||
/* public functions currently used by the tcc main function */
|
/* public functions currently used by the tcc main function */
|
||||||
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
|
ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
|
||||||
PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
|
ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
|
||||||
PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num);
|
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
|
||||||
PUB_FUNC char *tcc_basename(const char *name);
|
PUB_FUNC char *tcc_basename(const char *name);
|
||||||
PUB_FUNC char *tcc_fileextension (const char *name);
|
PUB_FUNC char *tcc_fileextension (const char *name);
|
||||||
|
|
||||||
|
4
tccelf.c
4
tccelf.c
@ -1729,7 +1729,7 @@ static void tcc_output_binary(TCCState *s1, FILE *f,
|
|||||||
#define EXTRA_RELITEMS 14
|
#define EXTRA_RELITEMS 14
|
||||||
|
|
||||||
/* move the relocation value from .dynsym to .got */
|
/* move the relocation value from .dynsym to .got */
|
||||||
void patch_dynsym_undef(TCCState *s1, Section *s)
|
static void patch_dynsym_undef(TCCState *s1, Section *s)
|
||||||
{
|
{
|
||||||
uint32_t *gotd = (void *)s1->got->data;
|
uint32_t *gotd = (void *)s1->got->data;
|
||||||
ElfW(Sym) *sym;
|
ElfW(Sym) *sym;
|
||||||
@ -1748,7 +1748,7 @@ void patch_dynsym_undef(TCCState *s1, Section *s)
|
|||||||
#define EXTRA_RELITEMS 9
|
#define EXTRA_RELITEMS 9
|
||||||
|
|
||||||
/* zero plt offsets of weak symbols in .dynsym */
|
/* zero plt offsets of weak symbols in .dynsym */
|
||||||
void patch_dynsym_undef(TCCState *s1, Section *s)
|
static void patch_dynsym_undef(TCCState *s1, Section *s)
|
||||||
{
|
{
|
||||||
ElfW(Sym) *sym;
|
ElfW(Sym) *sym;
|
||||||
|
|
||||||
|
4
tccpp.c
4
tccpp.c
@ -2048,7 +2048,7 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long
|
|||||||
cstr_wccat(outstr, '\0');
|
cstr_wccat(outstr, '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_string(const char *s, int len)
|
static void parse_string(const char *s, int len)
|
||||||
{
|
{
|
||||||
uint8_t buf[1000], *p = buf;
|
uint8_t buf[1000], *p = buf;
|
||||||
int is_long, sep;
|
int is_long, sep;
|
||||||
@ -3208,7 +3208,7 @@ static int macro_subst_tok(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int paste_tokens(int t1, CValue *v1, int t2, CValue *v2)
|
static int paste_tokens(int t1, CValue *v1, int t2, CValue *v2)
|
||||||
{
|
{
|
||||||
CString cstr;
|
CString cstr;
|
||||||
int n;
|
int n;
|
||||||
|
14
x86_64-gen.c
14
x86_64-gen.c
@ -156,7 +156,7 @@ static unsigned long func_sub_sp_offset;
|
|||||||
static int func_ret_sub;
|
static int func_ret_sub;
|
||||||
|
|
||||||
/* XXX: make it faster ? */
|
/* XXX: make it faster ? */
|
||||||
void g(int c)
|
ST_FUNC void g(int c)
|
||||||
{
|
{
|
||||||
int ind1;
|
int ind1;
|
||||||
ind1 = ind + 1;
|
ind1 = ind + 1;
|
||||||
@ -166,7 +166,7 @@ void g(int c)
|
|||||||
ind = ind1;
|
ind = ind1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void o(unsigned int c)
|
ST_FUNC void o(unsigned int c)
|
||||||
{
|
{
|
||||||
while (c) {
|
while (c) {
|
||||||
g(c);
|
g(c);
|
||||||
@ -174,13 +174,13 @@ void o(unsigned int c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gen_le16(int v)
|
ST_FUNC void gen_le16(int v)
|
||||||
{
|
{
|
||||||
g(v);
|
g(v);
|
||||||
g(v >> 8);
|
g(v >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gen_le32(int c)
|
ST_FUNC void gen_le32(int c)
|
||||||
{
|
{
|
||||||
g(c);
|
g(c);
|
||||||
g(c >> 8);
|
g(c >> 8);
|
||||||
@ -188,7 +188,7 @@ void gen_le32(int c)
|
|||||||
g(c >> 24);
|
g(c >> 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gen_le64(int64_t c)
|
ST_FUNC void gen_le64(int64_t c)
|
||||||
{
|
{
|
||||||
g(c);
|
g(c);
|
||||||
g(c >> 8);
|
g(c >> 8);
|
||||||
@ -200,7 +200,7 @@ void gen_le64(int64_t c)
|
|||||||
g(c >> 56);
|
g(c >> 56);
|
||||||
}
|
}
|
||||||
|
|
||||||
void orex(int ll, int r, int r2, int b)
|
static void orex(int ll, int r, int r2, int b)
|
||||||
{
|
{
|
||||||
if ((r & VT_VALMASK) >= VT_CONST)
|
if ((r & VT_VALMASK) >= VT_CONST)
|
||||||
r = 0;
|
r = 0;
|
||||||
@ -212,7 +212,7 @@ void orex(int ll, int r, int r2, int b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* output a symbol and patch all calls to it */
|
/* output a symbol and patch all calls to it */
|
||||||
void gsym_addr(int t, int a)
|
ST_FUNC void gsym_addr(int t, int a)
|
||||||
{
|
{
|
||||||
while (t) {
|
while (t) {
|
||||||
unsigned char *ptr = cur_text_section->data + t;
|
unsigned char *ptr = cur_text_section->data + t;
|
||||||
|
Loading…
Reference in New Issue
Block a user