OSDN Git Service

* testsuite/lib/libgomp-dg.exp (libgomp_init): Compute multilib-related
[pf3gnuchains/gcc-fork.git] / gcc / mklibgcc.in
index 91e5640..88e0df0 100644 (file)
@@ -1,6 +1,7 @@
 #!/bin/sh
 # Construct makefile for libgcc.
-#   Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+#   Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006
+#   Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 
 # DPBIT_FUNCS
 # TPBIT
 # TPBIT_FUNCS
+# D32PBIT
+# D32PBIT_FUNCS
+# D64PBIT
+# D64PBIT_FUNCS
+# D128PBIT
+# D128PBIT_FUNCS
 # LIBGCC
 # MULTILIBS
 # EXTRA_MULTILIB_PARTS
@@ -40,6 +47,7 @@
 # SHLIB_INSTALL
 # MULTILIB_OSDIRNAMES
 # ASM_HIDDEN_OP
+# GCC_FOR_TARGET
 
 # Make needs VPATH to be literal.
 echo 'srcdir = @srcdir@'
@@ -62,7 +70,7 @@ lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3
        _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
        _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2
        _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3
-       _divxc3 _divtc3'
+       _divxc3 _divtc3 _floatundidf _floatundisf _floatundixf _floatunditf'
 
 # Disable SHLIB_LINK if shared libgcc not enabled.
 if [ "@enable_shared@" = "no" ]; then
@@ -72,6 +80,7 @@ fi
 # Build lines.
 
 gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
+gcc_s_compile="$gcc_compile -DSHARED"
 make_compile='$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
          AR_FOR_TARGET="$(AR_FOR_TARGET)" \
          AR_CREATE_FOR_TARGET="$(AR_CREATE_FOR_TARGET)" \
@@ -94,6 +103,15 @@ libgcov_c_dep='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h $(srcdir)/gcov-
 # Dependencies for fp-bit.c
 fpbit_c_dep='stmp-dirs config.status tsystem.h'
 
+# Dependencies for decnumber and friends.  This is an overzealous set,
+# but at least we can be sure to recompile if anything gets modified.
+decnumber_dep='stmp-dirs $(srcdir)/../libdecnumber/decContext.h $(srcdir)/../libdecnumber/decNumber.h
+       $(srcdir)/../libdecnumber/decNumberLocal.h $(srcdir)/../libdecnumber/decimal32.h $(srcdir)/../libdecnumber/decimal64.h
+       $(srcdir)/../libdecnumber/decimal128.h $(srcdir)/../libdecnumber/decDPD.h $(srcdir)/../libdecnumber/decUtility.h'
+
+# Flag whether we need eh_dummy.c
+need_eh_dummy=
+
 if [ "$SHLIB_LINK" ]; then
   # Test -fvisibility=hidden.  We need both a -fvisibility=hidden on
   # the command line, and a #define to prevent libgcc2.h etc from
@@ -174,7 +192,7 @@ for ml in $MULTILIBS; do
     if [ "$LIBUNWIND" ]; then
       libunwind_so=$dir/libunwind${SHLIB_EXT}
     fi
-    os_multilib_dir=`./xgcc -B./ $flags --print-multi-os-directory`
+    os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
     if [ "$os_multilib_dir" != . ]; then
       shlib_slibdir_qual="/$os_multilib_dir"
     fi
@@ -215,7 +233,7 @@ for ml in $MULTILIBS; do
       outV="libgcc/${dir}/${name}.vis"
 
       echo ${outS}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
-      echo "   $gcc_compile" $flags -DL$name -xassembler-with-cpp \
+      echo "   $gcc_s_compile" $flags -DL$name -xassembler-with-cpp \
          -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $outS
 
       echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)' ${outV}
@@ -248,7 +266,8 @@ for ml in $MULTILIBS; do
       outS="libgcc/${dir}/${name}_s${objext}"
 
       echo $outS: $libgcc2_c_dep
-      echo "   $gcc_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' -o $outS
+      echo "   $gcc_s_compile" $flags -DL$name -c '$(srcdir)/libgcc2.c' \
+       -o $outS
 
       echo $out: $libgcc2_c_dep
       echo "   $gcc_compile" $flags -DL$name '$(vis_hide)' \
@@ -282,7 +301,7 @@ for ml in $MULTILIBS; do
       outS="libgcc/${dir}/${name}_s${objext}"
 
       echo $outS: $libgcc2_c_dep
-      echo "   $gcc_compile" $flags -DL$name \
+      echo "   $gcc_s_compile" $flags -DL$name \
         -fexceptions -fnon-call-exceptions -c '$(srcdir)/libgcc2.c' -o $outS
 
       echo $out: $libgcc2_c_dep
