Check-in [c32ff7df22]
Overview
SHA1:c32ff7df22cee2664aa2e57c0965d8d77bbb0fc8
Date: 2014-06-23 19:32:07
User: rkeene
Comment:Updated to work harder to load shared objects (that are not ELF)
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-06-23
19:35
[3b13ded611] Fixed patch for searching based on current platform shared object name (user: rkeene, tags: trunk)
19:32
[c32ff7df22] Updated to work harder to load shared objects (that are not ELF) (user: rkeene, tags: trunk)
02:56
[2bc3ec252a] Added "cwrap" subcommand to handle wrapping and creating prototype (user: rkeene, tags: trunk)
Changes

Modified Makefile.in from [e6a3711f94] to [86ec43e9b7].

    19     19   PACKAGE_NAME = @PACKAGE_NAME@
    20     20   PACKAGE_VERSION = @PACKAGE_VERSION@
    21     21   
    22     22   TCLCONFIGPATH = @TCLCONFIGPATH@
    23     23   TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
    24     24   tcllibdir = $(shell if echo "$(libdir)" | grep '^UNSPECIFIED' >/dev/null; then echo $(TCL_PACKAGE_PATH); else echo "$(libdir)"; fi)
    25     25   PACKAGE_INSTALL_DIR = $(tcllibdir)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
    26         -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@
           26  +TCC_CONFIGURE_OPTS = --cc='$(CC)' --extra-cflags='$(CPPFLAGS) $(CFLAGS) -DSHOBJEXT=@SHOBJEXT@ @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@
    27     27   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
    28     28   srcdir = @srcdir@
    29     29   host_os = @host_os@
    30     30   @SET_MAKE@
    31     31   
    32     32   all: $(TARGET) tcc/libtcc1.a
    33     33   

Added build/tcc-patches/0.9.26/tcc-0.9.26-sharedlibfix.diff version [82e03e9dec].

            1  +diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1sharedlibfix/libtcc.c
            2  +--- tcc-0.9.26.orig/libtcc.c	2013-02-15 08:24:00.000000000 -0600
            3  ++++ tcc-0.9.26-1sharedlibfix/libtcc.c	2014-06-23 14:18:02.279507000 -0500
            4  +@@ -1189,6 +1189,18 @@
            5  + #endif
            6  +         tcc_error_noabort("unrecognized ELF file");
            7  +         goto the_end;
            8  ++    } else {
            9  ++#ifdef TCC_IS_NATIVE
           10  ++        if (s1->output_type == TCC_OUTPUT_MEMORY) {
           11  ++            /* If it's not an ELF file, but dlopen() can open it, do that. */
           12  ++            void *h;
           13  ++            h = dlopen(filename, RTLD_GLOBAL | RTLD_LAZY);
           14  ++            if (h) {
           15  ++                ret = 0;
           16  ++                goto the_end;
           17  ++            }
           18  ++        }
           19  ++#endif
           20  +     }
           21  + 
           22  +     if (memcmp((char *)&ehdr, ARMAG, 8) == 0) {
           23  +@@ -1269,7 +1281,15 @@
           24  +     const char *libs[] = { "%s/%s.def", "%s/lib%s.def", "%s/%s.dll", "%s/lib%s.dll", "%s/lib%s.a", NULL };
           25  +     const char **pp = s->static_link ? libs + 4 : libs;
           26  + #else
           27  ++#  ifdef SHOBJEXT
           28  ++#    define str1(s) str2(s)
           29  ++#    define str2(s) #s
           30  ++    const char *libs[] = { "%s/lib%s" str1(SHOBJEXT), "%s/lib%s.a", NULL };
           31  ++#    undef str1
           32  ++#    undef str2
           33  ++#  else
           34  +     const char *libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL };
           35  ++#  endif
           36  +     const char **pp = s->static_link ? libs + 1 : libs;
           37  + #endif
           38  +     while (*pp) {