This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
patch to enable using C alloca for CC=gcc
- To: egcs-bugs at cygnus dot com
- Subject: patch to enable using C alloca for CC=gcc
- From: Fred Fish <fnf at ninemoons dot com>
- Date: Fri, 5 Sep 1997 23:20:44 -0700 (MST)
I'm building gcc on a system that has limited stack space, so gcc's
automatic remapping of alloca to _builtin_alloca is disabled. This
means that when we define USE_C_ALLOCA in a configuration file, we
really mean it.
I don't believe this change will cause any ill effects for other
configurations that define USE_C_ALLOCA in the manner suggested in
gcc.texi:
#ifndef __GNUC__
#define USE_C_ALLOCA
#else
#define alloca __builtin_alloca
#endif
since in these cases, USE_C_ALLOCA will only be defined if compiling
with a non-gcc compiler, in which case alloca.c would have been
compiled anyway if ALLOCA is set to alloca.o. And since the
USE_ALLOCA and USE_HOST_ALLOCA could previously not be overridden, we
don't have to worry about any existing configurations defining them.
Ultimately I believe USE_C_ALLOCA should be replaced with a suitable
autoconf macro that defines C_ALLOCA and ALLOCA appropriately, as is
done in many other GNU packages.
-Fred
==================================================================
For ChangeLog:
Fri Sep 5 22:31:49 1997 Fred Fish <fnf@ninemoons.com>
* Makefile.in (USE_ALLOCA, USE_HOST_ALLOCA): Move to before
target/host overrides so they can be overridden when necessary.
* alloca.c: If USE_C_ALLOCA is defined, compile even when using gcc.
For cp/ChangeLog:
Fri Sep 5 22:35:24 1997 Fred Fish <fnf@ninemoons.com>
* Makefile.in (SUBDIR_USE_ALLOCA): Move to before target/host
overrides so it can be overridden when necessary.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/gg/egcs/gcc/Makefile.in,v
retrieving revision 1.2
diff -c -r1.2 Makefile.in
*** Makefile.in 1997/09/05 14:10:30 1.2
--- Makefile.in 1997/09/06 06:03:10
***************
*** 423,428 ****
--- 423,433 ----
# Extra flags to use when compiling [m]crt0.o.
CRT0STUFF_T_CFLAGS =
+ # Even if ALLOCA is set, don't use it if compiling with GCC, unless
+ # a configuration file overrides this default.
+ USE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo "${ALLOCA}" ;; esac `
+ USE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
+
# End of variables for you to override.
# Definition of `all' is here so that new rules inserted by sed
***************
*** 463,471 ****
# Likewise.
ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
- # Even if ALLOCA is set, don't use it if compiling with GCC.
- USE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo "${ALLOCA}" ;; esac `
- USE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
--- 468,473 ----
Index: alloca.c
===================================================================
RCS file: /cvsroot/gg/egcs/gcc/alloca.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 alloca.c
*** alloca.c 1997/09/04 04:43:35 1.1.1.1
--- alloca.c 1997/09/06 06:03:10
***************
*** 36,43 ****
#include "blockinput.h"
#endif
! /* If compiling with GCC 2, this file's not needed. */
! #if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
--- 36,43 ----
#include "blockinput.h"
#endif
! /* If compiling with GCC 2, this file's not needed, as long as USE_C_ALLOCA is not defined. */
! #if defined (USE_C_ALLOCA) || !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
Index: cp/Makefile.in
===================================================================
RCS file: /cvsroot/gg/egcs/gcc/cp/Makefile.in,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.in
*** Makefile.in 1997/09/04 04:44:11 1.1.1.1
--- Makefile.in 1997/09/06 06:03:20
***************
*** 99,104 ****
--- 99,108 ----
# system library.
OBSTACK=obstack.o
+ # Even if ALLOCA is set, don't use it if compiling with GCC, unless
+ # a configuration file overrides this default.
+ SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac`
+
# Choose the real default target.
ALL=all
***************
*** 130,139 ****
# Likewise.
ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
- # Even if ALLOCA is set, don't use it if compiling with GCC.
-
SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi`
- SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac`
SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi`
# How to link with both our special library facilities
--- 134,140 ----