[RFA:] mklibgcc.in: libgcc1-multi.a to build libgcc1.a from C with extra flags.

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Mon Nov 6 16:07:00 GMT 2000


Here's a patch as indicated in
<URL: http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00261.html >,
to build libgcc1.a from C (other than from libgcc1.c, duh) with
additional flags to those in TARGET_LIBGCC2_CFLAGS.  Optionally,
there can be assembly files, making libgcc1-multi.a a superset
of the libgcc1-asm.a target.

Some targets build the functions in libgcc1 as part of libgcc2,
so you can have those functions as C, but if you need extra
flags for the libgcc1 functions that's not possible.

Generating libgcc.mk at configure-time is not yet possible,
because many of the needed variables are only available in each
target makefile fragment.  Longer term, it would IMHO be
desirable to delegate part of libgcc.a building to the target
makefile fragment as it used to be.  Support for doing this by
way of a recursive call of the main makefile from libgcc.mk, was
recently removed as considered undesirable; see thread at URL
above.

Bootstrapped on i686-pc-linux-gnu.

Ok to commit?

	* mklibgcc.in: Name LIB1CFUNCS as used variable for mklibgcc
	generation.
	<case X"$LIBGCC1"> (Xlibgcc1-multi.a): New case.
	<building $libgcc_objs>: Also check for LIBGCC1 = libgcc1-multi.a.

	* Makefile.in (libgcc.mk): Pass variable LIB1CFUNCS.
	(libgcc.a): Pass variables LIB1CSRC, LIB1FLAGS_EXTRA.
	(stmp-multilib): Ditto.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Makefile.in,v
retrieving revision 1.535
diff -c -p -r1.535 Makefile.in
*** Makefile.in	2000/11/05 10:35:30	1.535
--- Makefile.in	2000/11/06 21:41:05
*************** libgcc.mk: config.status Makefile mklibg
*** 995,1000 ****
--- 996,1002 ----
  	OLDCC='$(OLDCC)' \
  	LIBGCC1='$(LIBGCC1)' \
  	LIB1FUNCS='$(LIB1FUNCS)' \
+ 	LIB1CFUNCS='$(LIB1CFUNCS)' \
  	LIB1ASMFUNCS='$(LIB1ASMFUNCS)' \
  	LIB1FUNCS_EXTRA='$(LIB1FUNCS_EXTRA)' \
  	LIB2FUNCS='$(LIB2FUNCS)' \
*************** libgcc.a: $(LIBGCC_DEPS)
*** 1035,1041 ****
  	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
  	  INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
  	  CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
! 	  LIB1ASMSRC='$(LIB1ASMSRC)' \
  	  -f libgcc.mk all
  
  # Use the genmultilib shell script to generate the information the gcc
--- 1037,1044 ----
  	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
  	  INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
  	  CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
! 	  LIB1ASMSRC='$(LIB1ASMSRC)' LIB1CSRC='$(LIB1CSRC)' \
! 	  LIB1FLAGS_EXTRA='$(LIB1FLAGS_EXTRA)' \
  	  -f libgcc.mk all
  
  # Use the genmultilib shell script to generate the information the gcc
*************** stmp-multilib: $(LIBGCC_DEPS)
*** 1068,1074 ****
  	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
  	  INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
  	  CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
! 	  LIB1ASMSRC='$(LIB1ASMSRC)' \
  	  -f libgcc.mk all
  	touch stmp-multilib
  
--- 1071,1078 ----
  	  LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
  	  INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
  	  CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
! 	  LIB1ASMSRC='$(LIB1ASMSRC)' LIB1CSRC='$(LIB1CSRC)' \
! 	  LIB1FLAGS_EXTRA='$(LIB1FLAGS_EXTRA)' \
  	  -f libgcc.mk all
  	touch stmp-multilib
  
Index: mklibgcc.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/mklibgcc.in,v
retrieving revision 1.21
diff -c -p -r1.21 mklibgcc.in
*** mklibgcc.in	2000/10/21 01:47:05	1.21
--- mklibgcc.in	2000/11/06 21:41:05
***************
*** 11,16 ****
--- 11,17 ----
  # OLDCC
  # LIBGCC1
  # LIB1FUNCS
+ # LIB1CFUNCS
  # LIB1ASMFUNCS
  # LIB1FUNCS_EXTRA
  # LIB2FUNCS
*************** case X"$LIBGCC1" in
*** 118,123 ****
--- 119,157 ----
      done
      ;;
  
+   Xlibgcc1-multi.a)
+     for name in $LIB1ASMFUNCS; do
+       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}/${name}${objext}"
+ 
+         echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1ASMSRC)'
+ 	echo "	$gcc_compile" $flags -DL$name -xassembler-with-cpp \
+ 	  -c '$(srcdir)/config/$(LIB1ASMSRC)' -o $out
+ 
+ 	# Remove any objects from LIB2FUNCS that are defined as optimized
+ 	# assembly code in LIB1ASMFUNCS.
+ 	LIB2FUNCS=`echo $LIB2FUNCS | sed -e 's/^'$name' //' \
+ 				         -e 's/ '$name' / /' \
+ 					 -e 's/ '$name'$//'`
+       done
+       libgcc1_objs="$libgcc1_objs ${name}${objext}"
+     done
+     for name in $LIB1CFUNCS; do
+       for ml in $MULTILIBS; do
+         dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'`
+         flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`;
+        cvs diff: shutting down buffer from server: No such file or directory
 out="libgcc/${dir}/${name}${objext}"
+ 
+         echo ${out}: stmp-dirs '$(srcdir)/config/$(LIB1CSRC)'
+         echo "	$gcc_compile" $flags '$(LIB1FLAGS_EXTRA)' -DL$name \
+ 	  -c '$(srcdir)/config/$(LIB1CSRC)' -o $out
+       done
+       libgcc1_objs="$libgcc1_objs ${name}${objext}"
+     done
+     ;;
+ 
    Xlibgcc1.a)
      for name in $LIB1FUNCS; do
        out="libgcc/${name}${objext}"
*************** for ml in $MULTILIBS; do
*** 248,254 ****
  
    libgcc_objs=""
    for o in $libgcc1_objs; do
!     if [ "$LIBGCC1" = libgcc1-asm.a ]; then
        libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
      else
        libgcc_objs="$libgcc_objs libgcc/$o"
--- 282,289 ----
  
    libgcc_objs=""
    for o in $libgcc1_objs; do
!     if [ "$LIBGCC1" = libgcc1-asm.a ] \
!        || [ "$LIBGCC1" = libgcc1-multi.a ]; then
        libgcc_objs="$libgcc_objs libgcc/${dir}/$o"
      else
        libgcc_objs="$libgcc_objs libgcc/$o"

brgds, H-P


More information about the Gcc-patches mailing list