mirror of
https://github.com/frida/tinycc
synced 2024-11-27 18:19:35 +03:00
build from multiple objects: fix other targets
This commit is contained in:
parent
b54862406e
commit
0de95730ad
7
libtcc.c
7
libtcc.c
@ -111,6 +111,13 @@ static void tcc_set_lib_path_w32(TCCState *s)
|
|||||||
tcc_set_lib_path(s, path);
|
tcc_set_lib_path(s, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_TCC_STATIC
|
||||||
|
void dlclose(void *p)
|
||||||
|
{
|
||||||
|
FreeLibrary((HMODULE)p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LIBTCC_AS_DLL
|
#ifdef LIBTCC_AS_DLL
|
||||||
BOOL WINAPI DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
BOOL WINAPI DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
|
25
tcc.h
25
tcc.h
@ -49,7 +49,6 @@
|
|||||||
#include <direct.h> /* getcwd */
|
#include <direct.h> /* getcwd */
|
||||||
#define inline __inline
|
#define inline __inline
|
||||||
#define inp next_inp
|
#define inp next_inp
|
||||||
#define dlclose FreeLibrary
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#define uplong unsigned long long
|
#define uplong unsigned long long
|
||||||
#endif
|
#endif
|
||||||
@ -1015,6 +1014,13 @@ ST_FUNC void vpushi(int v);
|
|||||||
ST_FUNC Sym *external_global_sym(int v, CType *type, int r);
|
ST_FUNC Sym *external_global_sym(int v, CType *type, int r);
|
||||||
ST_FUNC void vset(CType *type, int r, int v);
|
ST_FUNC void vset(CType *type, int r, int v);
|
||||||
ST_FUNC void vswap(void);
|
ST_FUNC void vswap(void);
|
||||||
|
ST_FUNC void vpush_global_sym(CType *type, int v);
|
||||||
|
ST_FUNC void vrott(int n);
|
||||||
|
#ifdef TCC_TARGET_ARM
|
||||||
|
ST_FUNC int get_reg_ex(int rc, int rc2);
|
||||||
|
ST_FUNC void vnrott(int n);
|
||||||
|
ST_FUNC void lexpand_nr(void);
|
||||||
|
#endif
|
||||||
ST_FUNC void vpushv(SValue *v);
|
ST_FUNC void vpushv(SValue *v);
|
||||||
ST_FUNC void save_reg(int r);
|
ST_FUNC void save_reg(int r);
|
||||||
ST_FUNC int get_reg(int rc);
|
ST_FUNC int get_reg(int rc);
|
||||||
@ -1036,7 +1042,7 @@ ST_FUNC void gexpr(void);
|
|||||||
ST_FUNC int expr_const(void);
|
ST_FUNC int expr_const(void);
|
||||||
ST_FUNC void gen_inline_functions(void);
|
ST_FUNC void gen_inline_functions(void);
|
||||||
ST_FUNC void decl(int l);
|
ST_FUNC void decl(int l);
|
||||||
#ifdef CONFIG_TCC_BCHECK
|
#if defined CONFIG_TCC_BCHECK || defined TCC_TARGET_C67
|
||||||
ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsigned long size);
|
ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsigned long size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1145,6 +1151,7 @@ ST_FUNC void gen_cvt_itof1(int t);
|
|||||||
|
|
||||||
#ifdef TCC_TARGET_COFF
|
#ifdef TCC_TARGET_COFF
|
||||||
ST_FUNC int tcc_output_coff(TCCState *s1, FILE *f);
|
ST_FUNC int tcc_output_coff(TCCState *s1, FILE *f);
|
||||||
|
ST_FUNC int tcc_load_coff(TCCState * s1, int fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ------------ tccasm.c ------------ */
|
/* ------------ tccasm.c ------------ */
|
||||||
@ -1178,10 +1185,19 @@ ST_FUNC void pe_add_unwind_data(unsigned start, unsigned end, unsigned stack);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ------------ tccrun.c ----------------- */
|
/* ------------ tccrun.c ----------------- */
|
||||||
#if !defined CONFIG_TCC_STATIC && !defined _WIN32
|
#ifdef CONFIG_TCC_STATIC
|
||||||
|
#define RTLD_LAZY 0x001
|
||||||
|
#define RTLD_NOW 0x002
|
||||||
|
#define RTLD_GLOBAL 0x100
|
||||||
|
#define RTLD_DEFAULT NULL
|
||||||
|
/* dummy function for profiling */
|
||||||
|
ST_FUNC void *dlopen(const char *filename, int flag);
|
||||||
|
ST_FUNC void dlclose(void *p);
|
||||||
|
//ST_FUNC const char *dlerror(void);
|
||||||
|
ST_FUNC void *resolve_sym(TCCState *s1, const char *symbol);
|
||||||
|
#elif !defined TCC_TARGET_PE || !defined _WIN32
|
||||||
ST_FUNC void *resolve_sym(TCCState *s1, const char *symbol);
|
ST_FUNC void *resolve_sym(TCCState *s1, const char *symbol);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
/* include the target specific definitions */
|
/* include the target specific definitions */
|
||||||
|
|
||||||
@ -1196,6 +1212,7 @@ ST_FUNC void *resolve_sym(TCCState *s1, const char *symbol);
|
|||||||
#include "arm-gen.c"
|
#include "arm-gen.c"
|
||||||
#endif
|
#endif
|
||||||
#ifdef TCC_TARGET_C67
|
#ifdef TCC_TARGET_C67
|
||||||
|
#include "coff.h"
|
||||||
#include "c67-gen.c"
|
#include "c67-gen.c"
|
||||||
#endif
|
#endif
|
||||||
#undef TARGET_DEFS_ONLY
|
#undef TARGET_DEFS_ONLY
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tcc.h"
|
#include "tcc.h"
|
||||||
#include "coff.h"
|
|
||||||
|
|
||||||
#define MAXNSCNS 255 /* MAXIMUM NUMBER OF SECTIONS */
|
#define MAXNSCNS 255 /* MAXIMUM NUMBER OF SECTIONS */
|
||||||
#define MAX_STR_TABLE 1000000
|
#define MAX_STR_TABLE 1000000
|
||||||
@ -869,7 +868,7 @@ Section *FindSection(TCCState * s1, const char *sname)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tcc_load_coff(TCCState * s1, int fd)
|
ST_FUNC int tcc_load_coff(TCCState * s1, int fd)
|
||||||
{
|
{
|
||||||
// tktk TokenSym *ts;
|
// tktk TokenSym *ts;
|
||||||
|
|
||||||
|
2
tccelf.c
2
tccelf.c
@ -442,7 +442,7 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve)
|
|||||||
if (sh_num == SHN_UNDEF) {
|
if (sh_num == SHN_UNDEF) {
|
||||||
name = strtab_section->data + sym->st_name;
|
name = strtab_section->data + sym->st_name;
|
||||||
if (do_resolve) {
|
if (do_resolve) {
|
||||||
#ifndef _WIN32
|
#if !defined TCC_TARGET_PE || !defined _WIN32
|
||||||
void *addr;
|
void *addr;
|
||||||
name = symtab_section->link->data + sym->st_name;
|
name = symtab_section->link->data + sym->st_name;
|
||||||
addr = resolve_sym(s1, name);
|
addr = resolve_sym(s1, name);
|
||||||
|
6
tccgen.c
6
tccgen.c
@ -364,7 +364,7 @@ static Sym *external_sym(int v, CType *type, int r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* push a reference to global symbol v */
|
/* push a reference to global symbol v */
|
||||||
static void vpush_global_sym(CType *type, int v)
|
ST_FUNC void vpush_global_sym(CType *type, int v)
|
||||||
{
|
{
|
||||||
Sym *sym;
|
Sym *sym;
|
||||||
CValue cval;
|
CValue cval;
|
||||||
@ -897,7 +897,7 @@ static void vrotb(int n)
|
|||||||
/* rotate n first stack elements to the top
|
/* rotate n first stack elements to the top
|
||||||
I1 ... In -> In I1 ... I(n-1) [top is right]
|
I1 ... In -> In I1 ... I(n-1) [top is right]
|
||||||
*/
|
*/
|
||||||
static void vrott(int n)
|
ST_FUNC void vrott(int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SValue tmp;
|
SValue tmp;
|
||||||
@ -912,7 +912,7 @@ static void vrott(int n)
|
|||||||
/* like vrott but in other direction
|
/* like vrott but in other direction
|
||||||
In ... I1 -> I(n-1) ... I1 In [top is right]
|
In ... I1 -> I(n-1) ... I1 In [top is right]
|
||||||
*/
|
*/
|
||||||
void vnrott(int n)
|
ST_FUNC void vnrott(int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SValue tmp;
|
SValue tmp;
|
||||||
|
4
tccrun.c
4
tccrun.c
@ -562,12 +562,12 @@ void *dlopen(const char *filename, int flag)
|
|||||||
void dlclose(void *p)
|
void dlclose(void *p)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
const char *dlerror(void)
|
const char *dlerror(void)
|
||||||
{
|
{
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
typedef struct TCCSyms {
|
typedef struct TCCSyms {
|
||||||
char *str;
|
char *str;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#ifdef TARGET_DEFS_ONLY
|
#ifdef TARGET_DEFS_ONLY
|
||||||
|
|
||||||
/* number of available registers */
|
/* number of available registers */
|
||||||
#define NB_REGS 10
|
#define NB_REGS 5
|
||||||
#define NB_ASM_REGS 8
|
#define NB_ASM_REGS 8
|
||||||
|
|
||||||
/* a register can belong to several classes. The classes must be
|
/* a register can belong to several classes. The classes must be
|
||||||
|
Loading…
Reference in New Issue
Block a user