Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Dec 2002 10:40:33 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Tim Robbins <tjr@FreeBSD.ORG>
Cc:        Juli Mallett <jmallett@FreeBSD.ORG>, Joe Marcus Clarke <marcus@marcuscom.com>, <current@FreeBSD.ORG>
Subject:   Re: WEIRD! div() broken on -CURRENT?
Message-ID:  <20021222103405.A7492-100000@gamplex.bde.org>
In-Reply-To: <20021221162001.A17127@dilbert.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 21 Dec 2002, Tim Robbins wrote:

> On Fri, Dec 20, 2002 at 08:43:25PM -0800, Juli Mallett wrote:
>
> > * De: Tim Robbins <tjr@FreeBSD.ORG> [ Data: 2002-12-20 ]
> > 	[ Subjecte: Re: WEIRD! div() broken on -CURRENT? ]
> > > On Fri, Dec 20, 2002 at 09:24:39PM -0500, Joe Marcus Clarke wrote:
> > > > I'm doing something wrong, right?  I mean, this can't be right.  I've
> > > > verified this now on a P4 running:
> > > [...]
> > >
> > > I can reproduce it here. It looks like gcc is using a strange calling
> > > convention that the i386 div.S does not understand (MI div.c seems to, though).
> >
> > TenDRA and GCC3 use a different struct return format than we used to
> > use (see http://gcc.gnu.org/ml/gcc-patches/2002-01/msg01783.html) and
> > we never had a flag day for the old format, and there's no UPDATING or
> > whatnot notes about this AFAIK.  This means at least div has to change
> > to use the new calling convention.
> [...]
>
> I've imported the versions of div.S and ldiv.S from NetBSD HEAD which
> work properly with the new calling convention. Thanks for mentioning (on IRC)
> that the pcc struct return convention had something to do with it.

Did we really mean to change this?  It is a relatively recent change.  From
cvs history:

% RCS file: /home/ncvs/src/contrib/gcc/config/freebsd.h,v
% Working file: freebsd.h
% head: 1.37
% ...
% ----------------------------
% revision 1.37
% date: 2002/04/30 17:22:42;  author: obrien;  state: Exp;  lines: +34 -460
% MI bits for Gcc 3.1.
% ----------------------------

This contains mounds changes, one of which breaks 5-10 (?) years of binary
compatibility within gcc-compiled objects:

% Index: freebsd.h
% ===================================================================
% RCS file: /home/ncvs/src/contrib/gcc/config/freebsd.h,v
% retrieving revision 1.36
% retrieving revision 1.37
% diff -u -2 -r1.36 -r1.37
% --- freebsd.h	14 May 2001 22:45:26 -0000	1.36
% +++ freebsd.h	30 Apr 2002 17:22:42 -0000	1.37
% ...
% -/* Don't default to pcc-struct-return, because gcc is the only compiler, and
% -   we want to retain compatibility with older gcc versions
% -   (even though the SVR4 ABI for the i386 says that records and unions are
% -   returned in memory).  */
% -#undef  DEFAULT_PCC_STRUCT_RETURN
% -#define DEFAULT_PCC_STRUCT_RETURN 0

I think gcc didn't override its default of DEFAULT_PCC_STRUCT_RETURN = 1
on i386's meany years ago, since bcc uses this method of returning structs
and ISTR copying the gcc behaviour.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021222103405.A7492-100000>