Check-in [b25d0baade]
Overview
Comment:Windows fixups
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b25d0baadecd89974ebae7cd26dc3418f9b517d1
User & Date: rkeene on 2014-05-02 06:41:22
Other Links: manifest | tags
Context
2014-05-02
07:08
Experimenting with compiling libtcc1.a with gcc check-in: 8a389f5b8d user: rkeene tags: trunk
06:41
Windows fixups check-in: b25d0baade user: rkeene tags: trunk
06:29
Added more cross-compiling support check-in: ea645d2a50 user: rkeene tags: trunk
Changes

Modified build/tcc-patches/0.9.26/tcc-0.9.26-tclio.diff from [e6c607249f] to [8fe78dd24b].

     1      1   diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1tclio/libtcc.c
     2      2   --- tcc-0.9.26.orig/libtcc.c	2013-02-15 08:24:00.000000000 -0600
     3         -+++ tcc-0.9.26-1tclio/libtcc.c	2014-05-01 21:14:22.272599405 -0500
            3  ++++ tcc-0.9.26-1tclio/libtcc.c	2014-05-02 01:30:08.967140003 -0500
     4      4   @@ -669,7 +669,7 @@
     5      5        bf->line_num = 1;
     6      6        bf->ifndef_macro = 0;
     7      7        bf->ifdef_stack_ptr = s1->ifdef_stack_ptr;
     8      8   -    bf->fd = -1;
     9      9   +    bf->fd = NULL;
    10     10        bf->prev = file;