@@ -307,92 +326,86 @@ for ml in $MULTILIBS; do
   # Build software floating point functions.
   #
 
-  if [ "$FPBIT" ]; then
-    for name in $FPBIT_FUNCS; do
-      if [ "$libgcc_s_so" ]; then
-       out="libgcc/${dir}/${name}${objext}"
-       outS="libgcc/${dir}/${name}_s${objext}"
-
-       echo $outS: $FPBIT $fpbit_c_dep
-       echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         -c $FPBIT -o $outS
-
-        echo $out: $FPBIT $fpbit_c_dep
-        echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         '$(vis_hide)' -c $FPBIT -o $out
-
-       echo $libgcc_a: $out
-       echo $libgcc_s_so: $outS
-       if [ "$SHLIB_MKMAP" ]; then
-         echo libgcc/${dir}/libgcc.map: $outS
-       fi
-      else
-       out="libgcc/${dir}/${name}${objext}"
-       echo $out: $FPBIT $fpbit_c_dep
-       echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         -c $FPBIT -o $out
-
-       echo $libgcc_a: $out
+  for fpbit_var in FPBIT DPBIT TPBIT ; do
+      fpfuncs_var="${fpbit_var}_FUNCS"
+      eval fpbit=\$$fpbit_var
+      eval fpfuncs=\$$fpfuncs_var
+
+      if [ "$fpbit" ] ; then
+         for name in $fpfuncs; do
+             case "$name" in
+               # _sf_to_tf and _df_to_tf require tp-bit.c
+               # being compiled in.
+               _[sd]f_to_tf) [ -z "$TPBIT" ] && continue;;
+             esac
+             if [ "$libgcc_s_so" ]; then
+                 out="libgcc/${dir}/${name}${objext}"
+                 outS="libgcc/${dir}/${name}_s${objext}"
+
+                 echo $outS: $fpbit $fpbit_c_dep
+                 echo "        $gcc_s_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
+                     -c $fpbit -o $outS
+
+                 echo $out: $fpbit $fpbit_c_dep
+                 echo "        $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
+                     '$(vis_hide)' -c $fpbit -o $out
+                 
+                 echo $libgcc_a: $out
+                 echo $libgcc_s_so: $outS
+                 if [ "$SHLIB_MKMAP" ]; then
+                     echo libgcc/${dir}/libgcc.map: $outS
+                 fi
+             else
+                 out="libgcc/${dir}/${name}${objext}"
+                 echo $out: $fpbit $fpbit_c_dep
+                 echo "        $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
+                     -c $fpbit -o $out
+                 
+                 echo $libgcc_a: $out
+             fi
+         done
       fi
-    done
-  fi
-
-  if [ "$DPBIT" ]; then
-    for name in $DPBIT_FUNCS; do
-      if [ "$libgcc_s_so" ]; then
-       out="libgcc/${dir}/${name}${objext}"
-       outS="libgcc/${dir}/${name}_s${objext}"
-
-       echo $outS: $DPBIT $fpbit_c_dep
-       echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         -c $DPBIT -o $outS
+  done
 
-        echo $out: $DPBIT $fpbit_c_dep
-        echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         '$(vis_hide)' -c $DPBIT -o $out
+  if [ "@enable_decimal_float@" = "yes" -a -z "$libgcc_so" ]; then
+    # Bring in the DFP support code if D32PBIT, D64PBIT or D128PBIT are set.
+    if [ -n "$D32PBIT" -o -n "$D64PBIT" -o -n "$D128PBIT" ] ; then
+      dec_filenames="decContext decNumber decRound decLibrary decUtility"
+    fi
 
-       echo $libgcc_a: $out
-       echo $libgcc_s_so: $outS
-       if [ "$SHLIB_MKMAP" ]; then
-         echo libgcc/${dir}/libgcc.map: $outS
-       fi
-      else
-       out="libgcc/${dir}/${name}${objext}"
-       echo $out: $DPBIT $fpbit_c_dep
-       echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         -c $DPBIT -o $out
+    # Only bring in decimal*.c files for types we support.
+    if [ -n "$D32PBIT" ] ; then
+      dec_filenames="$dec_filenames decimal32"
+    fi
+    if [ -n "$D64PBIT" ] ; then
+      dec_filenames="$dec_filenames decimal64"
+    fi
+    if [ -n "$D128PBIT" ] ; then
+      dec_filenames="$dec_filenames decimal128"
+    fi
 
