libtcc: minor adjustments

- use {B} to substitute tcc_lih_path (instead of \b)

- expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS
  which fixes duplicate CONFIG_SYSROOT.

- put default CONFIG_SYSROOT ("") into tcc.h

- remove hack from commit db6fcce78f
  because $(tccdir)/include is already in sysincludes

- configure: error out for unrecognized options.

- win32/build-tcc.bat: put libtcc into base dir where it will
  find lib/include automatically, and build libtcc_test example.
master
grischka 2011-08-11 16:55:30 +02:00
parent fd0cea8895
commit 74a24d77fd
10 changed files with 96 additions and 97 deletions

View File

@ -164,10 +164,10 @@ $(I386_CROSS): DEFINES = -DTCC_TARGET_I386 \
$(X64_CROSS): DEFINES = -DTCC_TARGET_X86_64 $(X64_CROSS): DEFINES = -DTCC_TARGET_X86_64
$(WIN32_CROSS): DEFINES = -DTCC_TARGET_I386 -DTCC_TARGET_PE \ $(WIN32_CROSS): DEFINES = -DTCC_TARGET_I386 -DTCC_TARGET_PE \
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \ -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
-DCONFIG_TCC_LIBPATHS="\"\b/lib/32;\b/lib\"" -DCONFIG_TCC_LIBPATHS="\"{B}/lib/32;{B}/lib\""
$(WIN64_CROSS): DEFINES = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE \ $(WIN64_CROSS): DEFINES = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE \
-DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \ -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" \
-DCONFIG_TCC_LIBPATHS="\"\b/lib/64;\b/lib\"" -DCONFIG_TCC_LIBPATHS="\"{B}/lib/64;{B}/lib\""
$(WINCE_CROSS): DEFINES = -DTCC_TARGET_PE $(WINCE_CROSS): DEFINES = -DTCC_TARGET_PE
$(C67_CROSS): DEFINES = -DTCC_TARGET_C67 $(C67_CROSS): DEFINES = -DTCC_TARGET_C67
$(ARM_FPA_CROSS): DEFINES = -DTCC_TARGET_ARM $(ARM_FPA_CROSS): DEFINES = -DTCC_TARGET_ARM

4
configure vendored
View File

@ -168,6 +168,8 @@ for opt do
;; ;;
--help|-h) show_help="yes" --help|-h) show_help="yes"
;; ;;
*) echo "configure: unrecognized option $opt"; exit 1
;;
esac esac
done done
@ -380,7 +382,7 @@ print_var2()
{ {
if test -n "$2"; then print_var1 $1 "$2"; fi if test -n "$2"; then print_var1 $1 "$2"; fi
} }
print_var1 CONFIG_SYSROOT "$sysroot" print_var2 CONFIG_SYSROOT "$sysroot"
print_var1 CONFIG_TCCDIR "$tccdir" print_var1 CONFIG_TCCDIR "$tccdir"
print_var2 CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" print_var2 CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths"
print_var2 CONFIG_TCC_LIBPATHS "$tcc_libpaths" print_var2 CONFIG_TCC_LIBPATHS "$tcc_libpaths"

View File

