#!/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
# SHLIB_INSTALL
# MULTILIB_OSDIRNAMES
# ASM_HIDDEN_OP
+# GCC_FOR_TARGET
# Make needs VPATH to be literal.
echo 'srcdir = @srcdir@'
_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
# 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)" \
# 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
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
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}
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)' \
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
# 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
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
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
# 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
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
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
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