................................................................................
    93     93   +    size = Tcl_Read(fd, (char *)&ehdr, sizeof(ehdr));
    94     94   +    Tcl_Seek(fd, 0, SEEK_SET);
    95     95        if (size <= 0) {
    96     96            tcc_error_noabort("could not read header");
    97     97            goto the_end;
    98     98   diff -uNr tcc-0.9.26.orig/tcc.h tcc-0.9.26-1tclio/tcc.h
    99     99   --- tcc-0.9.26.orig/tcc.h	2013-02-15 08:24:00.000000000 -0600
   100         -+++ tcc-0.9.26-1tclio/tcc.h	2014-05-01 21:14:22.294602204 -0500
          100  ++++ tcc-0.9.26-1tclio/tcc.h	2014-05-02 01:30:08.967140003 -0500
   101    101   @@ -429,7 +429,7 @@
   102    102    typedef struct BufferedFile {
   103    103        uint8_t *buf_ptr;
   104    104        uint8_t *buf_end;
   105    105   -    int fd;
   106    106   +    Tcl_Channel fd;
   107    107        struct BufferedFile *prev;
................................................................................
   152    152   -ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd);
   153    153   +ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, Tcl_Channel fd);
   154    154    ST_FUNC int pe_output_file(TCCState * s1, const char *filename);
   155    155    ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value);
   156    156    ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2);
   157    157   diff -uNr tcc-0.9.26.orig/tcccoff.c tcc-0.9.26-1tclio/tcccoff.c
   158    158   --- tcc-0.9.26.orig/tcccoff.c	2013-02-15 08:24:00.000000000 -0600
   159         -+++ tcc-0.9.26-1tclio/tcccoff.c	2014-05-01 21:14:22.295602331 -0500
          159  ++++ tcc-0.9.26-1tclio/tcccoff.c	2014-05-02 01:30:08.967140003 -0500
   160    160   @@ -858,10 +858,11 @@
   161    161        return 0;
   162    162    }
   163    163    
   164    164   -ST_FUNC int tcc_load_coff(TCCState * s1, int fd)
   165    165   +ST_FUNC int tcc_load_coff(TCCState * s1, Tcl_Channel fd)
   166    166    {
................................................................................
   184    184   +
   185    185   +    f = fdopen(native_fd, "rb");
   186    186        if (!f) {
   187    187    	tcc_error("Unable to open .out file for input");
   188    188        }
   189    189   diff -uNr tcc-0.9.26.orig/tccelf.c tcc-0.9.26-1tclio/tccelf.c
   190    190   --- tcc-0.9.26.orig/tccelf.c	2013-02-15 08:24:00.000000000 -0600
   191         -+++ tcc-0.9.26-1tclio/tccelf.c	2014-05-01 21:14:22.301603094 -0500
          191  ++++ tcc-0.9.26-1tclio/tccelf.c	2014-05-02 01:30:08.967140003 -0500
   192    192   @@ -2334,13 +2334,13 @@
   193    193        return ret;
   194    194    }
   195    195    
   196    196   -static void *load_data(int fd, unsigned long file_offset, unsigned long size)
   197    197   +static void *load_data(Tcl_Channel fd, unsigned long file_offset, unsigned long size)
   198    198    {
................................................................................
   319    319   -    read(fd, &ehdr, sizeof(ehdr));
   320    320   +    Tcl_Read(fd, (char *) &ehdr, sizeof(ehdr));
   321    321    
   322    322        /* test CPU specific stuff */
   323    323        if (ehdr.e_ident[5] != ELFDATA2LSB ||
   324    324   diff -uNr tcc-0.9.26.orig/tccpe.c tcc-0.9.26-1tclio/tccpe.c
   325    325   --- tcc-0.9.26.orig/tccpe.c	2013-02-15 08:24:00.000000000 -0600
   326         -+++ tcc-0.9.26-1tclio/tccpe.c	2014-05-01 21:14:22.302603222 -0500
          326  ++++ tcc-0.9.26-1tclio/tccpe.c	2014-05-02 01:30:08.967140003 -0500
   327    327   @@ -1505,10 +1505,10 @@
   328    328    
   329    329    /* ------------------------------------------------------------- */
   330    330    
   331    331   -static int read_mem(int fd, unsigned offset, void *buffer, unsigned len)
   332    332   +static int read_mem(Tcl_Channel fd, unsigned offset, void *buffer, unsigned len)
   333    333    {
................................................................................
   386    386   -ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd)
   387    387   +ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, Tcl_Channel fd)
   388    388    {
   389    389        int ret = -1;
   390    390        char buf[10];
   391    391   diff -uNr tcc-0.9.26.orig/tccpp.c tcc-0.9.26-1tclio/tccpp.c
   392    392   --- tcc-0.9.26.orig/tccpp.c	2013-02-15 08:24:00.000000000 -0600
   393         -+++ tcc-0.9.26-1tclio/tccpp.c	2014-05-01 22:25:10.373511188 -0500
          393  ++++ tcc-0.9.26-1tclio/tccpp.c	2014-05-02 01:30:08.967140003 -0500
   394    394   @@ -360,13 +360,13 @@
   395    395        int len;
   396    396        /* only tries to read if really end of buffer */
   397    397        if (bf->buf_ptr >= bf->buf_end) {
   398    398   -        if (bf->fd != -1) {
   399    399   +        if (bf->fd != NULL) {
   400    400    #if defined(PARSE_DEBUG)
................................................................................
   412    412                }
   413    413    
   414    414   -            if (tcc_open(s1, buf1) < 0)
   415    415   +            if (tcc_open(s1, buf1) == NULL)
   416    416    include_trynext:
   417    417                    continue;
   418    418    
          419  +diff -uNr tcc-0.9.26.orig/win32/tools/tiny_impdef.c tcc-0.9.26-1tclio/win32/tools/tiny_impdef.c
          420  +--- tcc-0.9.26.orig/win32/tools/tiny_impdef.c	2013-02-15 08:24:00.000000000 -0600
          421  ++++ tcc-0.9.26-1tclio/win32/tools/tiny_impdef.c	2014-05-02 01:31:28.497140003 -0500
          422  +@@ -161,7 +161,7 @@
          423  + /* -------------------------------------------------------------- */
          424  + #endif
          425  + 
          426  +-char *get_export_names(int fd)
          427  ++char *get_export_names(Tcl_Channel fd)
          428  + {
          429  +     int l, i, n, n0;
          430  +     char *p;

Modified tcltcc.c from [bdb10e54ff] to [373fc5958a].

   206    206                   Tcl_AppendResult(interp, "code already relocated, cannot output to file", NULL);
   207    207                   return TCL_ERROR;
   208    208               }
   209    209               if (s->output_type == TCC_OUTPUT_MEMORY) {     
   210    210                   Tcl_AppendResult(interp, "output_type memory not valid for output to file", NULL);
   211    211                   return TCL_ERROR;
   212    212               }
   213         -#ifdef WIN32
   214         -            res = tcc_output_pe(s,Tcl_GetString(objv[2]));
   215         -#else
   216    213               res = tcc_output_file(s,Tcl_GetString(objv[2]));
   217         -#endif
   218    214   
   219    215               if (res!=0) {
   220    216                   Tcl_AppendResult(interp, "output to file failed", NULL);
   221    217                   return TCL_ERROR;
   222    218               } else {
   223    219                   return TCL_OK;
   224    220               }