@ -32,12 +32,6 @@ ST_DATA int tcc_ext = 1;
/* XXX: get rid of this ASAP */ /* XXX: get rid of this ASAP */
ST_DATA struct TCCState *tcc_state; ST_DATA struct TCCState *tcc_state;
#ifdef CONFIG_TCC_BACKTRACE
ST_DATA int num_callers = 6;
ST_DATA const char **rt_bound_error_msg;
ST_DATA void *rt_prog_main;
#endif
/********************************************************/ /********************************************************/
#ifdef ONE_SOURCE #ifdef ONE_SOURCE
@ -115,7 +109,7 @@ static void tcc_add_systemdir(TCCState *s)
{ {
char buf[1000]; char buf[1000];
GetSystemDirectory(buf, sizeof buf); GetSystemDirectory(buf, sizeof buf);
tcc_add_library_path(s, buf); tcc_add_library_path(s, normalize_slashes(buf));
} }
#ifndef CONFIG_TCC_STATIC #ifndef CONFIG_TCC_STATIC
@ -315,8 +309,10 @@ static void tcc_split_path(TCCState *s, void ***p_ary, int *p_nb_ary, const char
cstr_new(&str); cstr_new(&str);
for (p = in; c = *p, c != '\0' && c != PATHSEP; ++p) { for (p = in; c = *p, c != '\0' && c != PATHSEP; ++p) {
if (c == '\b') { if (c == '{' && p[1] && p[2] == '}') {
cstr_cat(&str, s->tcc_lib_path); c = p[1], p += 2;
if (c == 'B')
cstr_cat(&str, s->tcc_lib_path);
} else { } else {
cstr_ccat(&str, c); cstr_ccat(&str, c);
} }
@ -640,11 +636,6 @@ PUB_FUNC void error(const char *fmt, ...)
} }
} }
PUB_FUNC void expect(const char *msg)
{
error("%s expected", msg);
}
PUB_FUNC void warning(const char *fmt, ...) PUB_FUNC void warning(const char *fmt, ...)
{ {
TCCState *s1 = tcc_state; TCCState *s1 = tcc_state;
@ -1242,6 +1233,7 @@ static int tcc_add_library_internal(TCCState *s, const char *fmt,
return -1; return -1;
} }
#ifndef TCC_TARGET_PE
/* find and load a dll. Return non zero if not found */ /* find and load a dll. Return non zero if not found */
/* XXX: add '-rpath' option support ? */ /* XXX: add '-rpath' option support ? */
ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags) ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags)
@ -1249,6 +1241,7 @@ ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags)
return tcc_add_library_internal(s, "%s/%s", filename, flags, return tcc_add_library_internal(s, "%s/%s", filename, flags,
s->library_paths, s->nb_library_paths); s->library_paths, s->nb_library_paths);
} }
#endif
ST_FUNC int tcc_add_crt(TCCState *s, const char *filename) ST_FUNC int tcc_add_crt(TCCState *s, const char *filename)
{ {
@ -1604,14 +1597,6 @@ LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path)
s->tcc_lib_path = tcc_strdup(path); s->tcc_lib_path = tcc_strdup(path);
} }
PUB_FUNC void set_num_callers(int n)
{
#ifdef CONFIG_TCC_BACKTRACE
num_callers = n;
#endif
}
PUB_FUNC char *tcc_default_target(TCCState *s, const char *default_file) PUB_FUNC char *tcc_default_target(TCCState *s, const char *default_file)
{ {
char buf[1024]; char buf[1024];

View File

@ -1,10 +1,8 @@
#ifndef LIBTCC_H #ifndef LIBTCC_H
#define LIBTCC_H #define LIBTCC_H
#ifdef LIBTCC_AS_DLL #ifndef LIBTCCAPI
#define LIBTCCAPI __declspec(dllexport) # define LIBTCCAPI
#else
#define LIBTCCAPI
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

59
tcc.c
View File

@ -263,6 +263,16 @@ static void exec_other_tcc(TCCState *s, char **argv, const char *optarg)
} }
#endif #endif
static void parse_option_D(TCCState *s1, const char *optarg)
{
char *sym = tcc_strdup(optarg);
char *value = strchr(sym, '=');
if (value)
*value++ = '\0';
tcc_define_symbol(s1, sym, value);
tcc_free(sym);
}
static int parse_args(TCCState *s, int argc, char **argv) static int parse_args(TCCState *s, int argc, char **argv)
{ {
int optind; int optind;
@ -327,16 +337,7 @@ static int parse_args(TCCState *s, int argc, char **argv)
error("too many include paths"); error("too many include paths");
break; break;
case TCC_OPTION_D: case TCC_OPTION_D:
{ parse_option_D(s, optarg);
char *sym, *value;
sym = (char *)optarg;
value = strchr(sym, '=');
if (value) {
*value = '\0';
value++;
}
tcc_define_symbol(s, sym, value);
}
break; break;
case TCC_OPTION_U: case TCC_OPTION_U:
tcc_undefine_symbol(s, optarg); tcc_undefine_symbol(s, optarg);
@ -347,12 +348,6 @@ static int parse_args(TCCState *s, int argc, char **argv)
case TCC_OPTION_B: case TCC_OPTION_B:
/* set tcc utilities path (mainly for tcc development) */ /* set tcc utilities path (mainly for tcc development) */
tcc_set_lib_path(s, optarg); tcc_set_lib_path(s, optarg);
/* append /include and add it as -isystem, as gcc does */
r = tcc_strdup(optarg);
r = tcc_realloc(r, strlen(r) + 8 + 1);
strcat(r, "/include");
tcc_add_sysinclude_path(s, r);
tcc_free(r);
break; break;
case TCC_OPTION_l: case TCC_OPTION_l:
dynarray_add((void ***)&files, &nb_files, r); dynarray_add((void ***)&files, &nb_files, r);
@ -360,14 +355,14 @@ static int parse_args(TCCState *s, int argc, char **argv)
break; break;
case TCC_OPTION_pthread: case TCC_OPTION_pthread:
was_pthread = 1; was_pthread = 1;
tcc_define_symbol(s, "_REENTRANT", "1"); parse_option_D(s, "_REENTRANT");
break; break;
case TCC_OPTION_bench: case TCC_OPTION_bench:
do_bench = 1; do_bench = 1;
break; break;
#ifdef CONFIG_TCC_BACKTRACE #ifdef CONFIG_TCC_BACKTRACE
case TCC_OPTION_bt: case TCC_OPTION_bt:
set_num_callers(atoi(optarg)); tcc_set_num_callers(atoi(optarg));
break; break;
#endif #endif
#ifdef CONFIG_TCC_BCHECK #ifdef CONFIG_TCC_BCHECK
@ -417,17 +412,17 @@ static int parse_args(TCCState *s, int argc, char **argv)
print_search_dirs = 1; print_search_dirs = 1;
break; break;
case TCC_OPTION_run: case TCC_OPTION_run:
{ {
int argc1; int argc1;
char **argv1; char **argv1;
argc1 = expand_args(&argv1, optarg); argc1 = expand_args(&argv1, optarg);
if (argc1 > 0) { if (argc1 > 0) {
parse_args(s, argc1, argv1); parse_args(s, argc1, argv1);
}
multiple_files = 0;
output_type = TCC_OUTPUT_MEMORY;
} }
multiple_files = 0;
output_type = TCC_OUTPUT_MEMORY;
break; break;
}
case TCC_OPTION_v: case TCC_OPTION_v:
do ++s->verbose; while (*optarg++ == 'v'); do ++s->verbose; while (*optarg++ == 'v');
break; break;
@ -447,10 +442,8 @@ static int parse_args(TCCState *s, int argc, char **argv)
s->rdynamic = 1; s->rdynamic = 1;
break; break;
case TCC_OPTION_Wl: case TCC_OPTION_Wl:
{ if ((r = (char *) tcc_set_linker(s, (char *)optarg, TRUE)))
if ((r = (char *) tcc_set_linker(s, (char *)optarg, TRUE))) error("unsupported linker option '%s'", r);
error("unsupported linker option '%s'", r);
}
break; break;
case TCC_OPTION_E: case TCC_OPTION_E:
output_type = TCC_OUTPUT_PREPROCESS; output_type = TCC_OUTPUT_PREPROCESS;
@ -473,9 +466,7 @@ static int parse_args(TCCState *s, int argc, char **argv)
} }
} }
/* fixme: these options could be different on your platform */ /* fixme: these options could be different on your platform */
if (was_pthread if (was_pthread && output_type != TCC_OUTPUT_OBJ) {
&& output_type != TCC_OUTPUT_OBJ)
{
dynarray_add((void ***)&files, &nb_files, "-lpthread"); dynarray_add((void ***)&files, &nb_files, "-lpthread");
nb_libraries++; nb_libraries++;
} }

