2 * TCC - Tiny C Compiler
4 * Copyright (c) 2001-2004 Fabrice Bellard
5 * Copyright (C) 2006-2007 Rob Landley
7 * Licensed under GPLv2, see file LICENSE in this tarball.
14#define CONFIG_TCC_STATIC
36#endif /* !CONFIG_TCCBOOT */
53/* preprocessor debug */
55/* include file debug */
62//#define TCC_TARGET_I386 /* i386 code generator */
63//#define TCC_TARGET_ARM /* ARMv4 code generator */
64//#define TCC_TARGET_C67 /* TMS320C67xx code generator */
66/* default target is I386 */
67#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) && \
68 !defined(TCC_TARGET_C67)
69#define TCC_TARGET_I386
72#if !defined(WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \
73 !defined(TCC_TARGET_C67)
74#define CONFIG_TCC_BCHECK /* enable bound checking code */
77#if defined(WIN32) && !defined(TCC_TARGET_PE)
78#define CONFIG_TCC_STATIC
81/* define it to include assembler support */
82#if !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_C67)
86/* object format selection */
87#if defined(TCC_TARGET_C67)
88#define TCC_TARGET_COFF
97#define INCLUDE_STACK_SIZE 32
98#define IFDEF_STACK_SIZE 64
99#define VSTACK_SIZE 256
100#define STRING_MAX_SIZE 1024
101#define PACK_STACK_SIZE 8
103#define TOK_HASH_SIZE 8192 /* must be a power of two */
104#define TOK_ALLOC_INCR 512 /* must be a power of two */
105#define TOK_MAX_SIZE 5 /* token max size in int unit when stored in string */
107/* token symbol management */
108typedef struct TokenSym {
109 struct TokenSym *hash_next;
110 struct Sym *sym_define; /* direct pointer to define */
111 struct Sym *sym_label; /* direct pointer to label */
112 struct Sym *sym_struct; /* direct pointer to structure */
113 struct Sym *sym_identifier; /* direct pointer to identifier */
114 int tok; /* token number */
120typedef unsigned short nwchar_t;
121#define LIB_PATH_SEPCHAR ';'
124#define LIB_PATH_SEPCHAR ':'
127typedef struct CString {
128 int size; /* size in bytes */
129 void *data; /* either 'char *' or 'nwchar_t *' */
131 void *data_allocated; /* if non NULL, data has been malloced */
135typedef struct CType {
141typedef union CValue {
147 unsigned long ul; /* address (should be unsigned long on 64 bit cpu) */
149 unsigned long long ull;
150 struct CString *cstr;
156typedef struct SValue {
157 CType type; /* type */
158 unsigned short r; /* register + flags */
159 unsigned short r2; /* second register, used for 'long long'
160 type. If not used, set to VT_CONST */
161 CValue c; /* constant, if VT_CONST */
162 struct Sym *sym; /* symbol, if (VT_SYM | VT_CONST) */
165/* symbol management */
167 int v; /* symbol token */
168 int r; /* associated register */
169 int c; /* associated number */
170 CType type; /* associated type */
171 struct Sym *next; /* next related symbol */
172 struct Sym *prev; /* prev symbol in stack */
173 struct Sym *prev_tok; /* previous symbol for this token */
176/* section definition */
177/* XXX: use directly ELF structure for parameters ? */
178/* special flag to indicate that the section should not be linked to
180#define SHF_PRIVATE 0x80000000
182typedef struct Section {
183 unsigned long data_offset; /* current data offset */
184 unsigned char *data; /* section data */
185 unsigned long data_allocated; /* used for realloc() handling */
186 int sh_name; /* elf section name (only used during output) */
187 int sh_num; /* elf section number */
188 int sh_type; /* elf section type */
189 int sh_flags; /* elf section flags */
190 int sh_info; /* elf section info */
191 int sh_addralign; /* elf section alignment */
192 int sh_entsize; /* elf entry size */
193 unsigned long sh_size; /* section size (only used during output) */
194 unsigned long sh_addr; /* address at which the section is relocated */
195 unsigned long sh_offset; /* file offset */
196 int nb_hashed_syms; /* used to resize the hash table */
197 struct Section *link; /* link to another section */
198 struct Section *reloc; /* corresponding section for relocation, if any */
199 struct Section *hash; /* hash table for symbols */
200 struct Section *next;
201 char name[1]; /* section name */
204typedef struct DLLReference {
209/* GNUC attribute definition */
210typedef struct AttributeDef {
214 unsigned char func_call; /* FUNC_CDECL, FUNC_STDCALL, FUNC_FASTCALLx */
215 unsigned char dllexport;
218#define SYM_STRUCT 0x40000000 /* struct/union/enum symbol space */
219#define SYM_FIELD 0x20000000 /* struct/union field symbol space */
220#define SYM_FIRST_ANOM 0x10000000 /* first anonymous sym */
222/* stored in 'Sym.c' field */
223#define FUNC_NEW 1 /* ansi function prototype */
224#define FUNC_OLD 2 /* old function prototype */
225#define FUNC_ELLIPSIS 3 /* ansi function prototype with ... */
227/* stored in 'Sym.r' field */
228#define FUNC_CDECL 0 /* standard c call */
229#define FUNC_STDCALL 1 /* pascal c call */
230#define FUNC_FASTCALL1 2 /* first param in %eax */
231#define FUNC_FASTCALL2 3 /* first parameters in %eax, %edx */
232#define FUNC_FASTCALL3 4 /* first parameter in %eax, %edx, %ecx */
233#define FUNC_FASTCALLW 5 /* first parameter in %ecx, %edx */
235/* field 'Sym.t' for macros */
236#define MACRO_OBJ 0 /* object like macro */
237#define MACRO_FUNC 1 /* function like macro */
239/* field 'Sym.r' for C labels */
240#define LABEL_DEFINED 0 /* label is defined */
241#define LABEL_FORWARD 1 /* label is forward defined */
242#define LABEL_DECLARED 2 /* label is declared but never used */
244/* type_decl() types */
245#define TYPE_ABSTRACT 1 /* type without variable */
246#define TYPE_DIRECT 2 /* type with variable */
248#define IO_BUF_SIZE 8192
250typedef struct BufferedFile {
254 int line_num; /* current line number - here to simplify code */
255 int ifndef_macro; /* #ifndef macro / #endif search */
256 int ifndef_macro_saved; /* saved ifndef_macro */
257 int *ifdef_stack_ptr; /* ifdef_stack value at the start of the file */
258 char inc_type; /* type of include */
259 char inc_filename[512]; /* filename specified by the user */
260 char filename[1024]; /* current filename - here to simplify code */
261 unsigned char buffer[IO_BUF_SIZE + 1]; /* extra size for CH_EOB char */
264#define CH_EOB '\\' /* end of buffer or '\0' char in file */
265#define CH_EOF (-1) /* end of file */
267/* parsing state (used to save parser state to reparse part of the
268 source several times) */
269typedef struct ParseState {
276/* used to record tokens */
277typedef struct TokenString {
284/* include file cache, used to find files faster and also to eliminate
285 inclusion if the include file is protected by #ifndef ... #endif */
286typedef struct CachedInclude {
288 int hash_next; /* -1 if none */
289 char type; /* '"' or '>' to give include type */
290 char filename[1]; /* path specified in #include */
293#define CACHED_INCLUDES_HASH_SIZE 512
295/* additional information about token */
296#define TOK_FLAG_BOW 0x0001 /* beginning of word before */
297#define TOK_FLAG_BOL 0x0002 /* beginning of line before */
298#define TOK_FLAG_BOF 0x0004 /* beginning of file before */
299#define TOK_FLAG_ENDIF 0x0008 /* a endif was found matching starting #ifdef */
301#define PARSE_FLAG_PREPROCESS 0x0001 /* activate preprocessing */
302#define PARSE_FLAG_TOK_NUM 0x0002 /* return numbers instead of TOK_PPNUM */
303#define PARSE_FLAG_LINEFEED 0x0004 /* line feed is returned as a
304 token. line feed is also
306#define PARSE_FLAG_ASM_COMMENTS 0x0008 /* '#' can be used for line comment */
308#define SYM_POOL_NB (8192 / sizeof(Sym))
318 BufferedFile **include_stack_ptr;
319 int *ifdef_stack_ptr;
321 /* include file handling */
322 struct dynarray include_paths;
323 struct dynarray sysinclude_paths;
325 //struct dynarray cached_includes;
326 CachedInclude **cached_includes;
327 int nb_cached_includes;
329 struct dynarray library_paths;
331 /* array of all loaded dlls (including those referenced by loaded
333 //struct dynarray loaded_dlls;
334 DLLReference **loaded_dlls;
338 //struct dynarray sections;
340 int nb_sections; /* number of sections, including first dummy section */
345 //struct dynarray got_offsets;
346 unsigned long *got_offsets;
348 /* give the correspondance from symtab indexes to dynsym indexes */
349 int *symtab_to_dynsym;
351 /* temporary dynamic symbol sections (for dll loading) */
352 Section *dynsymtab_section;
353 /* exported dynamic symbol section */
356 int nostdinc; /* if true, no standard headers are added */
357 int nostdlib; /* if true, no standard libraries are added */
359 int nocommon; /* if true, do not use common symbols for .bss data */
361 /* if true, static linking is performed */
364 /* if true, all symbols are exported */
367 /* if true, describe each room as you enter it, unless it contains a grue */
370 /* if true, only link in referenced objects from archive */
373 /* address of text section */
374 unsigned long text_addr;
377 /* output format, see TCC_OUTPUT_FORMAT_xxx */
380 /* C language options */
381 int char_is_unsigned;
382 int leading_underscore;
384 /* warning switches */
385 int warn_write_strings;
386 int warn_unsupported;
389 int warn_implicit_function_declaration;
393 void (*error_func)(void *opaque, const char *msg);
394 int error_set_jmp_enabled;
395 jmp_buf error_jmp_buf;
398 /* tiny assembler state */
401 /* see include_stack_ptr */
402 BufferedFile *include_stack[INCLUDE_STACK_SIZE];
404 /* see ifdef_stack_ptr */
405 int ifdef_stack[IFDEF_STACK_SIZE];
407 /* see cached_includes */
408 int cached_includes_hash[CACHED_INCLUDES_HASH_SIZE];
411 int pack_stack[PACK_STACK_SIZE];
414 /* output file for preprocessing */
418/* The current value can be: */
419#define VT_VALMASK 0x00ff
420#define VT_CONST 0x00f0 /* constant in vc
421 (must be first non register value) */
422#define VT_LLOCAL 0x00f1 /* lvalue, offset on stack */
423#define VT_LOCAL 0x00f2 /* offset on stack */
424#define VT_CMP 0x00f3 /* the value is stored in processor flags (in vc) */
425#define VT_JMP 0x00f4 /* value is the consequence of jmp true (even) */
426#define VT_JMPI 0x00f5 /* value is the consequence of jmp false (odd) */
427#define VT_LVAL 0x0100 /* var is an lvalue */
428#define VT_SYM 0x0200 /* a symbol value is added */
429#define VT_MUSTCAST 0x0400 /* value must be casted to be correct (used for
430 char/short stored in integer registers) */
431#define VT_MUSTBOUND 0x0800 /* bound checking must be done before
432 dereferencing value */
433#define VT_BOUNDED 0x8000 /* value is bounded. The address of the
434 bounding function call point is in vc */
435#define VT_LVAL_BYTE 0x1000 /* lvalue is a byte */
436#define VT_LVAL_SHORT 0x2000 /* lvalue is a short */
437#define VT_LVAL_UNSIGNED 0x4000 /* lvalue is unsigned */
438#define VT_LVAL_TYPE (VT_LVAL_BYTE | VT_LVAL_SHORT | VT_LVAL_UNSIGNED)
441#define VT_INT 0 /* integer type */
442#define VT_BYTE 1 /* signed byte type */
443#define VT_SHORT 2 /* short type */
444#define VT_VOID 3 /* void type */
445#define VT_PTR 4 /* pointer */
446#define VT_ENUM 5 /* enum definition */
447#define VT_FUNC 6 /* function type */
448#define VT_STRUCT 7 /* struct/union definition */
449#define VT_FLOAT 8 /* IEEE float */
450#define VT_DOUBLE 9 /* IEEE double */
451#define VT_LDOUBLE 10 /* IEEE long double */
452#define VT_BOOL 11 /* ISOC99 boolean type */
453#define VT_LLONG 12 /* 64 bit integer */
454#define VT_LONG 13 /* long integer (NEVER USED as type, only
456#define VT_BTYPE 0x000f /* mask for basic type */
457#define VT_UNSIGNED 0x0010 /* unsigned type */
458#define VT_ARRAY 0x0020 /* array type (also has VT_PTR) */
459#define VT_BITFIELD 0x0040 /* bitfield modifier */
460#define VT_CONSTANT 0x0800 /* const modifier */
461#define VT_VOLATILE 0x1000 /* volatile modifier */
462#define VT_SIGNED 0x2000 /* signed type */
465#define VT_EXTERN 0x00000080 /* extern definition */
466#define VT_STATIC 0x00000100 /* static variable */
467#define VT_TYPEDEF 0x00000200 /* typedef definition */
468#define VT_INLINE 0x00000400 /* inline definition */
470#define VT_STRUCT_SHIFT 16 /* shift for bitfield shift values */
472/* type mask (except storage) */
473#define VT_STORAGE (VT_EXTERN | VT_STATIC | VT_TYPEDEF | VT_INLINE)
474#define VT_TYPE (~(VT_STORAGE))
478/* warning: the following compare tokens depend on i386 asm code */
486#define TOK_Nclear 0x99
496#define TOK_MID 0xa3 /* inc/dec, to void constant */
498#define TOK_UDIV 0xb0 /* unsigned division */
499#define TOK_UMOD 0xb1 /* unsigned modulo */
500#define TOK_PDIV 0xb2 /* fast division with undefined rounding for pointers */
501#define TOK_CINT 0xb3 /* number in tokc */
502#define TOK_CCHAR 0xb4 /* char constant in tokc */
503#define TOK_STR 0xb5 /* pointer to string in tokc */
504#define TOK_TWOSHARPS 0xb6 /* ## preprocessing token */
505#define TOK_LCHAR 0xb7
507#define TOK_CFLOAT 0xb9 /* float constant */
508#define TOK_LINENUM 0xba /* line number info */
509#define TOK_CDOUBLE 0xc0 /* double constant */
510#define TOK_CLDOUBLE 0xc1 /* long double constant */
511#define TOK_UMULL 0xc2 /* unsigned 32x32 -> 64 mul */
512#define TOK_ADDC1 0xc3 /* add with carry generation */
513#define TOK_ADDC2 0xc4 /* add with carry use */
514#define TOK_SUBC1 0xc5 /* add with carry generation */
515#define TOK_SUBC2 0xc6 /* add with carry use */
516#define TOK_CUINT 0xc8 /* unsigned int constant */
517#define TOK_CLLONG 0xc9 /* long long constant */
518#define TOK_CULLONG 0xca /* unsigned long long constant */
519#define TOK_ARROW 0xcb
520#define TOK_DOTS 0xcc /* three dots */
521#define TOK_SHR 0xcd /* unsigned shift right */
522#define TOK_PPNUM 0xce /* preprocessor number */
524#define TOK_SHL 0x01 /* shift left */
525#define TOK_SAR 0x02 /* signed shift right */
527/* assignement operators : normal operator or 0x80 */
528#define TOK_A_MOD 0xa5
529#define TOK_A_AND 0xa6
530#define TOK_A_MUL 0xaa
531#define TOK_A_ADD 0xab
532#define TOK_A_SUB 0xad
533#define TOK_A_DIV 0xaf
534#define TOK_A_XOR 0xde
536#define TOK_A_SHL 0x81
537#define TOK_A_SAR 0x82
540#define offsetof(type, field) ((size_t) &((type *)0)->field)
544#define countof(tab) (sizeof(tab) / sizeof((tab)[0]))
547/* WARNING: the content of this string encodes token numbers */
548static unsigned char tok_two_chars[] = "<=\236>=\235!=\225&&\240||\241++\244--\242==\224<<\1>>\2+=\253-=\255*=\252/=\257%=\245&=\246^=\336|=\374->\313..\250##\266";
550#define TOK_EOF (-1) /* end of file */
551#define TOK_LINEFEED 10 /* line feed */
553/* all identificators and strings have token above that */
556/* only used for i386 asm opcodes definitions */
557#define DEF_ASM(x) DEF(TOK_ASM_ ## x, #x)
560 DEF(TOK_ASM_ ## x ## b, #x "b") \
561 DEF(TOK_ASM_ ## x ## w, #x "w") \
562 DEF(TOK_ASM_ ## x ## l, #x "l") \
563 DEF(TOK_ASM_ ## x, #x)
566 DEF(TOK_ASM_ ## x ## w, #x "w") \
567 DEF(TOK_ASM_ ## x ## l, #x "l") \
568 DEF(TOK_ASM_ ## x, #x)
571 DEF(TOK_ASM_ ## f ## x ## s, "f" #x "s") \
572 DEF(TOK_ASM_ ## fi ## x ## l, "fi" #x "l") \
573 DEF(TOK_ASM_ ## f ## x ## l, "f" #x "l") \
574 DEF(TOK_ASM_ ## fi ## x ## s, "fi" #x "s")
577 DEF(TOK_ASM_ ## f ## x, "f" #x ) \
578 DEF(TOK_ASM_ ## f ## x ## p, "f" #x "p") \
581#define DEF_ASMTEST(x) \
613#define TOK_ASM_int TOK_INT
616 TOK_LAST = TOK_IDENT - 1,
617#define DEF(id, str) id,
622static const char tcc_keywords[] =
623#define DEF(id, str) str "\0"
628#define TOK_UIDENT TOK_DEFINE
631int __stdcall GetModuleFileNameA(void *, char *, int);
632void *__stdcall GetProcAddress(void *, const char *);
633void *__stdcall GetModuleHandleA(const char *);
634void *__stdcall LoadLibraryA(const char *);
635int __stdcall FreeConsole(void);
636int __stdcall VirtualProtect(void*,int,int,int*);
637#define PAGE_EXECUTE_READWRITE 0x40
639#define snprintf _snprintf
640#define vsnprintf _vsnprintf
642 #define strtold (long double)strtod
643 #define strtof (float)strtod
644 #define strtoll (long long)strtol
646#elif (defined(TCC_UCLIBC) || \
647 defined(__FreeBSD__) || \
648 defined(__DragonFly__) || \
649 defined(__OpenBSD__))
650/* currently incorrect */
651static inline long double strtold(const char *nptr, char **endptr)
653 return (long double)strtod(nptr, endptr);
655static inline float strtof(const char *nptr, char **endptr)
657 return (float)strtod(nptr, endptr);
660/* XXX: need to define this to use them in non ISOC99 context */
661extern float strtof (const char *__nptr, char **__endptr);
662extern long double strtold (const char *__nptr, char **__endptr);
665static char *pstrcpy(char *buf, int buf_size, const char *s);
666static char *pstrcat(char *buf, int buf_size, const char *s);
667static const char *tcc_basename(const char *name);
669static void next(void);
670static void next_nomacro(void);
671static void parse_expr_type(CType *type);
672static void expr_type(CType *type);
673static void unary_type(CType *type);
674static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
675 int case_reg, int is_expr);
676static int expr_const(void);
677static void expr_eq(void);
678static void gexpr(void);
679static void gen_inline_functions(void);
680static void decl(int l);
681static void decl_initializer(CType *type, Section *sec, unsigned long c,
682 int first, int size_only);
683static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
684 int has_init, int v, int scope);
686void gv2(int rc1, int rc2);
687void move_reg(int r, int s);
688void save_regs(int n);
694int get_reg_ex(int rc,int rc2);
697 struct macro_level *prev;
701static void macro_subst(TokenString *tok_str, Sym **nested_list,
702 const int *macro_str, struct macro_level **can_read_stream);
704void force_charshort_cast(int t);
705static void gen_cast(CType *type);
707static Sym *sym_find(int v);
708static Sym *sym_push(int v, CType *type, int r, int c);
711static int type_size(CType *type, int *a);
712static inline CType *pointed_type(CType *type);
713static int pointed_size(CType *type);
714static int lvalue_type(int t);
715static int parse_btype(CType *type, AttributeDef *ad);
716static void type_decl(CType *type, AttributeDef *ad, int *v, int td);
717static int is_compatible_types(CType *type1, CType *type2);
718static void expr_const1(void);
720int ieee_finite(double d);
721void error(const char *fmt, ...);
725void lexpand_nr(void);
726static void vpush_global_sym(CType *type, int v);
727void vset(CType *type, int r, int v);
728void type_to_str(char *buf, int buf_size,
729 CType *type, const char *varstr);
730char *get_tok_str(int v, CValue *cv);
731static Sym *get_sym_ref(CType *type, Section *sec,
732 unsigned long offset, unsigned long size);
733static Sym *external_global_sym(int v, CType *type, int r);
735/* section generation */
736static void section_realloc(Section *sec, unsigned long new_size);
737static void *section_ptr_add(Section *sec, unsigned long size);
738static void put_extern_sym(Sym *sym, Section *section,
739 unsigned long value, unsigned long size);
740static void greloc(Section *s, Sym *sym, unsigned long addr, int type);
741static int put_elf_str(Section *s, const char *sym);
742static int put_elf_sym(Section *s,
743 unsigned long value, unsigned long size,
744 int info, int other, int shndx, const char *name);
745static int add_elf_sym(Section *s, unsigned long value, unsigned long size,
746 int info, int other, int sh_num, const char *name);
747static void put_elf_reloc(Section *symtab, Section *s, unsigned long offset,
748 int type, int symbol);
749static void put_stabs(const char *str, int type, int other, int desc,
750 unsigned long value);
751static void put_stabs_r(const char *str, int type, int other, int desc,
752 unsigned long value, Section *sec, int sym_index);
753static void put_stabn(int type, int other, int desc, int value);
754static void put_stabd(int type, int other, int desc);
755static int tcc_add_dll(TCCState *s, const char *filename, int flags);
757#define AFF_PRINT_ERROR 0x0001 /* print error if file not found */
758#define AFF_REFERENCED_DLL 0x0002 /* load a referenced dll from another dll */
759#define AFF_PREPROCESS 0x0004 /* preprocess file */
760static int tcc_add_file_internal(TCCState *s, const char *filename, int flags);
763int tcc_output_coff(TCCState *s1, FILE *f);
766static void *resolve_sym(TCCState *s1, const char *sym, int type);
767int pe_load_def_file(struct TCCState *s1, FILE *fp);
768void pe_setup_paths(struct TCCState *s1, int *p_output_type, const char **p_outfile, char *first_file);
769unsigned long pe_add_runtime(struct TCCState *s1);
770int tcc_output_pe(struct TCCState *s1, const char *filename);
776typedef struct ExprValue {
781#define MAX_ASM_OPERANDS 30
783typedef struct ASMOperand {
784 int id; /* GCC 3 optionnal identifier (0 if number only supported */
786 char asm_str[16]; /* computed asm string for operand */
787 SValue *vt; /* C value of the expression */
788 int ref_index; /* if >= 0, gives reference to a output constraint */
789 int input_index; /* if >= 0, gives reference to an input constraint */
790 int priority; /* priority, used to assign registers */
791 int reg; /* if >= 0, register number used for this operand */
792 int is_llong; /* true if double register value */
793 int is_memory; /* true if memory operand */
794 int is_rw; /* for '+' modifier */
797static void asm_expr(TCCState *s1, ExprValue *pe);
798static int asm_int_expr(TCCState *s1);
799static int find_constraint(ASMOperand *operands, int nb_operands,
800 const char *name, const char **pp);
802static int tcc_assemble(TCCState *s1, int do_preprocess);
806static void asm_instr(void);
807static void asm_global_instr(void);
809/* true if float/double/long double type */
810static inline int is_float(int t)
814 return bt == VT_LDOUBLE || bt == VT_DOUBLE || bt == VT_FLOAT;
817/* true if long long type */
818static inline int is_llong(int t)
822 return bt == VT_LLONG;
825#ifdef CONFIG_TCC_STATIC
827#define RTLD_LAZY 0x001
828#define RTLD_NOW 0x002
829#define RTLD_GLOBAL 0x100
830#define RTLD_DEFAULT NULL
832typedef struct TCCSyms {
837#define TCCSYM(a) { #a, &a, },
839/* add the symbol you want here if no dynamic linking is done */
840static TCCSyms tcc_syms[] = {
841#if !defined(CONFIG_TCCBOOT)
850static void *resolve_sym(TCCState *s1, const char *symbol, int type)
854 while (p->str != NULL) {
855 if (!strcmp(p->str, symbol))
862/* dummy function for profiling */
863void *dlopen(const char *filename, int flag)
868const char *dlerror(void)
877static inline void *resolve_sym(TCCState *s1, const char *sym, int type)
879 return dlsym(RTLD_DEFAULT, sym);