Date: Thu, 22 Apr 2004 10:24:02 -0700 From: Peter Wemm <peter@wemm.org> To: netch@lucky.net Cc: amd64@freebsd.org Subject: Re: va_list q Message-ID: <200404221024.02535.peter@wemm.org> In-Reply-To: <20040422082455.GV34647@lucky.net> References: <20040422050128.GQ34647@lucky.net> <200404212258.01563.peter@wemm.org> <20040422082455.GV34647@lucky.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 22 April 2004 01:24 am, Valentin Nechayev wrote: > Wed, Apr 21, 2004 at 22:58:01, peter wrote about "Re: va_list q": > > amd64 needs to use the same code that is in the #ifdef __powerpc__. > > Its what we use in src/usr.sbin/pppd FWIW. > > Thanks, I couldn't find vfmtmsg() and thought it was introduced > after. > > > On powerpc and amd64, the argument passing ABI is so complicated > > that the sequence counters can't be fit in the spare bits in a > > pointer like on the other platforms. So on those two (and some > > other) platforms, gcc implements va_list as a pointer to an > > external structure. > > > > As an aside, this breaks code that assums it can copy va_lists by > > assignment. On powerpc and amd64, you *must* use va_copy(), or you > > simply copy the pointer, not the actual argument passing state. > > I'll copy hack from system sources. But is it better to use > va_copy()? You can't use va_copy here. The problem is what type do you give to va_arg() to pull a va_list off a va_list. gcc is inconsistent with this. But if this was copying args, you'd have to use va_copy. But it isn't. :-) > > -netch- -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404221024.02535.peter>