/[cmucl]/src/tools/linker.sh
ViewVC logotype

Diff of /src/tools/linker.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by fgilham, Thu Jul 12 04:50:22 2007 UTC revision 1.3 by fgilham, Tue Jul 17 15:25:14 2007 UTC
# Line 15  if [ -z "$GCC" ] Line 15  if [ -z "$GCC" ]
15      exit 1      exit 1
16  fi  fi
17    
18  set_libroot()  # Uniform method for finding GCC C runtime object files suggested by Ray Toy
19  {  CRTPATH=`$GCC -print-libgcc-file-name`
20      LIBROOT=`$GCC -v 2>&1 | \  LIBROOT=`dirname $CRTPATH`
21          grep 'Reading' | \  echo "LIBROOT is $LIBROOT"
         sed -e 's/Reading specs from //' | \  
         sed -e 's|/specs||'`  
   
     echo "LIBROOT is $LIBROOT"  
 }  
   
   
 find_libroot()  
 {  
     LIBROOT=''  
     GCC_VERSION=`$GCC -v 2>&1 | \  
      grep 'gcc version' | \  
      sed -e 's/gcc version //' | \  
      sed -e 's/ .*//'`  
     if [ -z "$GCC_VERSION" ]; then  
         echo "Can't get the version from GCC.  Something is very wrong."  
         exit 1  
     fi  
   
     CRT_DIR=`find /usr/lib -name $GCC_VERSION -print`  
   
     if [ -f $CRT_DIR/crtbegin.o ] && [ -f $CRT_DIR/crtend.o ]; then  
         LIBROOT=$CRT_DIR  
     else  
         if [ -f /usr/lib/crtbegin.o ] && [ -f /usr/lib/crtend.o ]; then  
             # I doubt that this is right.  After all, this is Linux.  You  
             # don't expect to find things in reasonable places.  
             LIBROOT=/usr/lib  
         fi  
     fi  
   
     if [ -z $LIBROOT ]; then  
         echo "Can't find the directory with the C runtime object files.  Exiting."  
         exit 1  
     fi  
   
     echo "LIBROOT is $LIBROOT"  
 }  
22    
23  if [ $# -ne 2 ]  if [ $# -ne 2 ]
24      then      then
# Line 70  VER='' Line 32  VER=''
32  # Set OS-specific variables.  # Set OS-specific variables.
33  case "$OPSYS" in  case "$OPSYS" in
34      Linux )      Linux )
         # See if this is a version of Linux where GCC reports  
         # where it gets the specs from.  Extract the location of  
         # the C runtime object files from that.  
         set_libroot  
         if [ -z "$LIBROOT" ]; then  
             # We have to do it the hard way.  
             find_libroot  
         fi  
35          DLINKER='-dynamic-linker /lib/ld-linux.so.2'          DLINKER='-dynamic-linker /lib/ld-linux.so.2'
36          STARTCRT="$LIBROOT/../../../crt1.o $LIBROOT/../../../crti.o $LIBROOT/crtbegin.o"          STARTCRT="$LIBROOT/../../../crt1.o $LIBROOT/../../../crti.o $LIBROOT/crtbegin.o"
37          ENDCRT="$LIBROOT/crtend.o $LIBROOT/../../../crtn.o"          ENDCRT="$LIBROOT/crtend.o $LIBROOT/../../../crtn.o"
38          LIBS="-L$LIBROOT -ldl -lm -lgcc -lc -lgcc"          LIBS="-L$LIBROOT -ldl -lm -lgcc -lc -lgcc"
39          ;;          ;;
40      FreeBSD )      FreeBSD )
         LIBROOT=/usr/lib  
41          DLINKER='-dynamic-linker /usr/libexec/ld-elf.so.1'          DLINKER='-dynamic-linker /usr/libexec/ld-elf.so.1'
42          STARTCRT="$LIBROOT/crt1.o $LIBROOT/crti.o $LIBROOT/crtbegin.o"          STARTCRT="$LIBROOT/crt1.o $LIBROOT/crti.o $LIBROOT/crtbegin.o"
43          ENDCRT="$LIBROOT/crtend.o $LIBROOT/crtn.o"          ENDCRT="$LIBROOT/crtend.o $LIBROOT/crtn.o"

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.5