37
tcc.h
View File

@ -50,7 +50,10 @@
#define inline __inline #define inline __inline
#define inp next_inp #define inp next_inp
#ifdef _WIN64 #ifdef _WIN64
#define uplong unsigned long long # define uplong unsigned long long
#endif
#ifdef LIBTCC_AS_DLL
# define LIBTCCAPI __declspec(dllexport)
#endif #endif
#endif #endif
@ -134,6 +137,10 @@
/* ------------ path configuration ------------ */ /* ------------ path configuration ------------ */
#ifndef CONFIG_SYSROOT
# define CONFIG_SYSROOT ""
#endif
#ifndef CONFIG_TCC_LDDIR #ifndef CONFIG_TCC_LDDIR
# if defined(TCC_TARGET_X86_64_CENTOS) # if defined(TCC_TARGET_X86_64_CENTOS)
# define CONFIG_TCC_LDDIR "/lib64" # define CONFIG_TCC_LDDIR "/lib64"
@ -147,25 +154,27 @@
# define CONFIG_TCC_CRTPREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR # define CONFIG_TCC_CRTPREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
#endif #endif
/* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */
/* system include paths */ /* system include paths */
#ifndef CONFIG_TCC_SYSINCLUDEPATHS #ifndef CONFIG_TCC_SYSINCLUDEPATHS
# ifdef TCC_TARGET_PE # ifdef TCC_TARGET_PE
# define CONFIG_TCC_SYSINCLUDEPATHS "\b/include;\b/include/winapi" # define CONFIG_TCC_SYSINCLUDEPATHS "{B}/include;{B}/include/winapi"
# else # else
# define CONFIG_TCC_SYSINCLUDEPATHS \ # define CONFIG_TCC_SYSINCLUDEPATHS \
CONFIG_SYSROOT "/usr/local/include" \ CONFIG_SYSROOT "/usr/local/include" \
":" CONFIG_SYSROOT "/usr/include" \ ":" CONFIG_SYSROOT "/usr/include" \
":" "\b/include" ":" "{B}/include"
# endif # endif
#endif #endif
/* library search paths */ /* library search paths */
#ifndef CONFIG_TCC_LIBPATHS #ifndef CONFIG_TCC_LIBPATHS
# ifdef TCC_TARGET_PE # ifdef TCC_TARGET_PE
# define CONFIG_TCC_LIBPATHS "\b/lib" # define CONFIG_TCC_LIBPATHS "{B}/lib"
# else # else
# define CONFIG_TCC_LIBPATHS \ # define CONFIG_TCC_LIBPATHS \
CONFIG_SYSROOT CONFIG_TCC_CRTPREFIX \ CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR \
":" CONFIG_SYSROOT CONFIG_TCC_LDDIR \ ":" CONFIG_SYSROOT CONFIG_TCC_LDDIR \
":" CONFIG_SYSROOT "/usr/local" CONFIG_TCC_LDDIR ":" CONFIG_SYSROOT "/usr/local" CONFIG_TCC_LDDIR
# endif # endif
@ -924,7 +933,9 @@ static inline int toup(int c)
return (c >= 'a' && c <= 'z') ? c - 'a' + 'A' : c; return (c >= 'a' && c <= 'z') ? c - 'a' + 'A' : c;
} }
#define PUB_FUNC #ifndef PUB_FUNC
# define PUB_FUNC
#endif
#ifdef ONE_SOURCE #ifdef ONE_SOURCE
#define ST_INLN static inline #define ST_INLN static inline
@ -946,7 +957,7 @@ ST_DATA int tcc_ext;
ST_DATA struct TCCState *tcc_state; ST_DATA struct TCCState *tcc_state;
#ifdef CONFIG_TCC_BACKTRACE #ifdef CONFIG_TCC_BACKTRACE
ST_DATA int num_callers; ST_DATA int rt_num_callers;
ST_DATA const char **rt_bound_error_msg; ST_DATA const char **rt_bound_error_msg;
ST_DATA void *rt_prog_main; ST_DATA void *rt_prog_main;
#endif #endif
@ -976,7 +987,6 @@ PUB_FUNC void dynarray_add(void ***ptab, int *nb_ptr, void *data);
PUB_FUNC void dynarray_reset(void *pp, int *n); PUB_FUNC void dynarray_reset(void *pp, int *n);
PUB_FUNC void error_noabort(const char *fmt, ...); PUB_FUNC void error_noabort(const char *fmt, ...);
PUB_FUNC void error(const char *fmt, ...); PUB_FUNC void error(const char *fmt, ...);
PUB_FUNC void expect(const char *msg);
PUB_FUNC void warning(const char *fmt, ...); PUB_FUNC void warning(const char *fmt, ...);
/* other utilities */ /* other utilities */
@ -1012,14 +1022,18 @@ ST_FUNC int tcc_open(TCCState *s1, const char *filename);
ST_FUNC void tcc_close(void); ST_FUNC void tcc_close(void);
ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags); ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags);
ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags);
ST_FUNC int tcc_add_crt(TCCState *s, const char *filename); ST_FUNC int tcc_add_crt(TCCState *s, const char *filename);
#ifndef TCC_TARGET_PE
ST_FUNC int tcc_add_dll(TCCState *s, const char *filename, int flags);
#endif
PUB_FUNC int tcc_set_flag(TCCState *s, const char *flag_name, int value); PUB_FUNC int tcc_set_flag(TCCState *s, const char *flag_name, int value);
PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time); PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time);
PUB_FUNC void set_num_callers(int n);
PUB_FUNC char *tcc_default_target(TCCState *s, const char *default_file); PUB_FUNC char *tcc_default_target(TCCState *s, const char *default_file);
PUB_FUNC void tcc_gen_makedeps(TCCState *s, const char *target, const char *filename); PUB_FUNC void tcc_gen_makedeps(TCCState *s, const char *target, const char *filename);
#ifdef CONFIG_TCC_BACKTRACE
PUB_FUNC void tcc_set_num_callers(int n);
#endif
/* ------------ tccpp.c ------------ */ /* ------------ tccpp.c ------------ */
@ -1074,6 +1088,7 @@ ST_FUNC void preprocess_init(TCCState *s1);
ST_FUNC void preprocess_new(); ST_FUNC void preprocess_new();
ST_FUNC int tcc_preprocess(TCCState *s1); ST_FUNC int tcc_preprocess(TCCState *s1);
ST_FUNC void skip(int c); ST_FUNC void skip(int c);
ST_FUNC void expect(const char *msg);
/* ------------ tccgen.c ------------ */ /* ------------ tccgen.c ------------ */