-       echo $libgcc_a: $out
-      fi
+    for name in $dec_filenames ; do
+      out="libgcc/${dir}/${name}${objext}"
+      echo $out: "\$(srcdir)/../libdecnumber/${name}.c" $decnumber_dep
+      echo "   $gcc_compile" $flags -c "\$(srcdir)/../libdecnumber/${name}.c" -o $out
+      echo $libgcc_a: $out
     done
-  fi
-
-  if [ "$TPBIT" ]; then
-    for name in $TPBIT_FUNCS; do
-      if [ "$libgcc_s_so" ]; then
-       out="libgcc/${dir}/${name}${objext}"
-       outS="libgcc/${dir}/${name}_s${objext}"
-
-       echo $outS: $TPBIT $fpbit_c_dep
-       echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         -c $TPBIT -o $outS
-
-        echo $out: $TPBIT $fpbit_c_dep
-        echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         '$(vis_hide)' -c $TPBIT -o $out
-
-       echo $libgcc_a: $out
-       echo $libgcc_s_so: $outS
-       if [ "$SHLIB_MKMAP" ]; then
-         echo libgcc/${dir}/libgcc.map: $outS
-       fi
-      else
-       out="libgcc/${dir}/${name}${objext}"
-       echo $out: $TPBIT $fpbit_c_dep
-       echo "  $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-         -c $TPBIT -o $out
 
-       echo $libgcc_a: $out
+    # For individual functions, loop over each variable by name.
+    for dpbit_var in D32PBIT D64PBIT D128PBIT ; do
+      dpfuncs_var="${dpbit_var}_FUNCS"
+      eval dpbit=\$$dpbit_var
+      eval dpfuncs=\$$dpfuncs_var
+
+      if [ "$dpbit" ]; then
+        for name in $dpfuncs; do
+          out="libgcc/${dir}/${name}${objext}"
+         echo $out: $dpbit $fpbit_c_dep
+         echo "        $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
+           -c $dpbit -o $out
+
+         echo $libgcc_a: $out
+        done
       fi
     done
   fi
@@ -408,7 +421,7 @@ for ml in $MULTILIBS; do
       case $file in
        *.c)
          echo $outS: stmp-dirs $file $libgcc_dep
-         echo "        $gcc_compile" $flags -c $file -o $outS
+         echo "        $gcc_s_compile" $flags -c $file -o $outS
 
          echo $out: stmp-dirs $file $libgcc_dep
          echo "        $gcc_compile" $flags '$(vis_hide)' -c $file -o $out
@@ -418,7 +431,7 @@ for ml in $MULTILIBS; do
          outV="libgcc/${dir}/${oname}.vis"
 
          echo $outS: stmp-dirs $file $libgcc_dep
-         echo "        $gcc_compile" $flags -xassembler-with-cpp \
+         echo "        $gcc_s_compile" $flags -xassembler-with-cpp \
                 -c $file -o $outS
 
          echo $out: stmp-dirs $file $libgcc_dep $outV
@@ -504,60 +517,98 @@ for ml in $MULTILIBS; do
 
   # If we don't have libgcc_eh.a, only LIB2ADDEH matters.  If we do, only
   # LIB2ADDEHSTATIC and LIB2ADDEHSHARED matter.  (Usually all three are
-  # identical.)  We do _not_ handle assembly files in this context.
+  # identical.)
 
   if [ "$libgcc_eh_a" ]; then
     for file in $LIB2ADDEHSTATIC; do
-      case $file in
-        *.c) ;;
-       *)   echo "Unhandled extension: $file">&2; exit 1 ;;
-       esac
-
-      name=`echo $file | sed -e 's/[.]c$//'`
+      name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
       oname=`echo $name | sed -e 's,.*/,,'`
       out="libgcc/${dir}/${oname}${objext}"
 
-      echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
-      echo "   $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
+      case $file in
+        *.c)
+         echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
+         echo "        $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
+         ;;
+       *.asm | *.S)
+         # We have to compile it twice in order to establish the list
+         # of symbols to be marked hidden.
+         outV="libgcc/${dir}/${oname}.vis"
+         outT="libgcc/${dir}/${oname}_t${objext}"
+         echo ${outT}: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
+         echo "        $gcc_compile" $flags -xassembler-with-cpp \
+                 -c $file -o ${outT}
+         echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep $outV
+         echo "        $gcc_compile" $flags -xassembler-with-cpp \
+                 -include $outV -c $file -o $out
+         echo "${outV}: ${outT}; \$(gen-hide-list)"
+         ;;
+       *)   echo "Unhandled extension: $file">&2; exit 1 ;;
+      esac
+
       echo $libgcc_eh_a: $out
     done
 
     for file in $LIB2ADDEHSHARED; do
