FWIW: VAX fix backport and gcc built on 4.3BSD first time ever!

Michael Sokolov msokolov@ivan.Harhan.ORG
Thu Dec 14 12:44:00 GMT 2000


Hi there,

I know you guys don't want this in the 2.95.3 release, but I thought I would
still post it for anybody who finds it useful. IMHO, this patch from the trunk
from a while ago:

: Wed Aug 25 01:36:11 1999  John David Anglin  <dave@hiauly1.hia.nrc.ca>
:
:         * calls.c (emit_call_1): Use call_pop/call_value_pop for all values
:         of n_popped when call/call_value are not defined.

really needs to be backported to the gcc-2_95-branch. Without this patch, gcc
is completely non-functional on any target that has only
call_pop/call_value_pop insns, but not call/call_value, being unable to
generate calls to functions with no arguments and ICEing on the first one
(which happens when building libgcc2). VAX is one such target, where the
function calling convention with automatic stack popping is intrinsically built
into the architecture. Below is a convenient patch for the gcc-2_95-branch. Do
whatever you want with it.

Note that with this patch, plus all my previous patches and one hack in my
local copy for a problem for which I couldn't find a publicly acceptable
solution (some auxiliary programs in gcc use strtol, which 4.3BSD doesn't have,
but don't use libiberty, which normally solves such problems), I have finally
been able to build a native gcc on 4.3BSD VAX UNIX for the first time ever!
This may very well be the first time gcc (any version) built natively on an
Original UNIX machine in all recent history. While it probably did build on
4.3BSD when RMS first wrote it, I won't even begin to guess when it last
worked. I'd guess before the start of EGCS, which is AFAIK where libiberty was
first introduced. When I fixed libiberty for 4.3BSD earlier this year, it was
completely broken and really looked like it had been that way since conception.

I have successfully built the gcc C compiler using the native cc, which is all
I need for myself right now. If there were interest, I could perfect it further
by making it bootstrap with all languages and solving the strtol problem
properly, but I probably won't do it for 2.95.3 given the attitude in Bernd's
last response on this subject.

--
Michael Sokolov
Public Service Agent
International Engineering and Science Task Force

1351 VINE AVE APT 27		Phone: +1-714-738-5409
FULLERTON CA 92833-4291 USA	(home office)

E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP)

Thu Dec 14 12:03:38 PST 2000  Michael Sokolov  <msokolov@ivan.Harhan.ORG>

	from HEAD:
	Wed Aug 25 01:36:11 1999  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* calls.c (emit_call_1): Use call_pop/call_value_pop for all values
	of n_popped when call/call_value are not defined.

Index: calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.57
diff -p -r1.57 calls.c
*** calls.c	1999/05/08 01:58:39	1.57
--- calls.c	2000/12/14 20:04:00
*************** emit_call_1 (funexp, fndecl, funtype, st
*** 405,411 ****
  
  #ifndef ACCUMULATE_OUTGOING_ARGS
  #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
!   if (HAVE_call_pop && HAVE_call_value_pop && n_popped > 0)
      {
        rtx n_pop = GEN_INT (n_popped);
        rtx pat;
--- 405,420 ----
  
  #ifndef ACCUMULATE_OUTGOING_ARGS
  #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
! /* If the target has "call" or "call_value" insns, then prefer them
!    if no arguments are actually popped.  If the target does not have
!    "call" or "call_value" insns, then we must use the popping versions
!    even if the call has no arguments to pop.  */
! #if defined (HAVE_call) && defined (HAVE_call_value)
!   if (HAVE_call && HAVE_call_value && HAVE_call_pop && HAVE_call_value_pop
!        && n_popped > 0)
! #else
!   if (HAVE_call_pop && HAVE_call_value_pop)
! #endif
      {
        rtx n_pop = GEN_INT (n_popped);
        rtx pat;


More information about the Gcc-patches mailing list