changeset 511:374af493d0ac

More work on the library paths so we can override enough things to build on an x86-64 host.
author Rob Landley <rob@landley.net>
date Mon, 12 Nov 2007 18:47:56 -0600
parents f304c7e3de8d
children 38ce6428eaa0
files make tcc.c tcc.h tccelf.c
diffstat 4 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/make	Sun Nov 11 03:45:57 2007 -0600
+++ b/make	Mon Nov 12 18:47:56 2007 -0600
@@ -13,7 +13,8 @@
 [ -z "$ARCH" ] && ARCH="i386 arm c67 win32"
 [ -z "$CC_LIB_PATH" ] && CC_LIB_PATH=/usr/lib/tcc
 [ -z "$TINYCC_LIBS" ] && TINYCC_LIBS="/usr/local/lib:/usr/lib:/lib"
-[ -z "$TINYCC_INCLUDES" ] && TINYCC_INCLUDES=/usr/include
+[ -z "$TINYCC_INCLUDES" ] && TINYCC_INCLUDES=/usr/include:/usr/local/include
+[ -z "$TINYCC_CRTPATH" ] && TINYCC_CRTPATH="/usr/lib"
 
 TINYCC_VERSION=1.2.3
 
@@ -55,6 +56,7 @@
 
   $CC $CFLAGS $LIBS -DTCC_TARGET_$i \
     '-DCC_LIB_PATH="'"$CC_LIB_PATH"'"' \
+    '-DTINYCC_CRTPATH="'"$TINYCC_CRTPATH"'"' \
     '-DTINYCC_LIBS="'"$TINYCC_LIBS"'"' \
     '-DTINYCC_INCLUDES="'"$TINYCC_INCLUDES"'"' \
     '-DTINYCC_VERSION="'"$TINYCC_VERSION"'"' \
--- a/tcc.c	Sun Nov 11 03:45:57 2007 -0600
+++ b/tcc.c	Mon Nov 12 18:47:56 2007 -0600
@@ -9170,10 +9170,11 @@
     /* add libc crt1/crti objects */
 #ifndef TCC_TARGET_PE
     if ((output_type == TCC_OUTPUT_EXE || output_type == TCC_OUTPUT_DLL) &&
-        !s->nostdlib) {
+        !s->nostdlib)
+    {
         if (output_type != TCC_OUTPUT_DLL)
-            tcc_add_file(s, CONFIG_TCC_CRT_PREFIX "/crt1.o");
-        tcc_add_file(s, CONFIG_TCC_CRT_PREFIX "/crti.o");
+            tcc_add_file(s, TINYCC_CRTPATH "/crt1.o");
+        tcc_add_file(s, TINYCC_CRTPATH "/crti.o");
     }
 #endif
     return 0;
--- a/tcc.h	Sun Nov 11 03:45:57 2007 -0600
+++ b/tcc.h	Mon Nov 12 18:47:56 2007 -0600
@@ -94,10 +94,6 @@
 #define true 1
 typedef int BOOL;
 
-/* path to find crt1.o, crti.o and crtn.o. Only needed when generating
-   executables or dlls */
-#define CONFIG_TCC_CRT_PREFIX "/usr/lib"
-
 #define INCLUDE_STACK_SIZE  32
 #define IFDEF_STACK_SIZE    64
 #define VSTACK_SIZE         256
--- a/tccelf.c	Sun Nov 11 03:45:57 2007 -0600
+++ b/tccelf.c	Mon Nov 12 18:47:56 2007 -0600
@@ -1008,16 +1008,13 @@
 #endif
     }
 #endif
-    /* add libc */
+    // add libc
     if (!s1->nostdlib) {
         tcc_add_library(s1, "c");
-
-        snprintf(buf, sizeof(buf), "%s/%s", cc_lib_path, "libtcc1.a");
-        tcc_add_file(s1, buf);
-    }
-    /* add crt end if not memory output */
-    if (s1->output_type != TCC_OUTPUT_MEMORY && !s1->nostdlib) {
-        tcc_add_file(s1, CONFIG_TCC_CRT_PREFIX "/crtn.o");
+        tcc_add_library(s1, "tinycc");
+      // add crt end if not memory output
+      if (s1->output_type != TCC_OUTPUT_MEMORY)
+          tcc_add_file(s1, TINYCC_CRTPATH "/crtn.o");
     }
 }