+      name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
+      oname=`echo $name | sed -e 's,.*/,,'`
+      outS="libgcc/${dir}/${oname}_s${objext}"
+
       case $file in
-        *.c) ;;
+        *.c)
+         echo $outS: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
+         echo "        $gcc_s_compile" $flags -fexceptions -c $file -o $outS
+         ;;
+       *.asm | *.S)
+         echo $outS: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
+         echo "        $gcc_s_compile" $flags -xassembler-with-cpp -c $file -o $outS
+         ;;
        *)   echo "Unhandled extension: $file">&2; exit 1 ;;
-       esac
-
-      name=`echo $file | sed -e 's/[.]c$//'`
-      oname=`echo $name | sed -e 's,.*/,,'`
-      out="libgcc/${dir}/${oname}_s${objext}"
+      esac
 
-      echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
-      echo "   $gcc_compile" $flags -fexceptions -c $file -o $out
-      echo $libgcc_s_so: $out
+      echo $libgcc_s_so: $outS
       if [ "$SHLIB_MKMAP" ]; then
-       echo libgcc/${dir}/libgcc.map: $out
+       echo libgcc/${dir}/libgcc.map: $outS
       fi
     done
 
+    # If nothing went into libgcc_eh.a, create a dummy object -
+    # some linkers don't like totally empty archives.
+    if [ -z "$LIB2ADDEHSTATIC" ]; then
+      file=eh_dummy.c
+      out="libgcc/${dir}/eh_dummy${objext}"
+      need_eh_dummy=1
+
+      echo $out: stmp-dirs $file
+      echo "   $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
+      echo $libgcc_eh_a: $out
+    fi
+   
+
   else # no libgcc_eh.a
     for file in $LIB2ADDEH; do
-      case $file in
-        *.c) ;;
-       *)   echo "Unhandled extension: $file">&2; exit 1 ;;
-       esac
-
-      name=`echo $file | sed -e 's/[.]c$//'`
+      name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//'`
       oname=`echo $name | sed -e 's,.*/,,'`
       out="libgcc/${dir}/${oname}${objext}"
 
-      echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
-      echo "   $gcc_compile" $flags -fexceptions '$(vis_hide)' -c $file -o $out
+      case $file in
+        *.c)
+         echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
+         echo "        $gcc_compile" $flags '$(vis_hide)' -fexceptions -c $file -o $out
+         ;;
+       *.asm | *.S)
+         echo $out: stmp-dirs $file $LIB2ADDEHDEP $libgcc_dep
+         echo "        $gcc_compile" $flags -xassembler-with-cpp \
+                 -c $file -o $out
+         ;;
+       *)   echo "Unhandled extension: $file">&2; exit 1 ;;
+      esac
+
       echo $libgcc_a: $out
     done
   fi
 
-  # Again, this does not handle assembly.
+  # We do _not_ handle assembly files in this context.
   if [ "$LIBUNWIND" ]; then
     for file in $LIBUNWIND; do
       case $file in
@@ -576,7 +627,7 @@ for ml in $MULTILIBS; do
        echo "  $gcc_compile $flags -fexceptions \$(vis_hide) -c $file -o $out"
 
        echo $outS: stmp-dirs $file $LIBUNWINDDEP
-       echo "  $gcc_compile $flags -fexceptions -DSHARED -c $file -o $outS"
+       echo "  $gcc_s_compile $flags -fexceptions -c $file -o $outS"
 
        echo $libunwind_a: $out
        echo $libunwind_so: $outS
@@ -760,6 +811,11 @@ echo "       if [ -d \$\$d ]; then true; else $mkinstalldirs \$\$d; fi; \\"
 echo " done"
 echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
 
+if [ "$need_eh_dummy" ]; then
+  echo "eh_dummy.c:"
+  echo "       echo 'int __libgcc_eh_dummy;' > \$@"
+fi
+
 echo ""
 echo "install: all"
 for ml in $MULTILIBS; do
@@ -781,7 +837,7 @@ for ml in $MULTILIBS; do
     echo '     $(RANLIB_FOR_TARGET)' ${ldir}/libgcc_eh.a
 
     shlib_slibdir_qual=
-    os_multilib_dir=`./xgcc -B./ $flags --print-multi-os-directory`
+    os_multilib_dir=`$GCC_FOR_TARGET $flags --print-multi-os-directory`
     if [ "$os_multilib_dir" != . ]; then
       shlib_slibdir_qual="/$os_multilib_dir"
     fi