Overview
Comment: | Updated to not build TCC as a static so that existing symbols could resolved by TCC itself |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fd6711ab7374b8fff538aa6ef3ad4869 |
User & Date: | rkeene on 2014-06-16 04:48:58 |
Other Links: | manifest | tags |
Context
2014-06-17
| ||
05:26 | tcc4tcl 0.19 check-in: 3c95a2ab7e user: rkeene tags: trunk, 0.19 | |
2014-06-16
| ||
04:48 | Updated to not build TCC as a static so that existing symbols could resolved by TCC itself check-in: fd6711ab73 user: rkeene tags: trunk | |
04:20 | Updated to allow external symbols to be resolved if dlopen() is available check-in: 82e8ebb242 user: rkeene tags: trunk | |
Changes
Modified Makefile.in from [a0fe9448ac] to [0a8186dc49].
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
TCLCONFIGPATH = @TCLCONFIGPATH@
TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
tcllibdir = $(shell if echo "$(libdir)" | grep '^UNSPECIFIED' >/dev/null; then echo $(TCL_PACKAGE_PATH); else echo "$(libdir)"; fi)
PACKAGE_INSTALL_DIR = $(tcllibdir)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
TCC_CONFIGURE_OPTS = --cc='$(CC)' --extra-cflags='$(CPPFLAGS) $(CFLAGS) -DCONFIG_TCC_STATIC=1' --with-tcl=$(TCLCONFIGPATH) --sysincludepaths='{B}/include@HOST_PATH_SEPARATOR@{B}/include/1@HOST_PATH_SEPARATOR@{B}/include/2@HOST_PATH_SEPARATOR@{B}/include/3@HOST_PATH_SEPARATOR@{B}/include/4@HOST_PATH_SEPARATOR@{B}/include/5@HOST_PATH_SEPARATOR@{B}/include/6@HOST_PATH_SEPARATOR@{B}/include/7@HOST_PATH_SEPARATOR@{B}/include/8@HOST_PATH_SEPARATOR@{B}/include/9' --libpaths='{B}/lib' @TCC_CONFIGURE_OPTS@
INSTALL_HEADERS = tcl.h assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h wctype.h
srcdir = @srcdir@
host_os = @host_os@
@SET_MAKE@
all: $(TARGET)
|
| |
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
TCLCONFIGPATH = @TCLCONFIGPATH@
TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
tcllibdir = $(shell if echo "$(libdir)" | grep '^UNSPECIFIED' >/dev/null; then echo $(TCL_PACKAGE_PATH); else echo "$(libdir)"; fi)
PACKAGE_INSTALL_DIR = $(tcllibdir)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
TCC_CONFIGURE_OPTS = --cc='$(CC)' --extra-cflags='$(CPPFLAGS) $(CFLAGS) @TCC_EXTRA_CFLAGS@' --with-tcl=$(TCLCONFIGPATH) --sysincludepaths='{B}/include@HOST_PATH_SEPARATOR@{B}/include/1@HOST_PATH_SEPARATOR@{B}/include/2@HOST_PATH_SEPARATOR@{B}/include/3@HOST_PATH_SEPARATOR@{B}/include/4@HOST_PATH_SEPARATOR@{B}/include/5@HOST_PATH_SEPARATOR@{B}/include/6@HOST_PATH_SEPARATOR@{B}/include/7@HOST_PATH_SEPARATOR@{B}/include/8@HOST_PATH_SEPARATOR@{B}/include/9' --libpaths='{B}/lib' @TCC_CONFIGURE_OPTS@
INSTALL_HEADERS = tcl.h assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h wctype.h
srcdir = @srcdir@
host_os = @host_os@
@SET_MAKE@
all: $(TARGET)
|
Deleted aclocal/dlsym.m4 version [9b676022d2].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
AC_DEFUN([TCC4TCL_FIND_DLOPEN], [ AC_CHECK_HEADERS_ONCE([dlfcn.h]) AC_SEARCH_LIBS([dlsym], [dl dld], [ AC_DEFINE([HAVE_DLSYM], [1], [Have the dlsym function]) ], [ AC_CHECK_HEADERS([windows.h]) AC_MSG_CHECKING([for working EnumProcessModules]) SAVE_LIBS="$LIBS" LIBS="$LIBS -lpsapi" AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #ifdef HAVE_WINDOWS_H # include <windows.h> #endif #include <psapi.h> ], [ HANDLE cur_proc; DWORD needed; needed = 0; cur_proc = GetCurrentProcess(); EnumProcessModules(cur_proc, NULL, 0, &needed); ] )], [ AC_DEFINE([HAVE_ENUMPROCESSMODULES], [1], [Have the EnumProcessModules function]) AC_DEFINE([HAVE_PSAPI_H], [1], [Have the psapi.h header file]) AC_MSG_RESULT([found]) ], [ LIBS="$SAVE_LIBS" AC_MSG_RESULT([not found]) ]) ]) ]) |
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified build/build-platform from [af2d67d68b] to [50ab5da7e8].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 .. 28 29 30 31 32 33 34 35 36 37 38 39 40 41 .. 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
#! /bin/bash platform="$1" shift if [ -z "${platform}" ]; then echo "Platforms:" fi for dir in work/libtclkit-*/ __fail__; do if [ "${dir}" == '__fail__' ]; then if [ -z "${platform}" ]; then exit 0 fi echo "No such platform: ${platform}" >&2 ................................................................................ break fi fi done dir="$(pwd)/${dir}" case "${platform}" in linux-i386) platform="x86_64-redhat5-linux 32" ;; linux-mipsel) platform="mipsel-unknown-linux-uclibc" ;; solaris-amd64) ................................................................................ ;; esac TCLKIT_SDK_DIR="${dir}" export TCLKIT_SDK_DIR make distclean eval `~/root/cross-compilers/setup-cc $platform` platform="$(echo "${platform}" | cut -f1 -d ' ')" ./configure --host="${platform}" --libdir="$(pwd)/INST" --with-tcl="${dir}/lib" "$@" make make install |
> > > > > > > > > > | | > > > > > | > > | > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 .. 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 .. 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
#! /bin/bash platform="$1" shift if [ -z "${platform}" ]; then echo "Platforms:" echo " native" fi for dir in work/libtclkit-*/ __fail__; do if [ "${platform}" = 'native' ]; then break fi if [ "${dir}" == '__fail__' ]; then if [ -z "${platform}" ]; then exit 0 fi echo "No such platform: ${platform}" >&2 ................................................................................ break fi fi done dir="$(pwd)/${dir}" case "${platform}" in native) platform='' ;; linux-i386) platform="x86_64-redhat5-linux 32" ;; linux-mipsel) platform="mipsel-unknown-linux-uclibc" ;; solaris-amd64) ................................................................................ ;; esac TCLKIT_SDK_DIR="${dir}" export TCLKIT_SDK_DIR make distclean if [ "${platform}" != '' ]; then eval `~/root/cross-compilers/setup-cc $platform` platform="$(echo "${platform}" | cut -f1 -d ' ')" fi rm -rf INST if [ "${platform}" = '' ]; then ./configure --libdir="$(pwd)/INST" "$@" || exit 1 else ./configure --host="${platform}" --libdir="$(pwd)/INST" --with-tcl="${dir}/lib" "$@" || exit 1 fi make || exit 1 make install case "${platform}" in i586-mingw32msvc) make TCLSH="wine ${dir}/lib/tclsh.exe" test ;; x86_64-w64-mingw32) WINEPREFIX="${HOME}/.wine64" export WINEPREFIX make TCLSH="wine64 ${dir}/lib/tclsh.exe" test ;; x86_64-redhat5-linux) make TCLSH="${dir}/lib/tclsh" test ;; '') make test ;; esac |
Modified configure.ac from [13d9b5f529] to [b6d99aa0b3].
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
if test "${TCC4TCL_TARGET}" = "shared"; then dnl Determine how to make shared objects DC_GET_SHOBJFLAGS dnl Only export symbols we wish to expose TARGET="tcc4tcl.${SHOBJEXT}" else AC_CHECK_TOOL([RANLIB], [ranlib]) AC_CHECK_TOOL([AR], [ar]) TARGET="tcc4tcl-static.a" fi AC_SUBST(TARGET) AC_SUBST(TCC4TCL_TARGET) no_dlopen='0' AC_ARG_WITH([dlopen], AS_HELP_STRING([--without-dlopen], [do not define dlopen/dlclose/dlerror]), [ if test "$withval" = "no"; then no_dlopen='1' else no_dlopen='0' ................................................................................ ;; *) HOST_PATH_SEPARATOR=':' ;; esac AC_SUBST(HOST_PATH_SEPARATOR) dnl Determine how to lookup symbols at runtime TCC4TCL_FIND_DLOPEN dnl Perform Tcl Extension required stuff TCLEXT_INIT dnl This must be done last since it breaks the compilation if test "${TCC4TCL_TARGET}" = "shared"; then DC_SETVERSIONSCRIPT([${srcdir}/tcc4tcl.vers], [tcc4tcl.syms]) DC_FIND_STRIP_AND_REMOVESYMS([tcc4tcl.syms]) fi dnl Produce output AC_OUTPUT(Makefile pkgIndex.tcl tcc4tcl.syms) |
>
>
>
<
<
<
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
if test "${TCC4TCL_TARGET}" = "shared"; then dnl Determine how to make shared objects DC_GET_SHOBJFLAGS dnl Only export symbols we wish to expose TARGET="tcc4tcl.${SHOBJEXT}" else TCC_EXTRA_CFLAGS="${TCC_EXTRA_CFLAGS} -DCONFIG_TCC_STATIC=1" AC_CHECK_TOOL([RANLIB], [ranlib]) AC_CHECK_TOOL([AR], [ar]) TARGET="tcc4tcl-static.a" fi AC_SUBST(TARGET) AC_SUBST(TCC4TCL_TARGET) AC_SUBST(TCC_EXTRA_CFLAGS) no_dlopen='0' AC_ARG_WITH([dlopen], AS_HELP_STRING([--without-dlopen], [do not define dlopen/dlclose/dlerror]), [ if test "$withval" = "no"; then no_dlopen='1' else no_dlopen='0' ................................................................................ ;; *) HOST_PATH_SEPARATOR=':' ;; esac AC_SUBST(HOST_PATH_SEPARATOR) dnl Perform Tcl Extension required stuff TCLEXT_INIT dnl This must be done last since it breaks the compilation if test "${TCC4TCL_TARGET}" = "shared"; then DC_SETVERSIONSCRIPT([${srcdir}/tcc4tcl.vers], [tcc4tcl.syms]) DC_FIND_STRIP_AND_REMOVESYMS([tcc4tcl.syms]) fi dnl Produce output AC_OUTPUT(Makefile pkgIndex.tcl tcc4tcl.syms) |
Modified tcc4tcl.c from [0dd7284c29] to [24c78e2cb7].
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 .. 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 ... 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
* License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <tcl.h> #include <stdlib.h> #include "tcc.h" #ifdef HAVE_DLFCN_H #include <dlfcn.h> #endif #ifdef HAVE_PSAPI_H # ifdef HAVE_WINDOWS_H # include <windows.h> # endif # include <psapi.h> #endif struct TclTCCState { TCCState *s; int relocated; }; static void Tcc4tclErrorFunc(Tcl_Interp * interp, char * msg) { ................................................................................ struct TclTCCState *ts; TCCState *s; Tcl_Obj *sym_addr; static CONST char *options[] = { "add_include_path", "add_file", "add_library", "add_library_path", "add_symbol", "command", "compile", "define", "get_symbol", "output_file", "undefine", "add_runtime_sym", (char *) NULL }; enum options { TCC4TCL_ADD_INCLUDE, TCC4TCL_ADD_FILE, TCC4TCL_ADD_LIBRARY, TCC4TCL_ADD_LIBRARY_PATH, TCC4TCL_ADD_SYMBOL, TCC4TCL_COMMAND, TCC4TCL_COMPILE, TCC4TCL_DEFINE, TCC4TCL_GET_SYMBOL, TCC4TCL_OUTPUT_FILE, TCC4TCL_UNDEFINE, TCC4TCL_ADD_RUNTIME_SYM }; char *str; ts = (struct TclTCCState *) cdata; s = ts->s; if (objc < 2) { ................................................................................ case TCC4TCL_UNDEFINE: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "symbol"); return TCL_ERROR; } tcc_undefine_symbol(s,Tcl_GetString(objv[2])); return TCL_OK; case TCC4TCL_ADD_RUNTIME_SYM: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "symbol_name"); return(TCL_ERROR); } str = Tcl_GetString(objv[2]); #ifdef HAVE_DLSYM val_p = dlsym(NULL, str); #elif defined(HAVE_ENUMPROCESSMODULES) val_p = NULL; { HANDLE cur_proc; HMODULE *modules; DWORD needed, i; needed = 0; cur_proc = GetCurrentProcess(); EnumProcessModules(cur_proc, NULL, 0, &needed); if (needed > 0) { modules = (void *) ckalloc(needed); if (EnumProcessModules(cur_proc, modules, needed, &needed)) { for (i = 0; i < (needed / sizeof(HMODULE)); i++) { val_p = (void *) GetProcAddress(modules[i], str); if (val_p) { break; } } } ckfree((void *) modules); } } #else val_p = NULL; #endif if (val_p == NULL) { Tcl_AppendResult(interp, "symbol not found", NULL); return(TCL_ERROR); } tcc_add_symbol(s, Tcl_GetString(objv[2]), val_p); return(TCL_OK); default: Tcl_Panic("internal error during option lookup"); } return TCL_OK; } static int Tcc4tclCreateCmd( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){ |
< < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
18 19 20 21 22 23 24 25 26 27 28 29 30 31 .. 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 ... 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
* License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <tcl.h> #include <stdlib.h> #include "tcc.h" struct TclTCCState { TCCState *s; int relocated; }; static void Tcc4tclErrorFunc(Tcl_Interp * interp, char * msg) { ................................................................................ struct TclTCCState *ts; TCCState *s; Tcl_Obj *sym_addr; static CONST char *options[] = { "add_include_path", "add_file", "add_library", "add_library_path", "add_symbol", "command", "compile", "define", "get_symbol", "output_file", "undefine", (char *) NULL }; enum options { TCC4TCL_ADD_INCLUDE, TCC4TCL_ADD_FILE, TCC4TCL_ADD_LIBRARY, TCC4TCL_ADD_LIBRARY_PATH, TCC4TCL_ADD_SYMBOL, TCC4TCL_COMMAND, TCC4TCL_COMPILE, TCC4TCL_DEFINE, TCC4TCL_GET_SYMBOL, TCC4TCL_OUTPUT_FILE, TCC4TCL_UNDEFINE }; char *str; ts = (struct TclTCCState *) cdata; s = ts->s; if (objc < 2) { ................................................................................ case TCC4TCL_UNDEFINE: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "symbol"); return TCL_ERROR; } tcc_undefine_symbol(s,Tcl_GetString(objv[2])); return TCL_OK; default: Tcl_Panic("internal error during option lookup"); } return TCL_OK; } static int Tcc4tclCreateCmd( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){ |
Modified tcc4tcl.tcl from [47dd5cbf47] to [7f2fbfc8a7].
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 ... 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 ... 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
append code $body append code "\nreturn TCL_OK;\n\}" return $code } #--------------------------------------------------------------------- proc ::tcc4tcl::cproc {name adefs rtype {body "#"} {addfuncs ""}} { foreach {code cbody} [wrap $name $adefs $rtype $body] break ::tcc4tcl::ccode $code uplevel 1 [list ::tcc4tcl::ccommand $name {dummy ip objc objv} $cbody $addfuncs] } #--------------------------------------------------------------------- proc ::tcc4tcl::cdata {name data} { # Extract bytes from data binary scan $data c* bytes ................................................................................ uplevel 1 [list tcc4tcl::ccommand $name {dummy ip objc objv} $cbody] return $name } #------------------------------------------------------------------- proc ::tcc4tcl::ccommand {procname anames body {addfuncs ""}} { variable tcc # Fully qualified proc name if {[string match "::*" $procname]} { # procname is already absolute } else { set nsfrom [uplevel 1 {namespace current}] ................................................................................ set tcc(code) "" append code "int $cname (ClientData $v(clientdata),Tcl_Interp *$v(interp)," append code "int $v(objc),Tcl_Obj *CONST $v(objv)\[\]) {" "\n" append code $body "\n" append code "}" "\n" if {[llength $addfuncs] > 0} { set tcc(cc) [tcc4tcl::new] foreach addfunc $addfuncs { $tcc(cc) add_runtime_sym $addfunc } } if {[catch { uplevel 1 [list tcc4tcl::cc $code] } err]} { unset tcc(cc) tcc4tcl::reset return -code error $err |
| | | < < < < < < < < |
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 ... 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 ... 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
append code $body append code "\nreturn TCL_OK;\n\}" return $code } #--------------------------------------------------------------------- proc ::tcc4tcl::cproc {name adefs rtype {body "#"}} { foreach {code cbody} [wrap $name $adefs $rtype $body] break ::tcc4tcl::ccode $code uplevel 1 [list ::tcc4tcl::ccommand $name {dummy ip objc objv} $cbody] } #--------------------------------------------------------------------- proc ::tcc4tcl::cdata {name data} { # Extract bytes from data binary scan $data c* bytes ................................................................................ uplevel 1 [list tcc4tcl::ccommand $name {dummy ip objc objv} $cbody] return $name } #------------------------------------------------------------------- proc ::tcc4tcl::ccommand {procname anames body} { variable tcc # Fully qualified proc name if {[string match "::*" $procname]} { # procname is already absolute } else { set nsfrom [uplevel 1 {namespace current}] ................................................................................ set tcc(code) "" append code "int $cname (ClientData $v(clientdata),Tcl_Interp *$v(interp)," append code "int $v(objc),Tcl_Obj *CONST $v(objv)\[\]) {" "\n" append code $body "\n" append code "}" "\n" if {[catch { uplevel 1 [list tcc4tcl::cc $code] } err]} { unset tcc(cc) tcc4tcl::reset return -code error $err |
Modified test from [e2e01fc434] to [7d8a169a15].
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
rv = mkdir(dir);
if (rv == 0) {
return(TCL_OK);
};
return(TCL_ERROR);
} [list mkdir]
puts [test 1]
puts [test1 1]
puts [test3 1]
puts [::bob::test1 1]
puts [add [test 1] 1]
|
| |
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
rv = mkdir(dir);
if (rv == 0) {
return(TCL_OK);
};
return(TCL_ERROR);
}
puts [test 1]
puts [test1 1]
puts [test3 1]
puts [::bob::test1 1]
puts [add [test 1] 1]
|