Thread: Linux/mips compile should not use -mips2

Linux/mips compile should not use -mips2

From
Oliver Elphick
Date:
I sent a message about this yesterday, but it does not appear to have
got to the list.

According to the attached message, mips builds for Linux should not use
-mips2 in the compilation or linking.  It appears that this can be
prevented by removing the mips special case from src/template/linux.

-----Forwarded Message-----

From: rmurray@debian.org
To: Oliver Elphick <olly@lfix.co.uk>
Subject: Re: [Fwd: Mail delivery failed: returning message to sender]
Date: 20 Mar 2002 07:48:38 -0800

On Wed, Mar 20, 2002 at 09:52:52AM +0000, Oliver Elphick wrote:
> > Upstream automatically passes -mips2 to gcc on mips platforms.  In the case
> > of Linux, this should not be done, as the main reason to use it (ll/sc) is
> > handled by glibc and emulated by the kernel.  It also makes all of postgresql
> > unusable on DECstation mipsel machines,...
> 
> The build failure appears to be that
> debian/tmp/usr/lib/postgresql/bin/postgres has somehow been deleted
> during the build.  (The build log shows it being installed correctly.) 
> Are you saying that this is related to use of -mips2, or is that a
> totally separate problem?

No, the kernel doesn't always have the greatest error messages...

test.c:
main(void)
{       return 1;
}

rmurray@resume:~$ gcc -o t test.c ; ls -l t ; ./t
-rwxr-xr-x    1 rmurray  rmurray      7628 Mar 20 16:43 t
rmurray@resume:~$ gcc -mips2 -o t test.c ; ls -l t ; ./t
-rwxr-xr-x    1 rmurray  rmurray      7628 Mar 20 16:44 t
bash: ./t: No such file or directory

The reason this worked in the past is due to a bug in binutils -- it wasn't
setting the mips2 bit in the elf header of the binary.  That bug has now
been fixed, and the kernel refuses to run anything with a mips# bit set
in the header, as it is used to indicate an irix binary, according to the
comments in elf.h.

-- 
Ryan Murray, Debian Developer (rmurray@cyberhqz.com, rmurray@debian.org)
The opinions expressed here are my own.



Re: Linux/mips compile should not use -mips2

From
Peter Eisentraut
Date:
Oliver Elphick writes:

> > > Upstream automatically passes -mips2 to gcc on mips platforms.  In the case
> > > of Linux, this should not be done, as the main reason to use it (ll/sc) is
> > > handled by glibc and emulated by the kernel.  It also makes all of postgresql
> > > unusable on DECstation mipsel machines,...

It's gone.  I never liked it there anyway.

-- 
Peter Eisentraut   peter_e@gmx.net