Le jeudi 4 août 2011 00:53:59, grischka a écrit :
> Thomas Preud'homme wrote:
> > Actually I'd like to be able to try 2 prefixs, to reduce the dependencies
> > between glibc and tcc. This way tcc could work well both with the old
> > glibc (which install crt objects in /usr/lib) and the current glibc
> > (which install crt objects in /usr/lib/<triplet>). If not OK for you,
> > I'll have to choose between stricter dependency (only depend on recent
> > glibc) or add a small patch
> 
> Does gcc try prefixes for crt objects?
I don't know for the upstream gcc but I did a try on my debian system and it 
is:

12:31 robotux@trevize ~% ls /usr/lib | grep "^crt.*"
zsh: done       ls --classify --tabsize=0 --literal --color=auto --show-
control-chars   |
zsh: exit 1     grep "^crt.*"
12:31 robotux@trevize ~% ls /usr/lib/x86_64-linux-gnu | grep "^crt.*"
crt1.o
crti.o
crtn.o
12:31 robotux@trevize ~% gcc -Wall -o test test.c

(Moving crt*.o in /usr/lib)

12:31 robotux@trevize ~% ls /usr/lib | grep "^crt.*"
crt1.o
crti.o
crtn.o
12:31 robotux@trevize ~% ls /usr/lib/x86_64-linux-gnu | grep "^crt.*"
zsh: done       ls --classify --tabsize=0 --literal --color=auto --show-
control-chars   |
zsh: exit 1     grep "^crt.*"
12:31 robotux@trevize ~% gcc -Wall -o test test.c

(Moving crt*.o in /)

12:31 robotux@trevize ~% ls /usr/lib | grep "^crt.*"                 
zsh: done       ls --classify --tabsize=0 --literal --color=auto --show-
control-chars   | 
zsh: exit 1     grep "^crt.*"
12:33 robotux@trevize ~% ls /usr/lib/x86_64-linux-gnu | grep "^crt.*"
zsh: done       ls --classify --tabsize=0 --literal --color=auto --show-
control-chars   | 
zsh: exit 1     grep "^crt.*"
12:33 robotux@trevize ~% gcc -Wall -o test test.c                    
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status
zsh: exit 1     colorgcc -Wall -o test test.c

Attached is a patch to implement the solution you were asking for.

Best regards.

> 
> --- grischka

Thomas Preud'homme
diff --git a/configure b/configure
index c9bc83a..4403511 100755
--- a/configure
+++ b/configure
@@ -30,6 +30,9 @@ tccdir=""
 includedir=""
 mandir=""
 infodir=""
+sysincludepaths=""
+libpaths=""
+crtprefix=""
 sysroot=""
 cross_prefix=""
 cc="gcc"
@@ -118,6 +121,12 @@ for opt do
   ;;
   --docdir=*) docdir=`echo $opt | cut -d '=' -f 2`
   ;;
+  --sysincludepaths=*) sysincludepaths=`echo $opt | cut -d '=' -f 2`
+  ;;
+  --libpaths=*) libpaths=`echo $opt | cut -d '=' -f 2`
+  ;;
+  --crtprefix=*) crtprefix=`echo $opt | cut -d '=' -f 2`
+  ;;
   --sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2`
   ;;
   --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
@@ -249,6 +258,9 @@ echo "  --mandir=DIR             man documentation in DIR [SHAREDIR/man]"
 echo "  --infodir=DIR            info documentation in DIR [SHAREDIR/info]"
 echo ""
 echo "Advanced options (experts only):"
+echo "  --sysincludepaths=DIR    system include paths [see tcc.h]"
+echo "  --libpaths=DIR           system library paths [see tcc.h]"
+echo "  --crtprefix=DIR          path prefix to crt*.o files [see tcc.h]"
 echo "  --source-path=PATH       path of source code [$source_path]"
 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
 echo "  --sysroot=PREFIX         prepend PREFIX to library/include paths []"
@@ -322,21 +334,24 @@ if test x"$includedir" = x""; then
 includedir="${prefix}/include"
 fi
 
-echo "Binary  directory   $bindir"
-echo "TinyCC directory    $tccdir"
-echo "Library directory   $libdir"
-echo "Include directory   $includedir"
-echo "Manual directory    $mandir"
-echo "Info directory      $infodir"
-echo "Doc directory       $docdir"
-echo "Target root prefix  $sysroot"
-echo "Source path      $source_path"
-echo "C compiler       $cc"
-echo "CPU              $cpu"
-echo "Big Endian       $bigendian"
-echo "gprof enabled    $gprof"
-echo "cross compilers  $build_cross"
-echo "use libgcc       $use_libgcc"
+echo "Binary  directory      $bindir"
+echo "TinyCC directory       $tccdir"
+echo "Library directory      $libdir"
+echo "Include directory      $includedir"
+echo "Manual directory       $mandir"
+echo "Info directory         $infodir"
+echo "Doc directory          $docdir"
+echo "System include paths   $sysincludepaths"
+echo "Library paths          $libpaths"
+echo "crt*.o prefix          $crtprefix"
+echo "Target root prefix     $sysroot"
+echo "Source path            $source_path"
+echo "C compiler             $cc"
+echo "CPU                    $cpu"
+echo "Big Endian             $bigendian"
+echo "gprof enabled          $gprof"
+echo "cross compilers        $build_cross"
+echo "use libgcc             $use_libgcc"
 
 echo "Creating config.mak and config.h"
 
@@ -353,6 +368,15 @@ echo "mandir=\$(DESTDIR)$mandir" >> config.mak
 echo "infodir=\$(DESTDIR)$infodir" >> config.mak
 echo "docdir=\$(DESTDIR)$docdir" >> config.mak
 
+echo "#ifndef CONFIG_TCC_SYSINCLUDE_PATHS" >> $TMPH
+echo "#define CONFIG_TCC_SYSINCLUDE_PATHS \"$sysincludepaths\"" >> $TMPH
+echo "#endif" >> $TMPH
+echo "#ifndef CONFIG_TCC_LIBPATH" >> $TMPH
+echo "#define CONFIG_TCC_LIBPATH \"$libpaths\"" >> $TMPH
+echo "#endif" >> $TMPH
+echo "#ifndef CONFIG_TCC_CRT_PREFIX" >> $TMPH
+echo "#define CONFIG_TCC_CRT_PREFIX \"$crtprefix\"" >> $TMPH
+echo "#endif" >> $TMPH
 echo "#ifndef CONFIG_SYSROOT" >> $TMPH
 echo "#define CONFIG_SYSROOT \"$sysroot\"" >> $TMPH
 echo "#endif" >> $TMPH

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to