From fa9518de0271175955abe4cce0b29788dd4e4aa3 Mon Sep 17 00:00:00 2001
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
Date: Mon, 9 Apr 2001 23:43:06 +0000
Subject: [PATCH] Makefile.in (LIB2FUNCS_STATIC_EXTRA): New macro.

        2001-04-29  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>

        * Makefile.in (LIB2FUNCS_STATIC_EXTRA): New macro.
        (LIB2ADD_ST): New macro, pass it to mklibgcc.
        * mklibgcc.in (libgcc2_st_objs): New variable, set it from LIB2ADD_ST.
        (libgcc_st_objs): New, set from libgcc2_st_objs. Use it for libgcc.a.
        * config/rs6000/t-ppccomm (LIB2FUNCS_STATIC_EXTRA): New macro.

From-SVN: r41215
---
 gcc/ChangeLog               |  8 ++++++++
 gcc/Makefile.in             | 14 ++++++++++----
 gcc/config/rs6000/t-ppccomm |  5 ++++-
 gcc/mklibgcc.in             | 30 ++++++++++++++++++++++++++++--
 4 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d6dcb7d11ca1..2a454762c403 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2001-04-29  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+	* Makefile.in (LIB2FUNCS_STATIC_EXTRA): New macro.
+	(LIB2ADD_ST): New macro, pass it to mklibgcc.
+	* mklibgcc.in (libgcc2_st_objs): New variable, set it from LIB2ADD_ST.
+        (libgcc_st_objs): New, set from libgcc2_st_objs. Use it for libgcc.a.
+	* config/rs6000/t-ppccomm (LIB2FUNCS_STATIC_EXTRA): New macro.
+
 2001-04-09  Bo Thorsen  <bo@suse.co.uk>
 
 	* config/i386/i386.md: "TARGET_64BIT && TARGET_64BIT": Removed one.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d405353278b1..48cac08d5879 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -446,10 +446,14 @@ USE_COLLECT2 = collect2$(exeext)
 # Assembler files should have names ending in `.asm'.
 LIB1FUNCS_EXTRA =
 
-# List of extra C and assembler files to add to libgcc2.a.
+# List of extra C and assembler files to add to static and shared libgcc2.
 # Assembler files should have names ending in `.asm'.
 LIB2FUNCS_EXTRA =
 
+# List of extra C and assembler files to add to static libgcc2.
+# Assembler files should have names ending in `.asm'.
+LIB2FUNCS_STATIC_EXTRA =
+
 # Handle cpp installation.
 INSTALL_CPP=
 UNINSTALL_CPP=
@@ -1034,8 +1038,9 @@ xlimits.h: glimits.h limitx.h limity.h
 # Build libgcc.a.
 
 LIB2ADD = $(LIB2FUNCS_EXTRA)
+LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
 
-libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) xgcc$(exeext)
+libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) $(LIB2ADD_ST) xgcc$(exeext)
 	objext='$(objext)' \
 	OLDCC='$(OLDCC)' \
 	LIBGCC1='$(LIBGCC1)' \
@@ -1044,6 +1049,7 @@ libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) xgcc$(exeext)
 	LIB1FUNCS_EXTRA='$(LIB1FUNCS_EXTRA)' \
 	LIB2FUNCS='$(LIB2FUNCS)' \
 	LIB2ADD='$(LIB2ADD)' \
+	LIB2ADD_ST='$(LIB2ADD_ST)' \
 	LIB2ADDEH='$(LIB2ADDEH)' \
 	LIB2ADDEHDEP='$(LIB2ADDEHDEP)' \
 	FPBIT='$(FPBIT)' \
@@ -1066,8 +1072,8 @@ libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) xgcc$(exeext)
 LIBGCC_DEPS = $(GCC_PASSES) $(LANGUAGES) stmp-int-hdrs $(STMP_FIXPROTO) \
 	libgcc.mk $(srcdir)/libgcc1.c $(srcdir)/libgcc2.c $(TCONFIG_H) \
 	$(MACHMODE_H) longlong.h gbl-ctors.h config.status stmp-int-hdrs \
