Date: Mon, 7 Apr 2003 17:33:32 -0700 From: Kris Kennaway <kris@obsecurity.org> To: Thomas Moestl <tmoestl@gmx.net> Cc: Kris Kennaway <kris@obsecurity.org> Subject: Re: assembler error in XFree86 snapshot Message-ID: <20030408003332.GA60864@rot13.obsecurity.org> In-Reply-To: <20030116201728.GA279@crow.dom2ip.de> References: <20030116072448.GA29468@rot13.obsecurity.org> <20030116201728.GA279@crow.dom2ip.de>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Thu, Jan 16, 2003 at 09:17:28PM +0100, Thomas Moestl wrote:
> On Wed, 2003/01/15 at 23:24:48 -0800, Kris Kennaway wrote:
> > I'm trying to compile anholt's XFree86 4.2.99 snapshot on sparc, and I
> > get the following error message:
> >
> > cc -c -O -pipe -ansi -Dasm=__asm -Wall -Wpointer-arith -Wundef -I/usr/tmp/XFree86-4-libraries-devel/work/xc -I/usr/tmp/XFree86-4-libraries-devel/work/xc/exports/include -DCSRG_BASED -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS -D_REENTRANT -D_THREAD_SAFE -DXUSE_MTSAFE_API -DXNO_MTSAFE_PWDAPI -DMALLOC_0_RETURNS_NULL XRes.c
> > {standard input}: Assembler messages:
> > {standard input}:667: Error: relocation overflow
> > *** Error code 1
> >
> > line 667 of the .s file is:
> >
> > > .LL86:
> > > umul %o0, 4294967295, %o0
>
> This is a arguably a gcc bug. All (13-bit) immediate operands are
> sign-extended, even those to instructions which operate on unsigned
> values, so umul can handle a range of very small and a range of very
> large operands. gcc correctly recognizes that it can use an immediate
> here; however, it chooses to output it as an unsigned number and does
> not sign-extended it from 32 to 64 bit.
>
> All sign extensions for instructions are made to the full 64 bit
> however (even if umul only happens to use 32 of those), so when the
> assembler checks whether a value is representable as an immediate, it
> will check that the 64-bit sign extension of the immediate creates
> the desired value (in sparc64 mode), i.e. it doesn't ignore the upper
> 32 bits even if a particular instruction does not use them.
>
> One solution is to generate negative literals for immediates if we
> mean them to be sign-extended (which gcc does already for some other
> instructions). The attached patch implements this, I'm not sure it
> uses the best possible way to do this though, and it also needs a bit
> more testing.
*Ping*
Someone needs to take this up with the gcc developers so it can get fixed.
Kris
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)
iD8DBQE+khjcWry0BWjoQKURAkG+AJ0aa51sc3HiTPfohFaRpMby+5yJvACfXz7g
FZGA+ClAjIP2M/dQw+scez0=
=Znq6
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030408003332.GA60864>
