tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] tcc_output_file on Windows


From: Shmuel Zeigerman
Subject: [Tinycc-devel] tcc_output_file on Windows
Date: Sun, 27 Apr 2008 23:18:43 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9

Hello,

While tcc.exe can produce .exe and .dll output on Windows,
this is not the case with tcc.dll. tcc_output_file fails with
the following message:

    tcc: file '/usr/lib/crtn.o' not found

A simple patch against tcc-0.9.24 is proposed (attached).

--
Shmuel
diff -urNb tcc-0.9.24\tcc.c tcc\tcc.c
--- tcc-0.9.24\tcc.c    Mon Mar 31 10:24:00 2008
+++ tcc\tcc.c   Sun Apr 27 20:33:10 2008
@@ -11063,14 +11063,7 @@
     } else if (s->output_type == TCC_OUTPUT_MEMORY) {
         ret = tcc_run(s, argc - optind, argv + optind);
     } else
-#ifdef TCC_TARGET_PE
-    if (s->output_type != TCC_OUTPUT_OBJ) {
-        ret = pe_output_file(s, outfile);
-    } else
-#endif
-    {
-        ret = tcc_output_file(s, outfile) ? 1 : 0;
-    }
+        ret = tcc_output_file(s, outfile);
  the_end:
     /* XXX: cannot do it with bound checking because of the malloc hooks */
     if (!do_bounds_check)
diff -urNb tcc-0.9.24\tccelf.c tcc\tccelf.c
--- tcc-0.9.24\tccelf.c Mon Mar 31 10:24:00 2008
+++ tcc\tccelf.c        Sun Apr 27 20:41:12 2008
@@ -1132,7 +1132,7 @@
 
 /* output an ELF file */
 /* XXX: suppress unneeded sections */
-int tcc_output_file(TCCState *s1, const char *filename)
+int elf_output_file(TCCState *s1, const char *filename)
 {
     Elf32_Ehdr ehdr;
     FILE *f;
@@ -1773,6 +1773,20 @@
     return ret;
 }
 
+int tcc_output_file(TCCState *s, const char *filename)
+{
+    int ret;
+#ifdef TCC_TARGET_PE
+    if (s->output_type != TCC_OUTPUT_OBJ) {
+        ret = pe_output_file(s, filename);
+    } else
+#endif
+    {
+        ret = elf_output_file(s, filename) ? 1 : 0;
+    }
+    return ret;
+}
+
 static void *load_data(int fd, unsigned long file_offset, unsigned long size)
 {
     void *data;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]