-	tsystem.h $(FPBIT) $(DPBIT) $(LIB2ADD) $(LIB2ADDEH) $(LIB2ADDEHDEP) \
-	$(EXTRA_PARTS)
+	tsystem.h $(FPBIT) $(DPBIT) $(LIB2ADD) $(LIB2ADD_ST) $(LIB2ADDEH) \
+	$(LIB2ADDEHDEP) $(EXTRA_PARTS)
 
 libgcc.a: $(LIBGCC_DEPS)
 	$(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
diff --git a/gcc/config/rs6000/t-ppccomm b/gcc/config/rs6000/t-ppccomm
index 3a1f106ad217..7d500c368942 100644
--- a/gcc/config/rs6000/t-ppccomm
+++ b/gcc/config/rs6000/t-ppccomm
@@ -6,7 +6,10 @@ CROSS_LIBGCC1 =
 
 # These are really part of libgcc1, but this will cause them to be
 # built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = eabi.S tramp.S
+LIB2FUNCS_EXTRA = tramp.S
+
+# This one can't end up in shared libgcc
+LIB2FUNCS_STATIC_EXTRA = eabi.S
 
 # We want fine grained libraries, so use the new code to build the
 # floating point emulation libraries.
diff --git a/gcc/mklibgcc.in b/gcc/mklibgcc.in
index 70fc55aa53c2..6034867136fe 100644
--- a/gcc/mklibgcc.in
+++ b/gcc/mklibgcc.in
@@ -15,6 +15,7 @@
 # LIB1FUNCS_EXTRA
 # LIB2FUNCS
 # LIB2ADD
+# LIB2ADD_ST 
 # LIB2ADDEH
 # LIB2ADDEHDEP
 # FPBIT
@@ -247,6 +248,26 @@ for file in $LIB2ADDEH; do
   libgcc2_objs="$libgcc2_objs ${oname}${objext}"
 done
 
+libgcc2_st_objs=""
+
+for file in $LIB2ADD_ST; do
+  name=`echo $file | sed -e 's/[.][cSo]$//' -e 's/[.]asm$//' -e 's/[.]txt$//'`
+  oname=`echo $name | sed -e 's,.*/,,'`
+
+  for ml in $MULTILIBS; do
+    dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+    flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
+    out="libgcc/${dir}/${oname}${objext}"
+    if [ ${name}.asm = ${file} ]; then
+      flags="$flags -xassembler-with-cpp"
+    fi
+
+    echo $out: stmp-dirs $file
+    echo "	$gcc_compile" $flags -c $file -o $out
+  done
+  libgcc2_st_objs="$libgcc2_st_objs ${oname}${objext}"
+done
+
 # SHLIB_MKMAP
 # SHLIB_MAPFILES
 for ml in $MULTILIBS; do
@@ -266,6 +287,11 @@ for ml in $MULTILIBS; do
   done
   shlib_deps="$libgcc_objs"
 
+  libgcc_st_objs=""
+  for o in $libgcc2_st_objs; do
+    libgcc_st_objs="$libgcc_st_objs libgcc/${dir}/$o"
+  done
+
   if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" -a -z "$mapfile" ]; then
     mapfile="libgcc.map"
     echo ""
@@ -282,9 +308,9 @@ for ml in $MULTILIBS; do
   done
 
   echo ""
-  echo "${dir}/libgcc.a: $libgcc_objs"
+  echo "${dir}/libgcc.a: $libgcc_objs $libgcc_st_objs"
   echo "	-rm -rf ${dir}/libgcc.a"
-  echo '	$(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_objs
+  echo '	$(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_objs $libgcc_st_objs
   echo '	if $(RANLIB_TEST_FOR_TARGET) ; then' \\
   echo '	  $(RANLIB_FOR_TARGET)' ${dir}/libgcc.a ';' \\
   echo '	else true; fi;'
-- 
GitLab