View File

@ -2856,19 +2856,11 @@ static int filename_to_libname(TCCState *s1, const char filename[], char libname
return 0; return 0;
libprefix = !strncmp(filename, "lib", 3); libprefix = !strncmp(filename, "lib", 3);
if (!s1->static_link) { if (!s1->static_link) {
#ifdef TCC_TARGET_PE
if (!strcmp(ext, ".def")) {
size_t len = ext - filename;
pstrncpy(libname, filename, len);
return 1;
}
#else
if (libprefix && (!strcmp(ext, ".so"))) { if (libprefix && (!strcmp(ext, ".so"))) {
size_t len = ext - filename - 3; size_t len = ext - filename - 3;
pstrncpy(libname, filename + 3, len); pstrncpy(libname, filename + 3, len);
return 1; return 1;
} }
#endif
} else { } else {
if (libprefix && (!strcmp(ext, ".a"))) { if (libprefix && (!strcmp(ext, ".a"))) {
size_t len = ext - filename - 3; size_t len = ext - filename - 3;
@ -2887,11 +2879,7 @@ static int filename_to_libname(TCCState *s1, const char filename[], char libname
static void libname_to_filename(TCCState *s1, const char libname[], char filename[]) static void libname_to_filename(TCCState *s1, const char libname[], char filename[])
{ {
if (!s1->static_link) { if (!s1->static_link) {
#ifdef TCC_TARGET_PE
sprintf(filename, "%s.def", libname);
#else
sprintf(filename, "lib%s.so", libname); sprintf(filename, "lib%s.so", libname);
#endif
} else { } else {
sprintf(filename, "lib%s.a", libname); sprintf(filename, "lib%s.a", libname);
} }
@ -3029,4 +3017,4 @@ ST_FUNC int tcc_load_ldscript(TCCState *s1)
} }
return 0; return 0;
} }
#endif #endif /* ndef TCC_TARGET_PE */

View File

@ -94,6 +94,11 @@ ST_FUNC void skip(int c)
next(); next();
} }
ST_FUNC void expect(const char *msg)
{
error("%s expected", msg);
}
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* CString handling */ /* CString handling */
static void cstr_realloc(CString *cstr, int new_size) static void cstr_realloc(CString *cstr, int new_size)

View File

@ -20,6 +20,12 @@
#include "tcc.h" #include "tcc.h"
#ifdef CONFIG_TCC_BACKTRACE
ST_DATA int rt_num_callers = 6;
ST_DATA const char **rt_bound_error_msg;
ST_DATA void *rt_prog_main;
#endif
#ifdef _WIN32 #ifdef _WIN32
#define ucontext_t CONTEXT #define ucontext_t CONTEXT
#endif #endif
@ -38,7 +44,7 @@ static void win64_add_function_table(TCCState *s1);
/* Do all relocations (needed before using tcc_get_symbol()) /* Do all relocations (needed before using tcc_get_symbol())
Returns -1 on error. */ Returns -1 on error. */
int tcc_relocate(TCCState *s1) LIBTCCAPI int tcc_relocate(TCCState *s1)
{ {
int ret; int ret;
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
@ -73,7 +79,7 @@ int tcc_relocate(TCCState *s1)
} }
/* launch the compiled program with the given arguments */ /* launch the compiled program with the given arguments */
int tcc_run(TCCState *s1, int argc, char **argv) LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
{ {
int (*prog_main)(int, char **); int (*prog_main)(int, char **);
int ret; int ret;
@ -213,6 +219,11 @@ static void set_pages_executable(void *ptr, unsigned long length)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
#ifdef CONFIG_TCC_BACKTRACE #ifdef CONFIG_TCC_BACKTRACE
PUB_FUNC void tcc_set_num_callers(int n)
{
rt_num_callers = n;
}
/* print the position in the source file of PC value 'pc' by reading /* print the position in the source file of PC value 'pc' by reading
the stabs debug information */ the stabs debug information */
static uplong rt_printline(uplong wanted_pc, const char *msg) static uplong rt_printline(uplong wanted_pc, const char *msg)
@ -369,7 +380,7 @@ static void rt_error(ucontext_t *uc, const char *fmt, ...)
va_end(ap); va_end(ap);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
for(i=0;i<num_callers;i++) { for(i=0;i<rt_num_callers;i++) {
if (rt_get_caller_pc(&pc, uc, i) < 0) if (rt_get_caller_pc(&pc, uc, i) < 0)
break; break;
pc = rt_printline(pc, i ? "by" : "at"); pc = rt_printline(pc, i ? "by" : "at");
@ -650,12 +661,12 @@ static int rt_get_caller_pc(uplong *paddr, CONTEXT *uc, int level)
#define RTLD_DEFAULT NULL #define RTLD_DEFAULT NULL
/* dummy function for profiling */ /* dummy function for profiling */
void *dlopen(const char *filename, int flag) ST_FUNC void *dlopen(const char *filename, int flag)
{ {
return NULL; return NULL;
} }
void dlclose(void *p) ST_FUNC void dlclose(void *p)
{ {
} }
/* /*
@ -682,7 +693,7 @@ static TCCSyms tcc_syms[] = {
{ NULL, NULL }, { NULL, NULL },
}; };
void *resolve_sym(TCCState *s1, const char *symbol) ST_FUNC void *resolve_sym(TCCState *s1, const char *symbol)
{ {
TCCSyms *p; TCCSyms *p;
p = tcc_syms; p = tcc_syms;
@ -696,7 +707,7 @@ void *resolve_sym(TCCState *s1, const char *symbol)
#elif !defined(_WIN32) #elif !defined(_WIN32)
void *resolve_sym(TCCState *s1, const char *sym) ST_FUNC void *resolve_sym(TCCState *s1, const char *sym)
{ {
return dlsym(RTLD_DEFAULT, sym); return dlsym(RTLD_DEFAULT, sym);
} }

View File

@ -3,8 +3,6 @@
@rem ---------------------------------------------------- @rem ----------------------------------------------------
echo>..\config.h #define TCC_VERSION "0.9.25" echo>..\config.h #define TCC_VERSION "0.9.25"
echo>>..\config.h #define CONFIG_TCCDIR "."
echo>>..\config.h #define CONFIG_SYSROOT ""
@if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64 @if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
@if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64 @if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64
@ -31,7 +29,9 @@ if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h copy ..\libtcc.h libtcc\libtcc.h
%CC% %target% -DONE_SOURCE ../libtcc.c -c -o libtcc.o %CC% %target% -DONE_SOURCE ../libtcc.c -c -o libtcc.o
%AR% rcs libtcc/libtcc.a libtcc.o %AR% rcs libtcc/libtcc.a libtcc.o
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc/libtcc.dll :libtcc.dll
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll
tiny_impdef libtcc.dll -o lib/libtcc.def
:tcc :tcc
%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc %CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
@ -61,3 +61,7 @@ tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o d
:the_end :the_end
del *.o del *.o
:libtcc_test
.\tcc -v -I libtcc -ltcc ../tests/libtcc_test.c
.\libtcc_test