gcc include strangeness
Hi,
i just stumbled when i tried to compile a program (bootloader) with gcc which uses varargs. I got the error that "sgidefs.h" was missing. sgidefs.h is contained in the glibc which gets included by va-mips.h from stdarg.h - I dont think this is correct as i should be able to compile programs without glibc.
Shouldnt sgidefs.h or its content be included in the gcc ?
Flo
Signature · 2 lines
Florian Lohoff [email protected] +49-5201-669912 Nine nineth on september the 9th Welcome to the new billenium
Quoted 5 lines · Florian Lohoff
i just stumbled when i tried to compile a program (bootloader) with gcc which uses varargs. I got the error that "
sgidefs.h" was missing.sgidefs.his contained in the glibc which gets included byva-mips.hfromstdarg.h- I dont think this is correct as i should be able to compile programs without glibc.
Hmm, in 2.95.3 in va-mips.h I see:
/* Get definitions for _MIPS_SIM_ABI64 etc. */
#ifdef _MIPS_SIM
#include <sgidefs.h>
#endif
so you shouldn't need sgidefs.h normally. Or did something get broken for 3.x?
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 10 lines · Maciej W. Rozycki
Quoted 5 lines · Florian Lohoff
i just stumbled when i tried to compile a program (bootloader) with gcc which uses varargs. I got the error that "
sgidefs.h" was missing.sgidefs.his contained in the glibc which gets included byva-mips.hfromstdarg.h- I dont think this is correct as i should be able to compile programs without glibc.Hmm, in 2.95.3 in
va-mips.hI see:
Quoted 7 lines
/* Get definitions for
_MIPS_SIM_ABI64etc. */
#ifdef_MIPS_SIM
#include <sgidefs.h>
#endifso you shouldn't need
sgidefs.hnormally. Or did something get broken for 3.x?
revamp:/tmp/arcboot-0.2# make
cd arclib; make all
make[1]: Entering directory `/tmp/arcboot-0.2/arclib'
cc -O -Werror -Wall -mno-abicalls -G 0 -fno-pic -c -o arc.o arc.c
cc -O -Werror -Wall -mno-abicalls -G 0 -fno-pic -c -o stdio.o stdio.c
In file included from
/usr/lib/gcc-lib/mips-linux/2.95.4/include/stdarg.h:27,
from stdio.h:8,
from stdio.c:7:
/usr/lib/gcc-lib/mips-linux/2.95.4/include/va-mips.h:89: sgidefs.h: No
such file or directory
make[1]: *** [stdio.o] Error 1
make[1]: Leaving directory `/tmp/arcboot-0.2/arclib'
make: *** [all] Error 2revamp:/tmp/arcboot-0.2# gcc -v Reading specs from /usr/lib/gcc-lib/mips-linux/2.95.4/specs gcc version 2.95.4 20011002 (Debian prerelease)
revamp:/tmp/arcboot-0.2# vi /usr/lib/gcc-lib/mips-linux/2.95.4/include/va-mips.h
[...]
87 /* Get definitions for _MIPS_SIM_ABI64 etc. */
88 #ifdef _MIPS_SIM
89 #include <sgidefs.h>
90 #endif
[...]I just saw it - I cant explain it ...
Flo
Signature · 2 lines
Florian Lohoff [email protected] +49-5201-669912 Nine nineth on september the 9th Welcome to the new billenium
Quoted 1 line · Florian Lohoff
I just saw it - I cant explain it ...
Hmm, it's "subtarget_cpp_spec" in gcc's specs that defines _MIPS_SIM. It
seems <sgidefs.h> should be a part of gcc indeed. It would let avoiding including the weird asm-mips/gcc/sgidefs.h header for the kernel as well.
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 8 lines · Florian Lohoff
Quoted 7 lines · Maciej W. Rozycki
Quoted 5 lines · Florian Lohoff
i just stumbled when i tried to compile a program (bootloader) with gcc which uses varargs. I got the error that "
sgidefs.h" was missing.sgidefs.his contained in the glibc which gets included byva-mips.hfromstdarg.h- I dont think this is correct as i should be able to compile programs without glibc.
The glibc-2.2.5/FAQ says:
1.20. Which tools should I use for MIPS?
{AJ} You should use the current development version of gcc 3.0 or newer from CVS. gcc 2.95.x does not work correctly on mips-linux.
I'm not shure if this only applies to glibc, but the gcc-2.95.x I tried to build could not even compile a kernel because of:
#ifndef __linux__
#error Use a Linux compiler or give up.
#endif
in linux/include/asm-mips/sgidefs.h. The gcc-3.0.3 I now use has a totally different set of predefines than gcc-2.95.x, and it seems to work.
Quoted 9 lines
Quoted 9 lines
Hmm, in 2.95.3 in
va-mips.hI see:/* Get definitions for
_MIPS_SIM_ABI64etc. */
#ifdef_MIPS_SIM
#include <sgidefs.h>
#endifso you shouldn't need
sgidefs.hnormally. Or did something get broken for 3.x?
sgidefs.h comes from the kernel includes.
gcc-3.x does not use va-mips.h or sgidefs,h, but simply has the following in stdarg.h:
#define va_start(v,l) __builtin_stdarg_start((v),l) #define va_end __builtin_va_end #define va_arg __builtin_va_arg
etc.
Regards,
Johannes
Quoted 5 lines · Johannes Stezenbach
The glibc-2.2.5/FAQ says:
1.20. Which tools should I use for MIPS?{AJ} You should use the current development version of gcc 3.0 or newer from CVS. gcc 2.95.x does not work correctly on mips-linux.
Is gcc 3.x already stable enough to be used by people not directly
involved in gcc development? More specifically for MIPS/Linux and i386/Linux, for both the kernel and the userland? I'm told it is not.
Quoted 9 lines
I'm not shure if this only applies to glibc, but the gcc-2.95.x I tried to build could not even compile a kernel because of:
#ifndef__linux__
#error Use a Linux compiler or give up.
#endif
inlinux/include/asm-mips/sgidefs.h. The gcc-3.0.3 I now use has a totally different set of predefines than gcc-2.95.x, and it seems to work.
Gcc 2.95.x as distributed certainly doesn't work. With a set of patches
it appears rock solid. For MIPS/Linux I'm using it for over two years for both the kernel and the userland. The last time I found bug and needed to apply a fix to gcc 2.95.3 for MIPS/Linux was in April 2001.
With gcc 2.95.3 if I spot a weird behaviour, I'm pretty confident it's a
bug in the kernel or in user code, and not the compiler generating bad code.
Quoted 6 lines
gcc-3.x does not use
va-mips.hor sgidefs,h, but simply has the following instdarg.h:#define va_start(v,l) __builtin_stdarg_start((v),l) #define va_end __builtin_va_end #define va_arg __builtin_va_argetc.
Thanks for the info.
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 4 lines · Maciej W. Rozycki
Is gcc 3.x already stable enough to be used by people not directly
involved in gcc development? More specifically for MIPS/Linux and i386/Linux, for both the kernel and the userland? I'm told it is not.
I'm reading about gcc 3.x code generation bugs every now and then, but so far I did not hit any of them.
I would prefer gcc 2.95.x though, if I only could get it to work on MIPS.
Quoted 4 lines
Gcc 2.95.x as distributed certainly doesn't work. With a set of patches
it appears rock solid. For MIPS/Linux I'm using it for over two years for both the kernel and the userland. The last time I found bug and needed to apply a fix to gcc 2.95.3 for MIPS/Linux was in April 2001.
I would certainly be interested in getting my hands on those patches. Do you mind if I ask why they did not go into gcc-2_95-branch CVS?
Regards,
Johannes
Quoted 3 lines · Johannes Stezenbach
I would certainly be interested in getting my hands on those patches. Do you mind if I ask why they did not go into gcc-2_95-branch CVS?
RPM packages are available at my site --
"ftp://ftp.ds2.pg.gda.pl/pub/macro/". They used to be recommended tools for glibc 2.2 for MIPS/Linux before gcc 3.0 was released.
As to why they did not go into the CVS? Well, I wasn't aware gcc 2.95.x
was maintained until after 2.95.3 was released (but patches that were relevant either went in to 2.96 or were rejected). And now we have 3.x.
If 2.95.x is still maintained and you feel the patches would be useful
for inclusion, feel free to commit them. The change log in the spec file contains descriptions of the purpose of every patch.
Maciej
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 6 lines · Johannes Stezenbach
Quoted 3 lines
Is gcc 3.x already stable enough to be used by people not directly
involved in gcc development? More specifically for MIPS/Linux and i386/Linux, for both the kernel and the userland? I'm told it is not.I'm reading about gcc 3.x code generation bugs every now and then, but so far I did not hit any of them.
I've fixed several kernel bugs that got triggered by building with 3.0. We've got an a piece of inline assembler where a constraint gets ignored by 3.0 resulting in bad code. Add slow compilation and slow code. 3.0? No way. Yet.
Ralf
I've been keeping quiet through all this, but perhaps I should speak up.
Algorithmics maintains a GNU toolchain for embedded systems and supplies it bundled with support and a basic run-time system as our product SDE-MIPS.
From version 5.0 (just gone into beta) we are configuring and testing the compiler/assembler/object tools for Linux use. We always publish the GNU sources used to build SDE-MIPS on our web-site, but we are currently leaning towards going further and putting binary RPMs of the Linux toolchain out for free download - so those of you who want can just use it.
The upside of this is that we have the resource and skill (and it looks like we'll be able to get enough support/development funding) to maintain a Linux/MIPS compiler. It would be a good thing for the Linux/MIPS community if compiler bugs and shortcomings got fixed on a fairly stable base, instead of relying on pick-your-version folklore. We should also be able to get funding to do things like fixing support for SGI n32/n64 code-generation conventions.
Our compiler already has support for pretty much every wrinkle of any MIPS instruction set anywhere, and command-line-selectable machine descriptions for many different MIPS pipelines.
The downside: our development process is not currently very Linux-shaped. We "release late, release rarely". In providing a stable compiler for embedded use we have found it easier to avoid the bleeding edge of GCC. We've found it necessary to make bold changes in "machine-independent" code - GCC is a wonderful multi-target compiler, but it's x86 (PPC a distant second) which is routinely tested. The leading edge is a fertile breeding ground of bugs for minor architectures.
And more: our v5.0 compiler's ancestor was a 2.96 release from Cygnus' internal development tree, provided to MIPS Technologies in the fall of 2000. We picked it up because it had work MIPS had already funded, and some valuable multiple-issue machine description features which didn't make it into 3.0. But it has taken a long time to make sure the new compiler is as well-tuned and reliable as the EGCS 1.1-based compiler it replaced, and the 2.96-derived compiler is only now shipping as part of a beta release.
So now we have numerous patches, many of them not in officially "MIPS machine-dependent" code, against an 18-months old and slightly strange version of GCC. Nobody is currently doing the substantial work to turn our changes into patches for GCC 3.x.
What I think we ought to do is to:
o Release the existing compiler for use among Linux/MIPS enthusiasts (we're hoping that some commercial developers will take support contracts, of course);
o Hope that many of you will use it and feed back bug reports, and that some of you will grab the sources and help track & fix them;
o Aim to make earlier and more frequent releases for adventurous Linux users (we will keep a slow-moving 'stable' release for those whose priority is elsewhere);
o Aim over the next couple of years - and with all the help we can get
- to converge closer to the evolving GCC 3.x mainstream.
I guess the question for this list is: is anyone interested?
--
Dominic Sweetman
Algorithmics Ltd
The Fruit Farm, Ely Road, Chittering, CAMBS CB5 9PH, ENGLAND phone +44 1223 706200/fax +44 1223 706250/direct +44 1223 706205
http://www.algor.co.uk
Quoted 3 lines
I guess the question for this list is: is anyone interested?
Yes.
/Brian
Quoted 2 lines
I guess the question for this list is: is anyone interested?
Hai!
(yes)
-Tim
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
Quoted 3 lines · Maciej W. Rozycki
Is gcc 3.x already stable enough to be used by people not directly
involved in gcc development? More specifically for MIPS/Linux and i386/Linux, for both the kernel and the userland? I'm told it is not.
From the reports I'm gathering that we should ignore 3.0 and directly go for 3.1.
Ralf
Quoted 7 lines · Johannes Stezenbach
The glibc-2.2.5/FAQ says:
1.20. Which tools should I use for MIPS?{AJ} You should use the current development version of gcc 3.0 or newer from CVS. gcc 2.95.x does not work correctly on mips-linux.
Its not about gcc development but rather keeping a distribution in sync. All Debian archs try to use the same compiler which is currently 2.95.4 which we are happy with right now - Except some minor issues breaking 2-3 Packages ...
Flo
Signature · 2 lines
Florian Lohoff [email protected] +49-5201-669912 Nine nineth on september the 9th Welcome to the new billenium
Quoted 5 lines · Florian Lohoff
Quoted 4 lines · Johannes Stezenbach
The glibc-2.2.5/FAQ says:
1.20. Which tools should I use for MIPS?
Quoted 8 lines
Quoted 3 lines
{AJ} You should use the current development version of gcc 3.0 or newer from CVS. gcc 2.95.x does not work correctly on mips-linux.
Its not about gcc development but rather keeping a distribution in sync. All Debian archs try to use the same compiler which is currently 2.95.4 which we are happy with right now - Except some minor issues breaking 2-3 Packages ...
So does this mean that Debian's gcc 2.95.4 works on MIPS? Does it include patches which are not in CVS (gcc-2_95-branch)?
Regards,
Johannes
Quoted 10 lines · Johannes Stezenbach
Quoted 9 lines · Florian Lohoff
Quoted 7 lines · Johannes Stezenbach
The glibc-2.2.5/FAQ says:
1.20. Which tools should I use for MIPS?{AJ} You should use the current development version of gcc 3.0 or newer from CVS. gcc 2.95.x does not work correctly on mips-linux.
Quoted 6 lines
Quoted 4 lines
Its not about gcc development but rather keeping a distribution in sync. All Debian archs try to use the same compiler which is currently 2.95.4 which we are happy with right now - Except some minor issues breaking 2-3 Packages ...
So does this mean that Debian's gcc 2.95.4 works on MIPS?
The whole distribution is compiled with 2.95.4.
Quoted 1 line
Does it include patches which are not in CVS (gcc-2_95-branch)?
Yes. See the debian/patches directory after unpacking the source-package.
-- Guido
Quoted 8 lines · Maciej W. Rozycki
Quoted 5 lines
i just stumbled when i tried to compile a program (bootloader) with gcc which uses varargs. I got the error that "
sgidefs.h" was missing.sgidefs.his contained in the glibc which gets included byva-mips.hfromstdarg.h- I dont think this is correct as i should be able to compile programs without glibc.Hmm, in 2.95.3 in
va-mips.hI see:
Quoted 7 lines
/* Get definitions for
_MIPS_SIM_ABI64etc. */
#ifdef_MIPS_SIM
#include <sgidefs.h>
#endifso you shouldn't need
sgidefs.hnormally. Or did something get broken for 3.x?
Gcc is supposed to define _MIPS_SIM.
Ralf
Quoted 7 lines · Florian Lohoff
i just stumbled when i tried to compile a program (bootloader) with gcc which uses varargs. I got the error that "
sgidefs.h" was missing.sgidefs.his contained in the glibc which gets included byva-mips.hfromstdarg.h- I dont think this is correct as i should be able to compile programs without glibc.Shouldnt
sgidefs.hor its content be included in the gcc ?
There should be a copy of sgidefs.h in /usr/include rsp. for crosscompilers in <prefix>/<target>/include/sgidefs.h. However the gcc varargs stuff has been rewritten completely; the new implementation does no longer try to include sgidefs.h.
Ralf
Quoted 4 lines · Ralf Baechle
Quoted 1 line
Shouldnt
sgidefs.hor its content be included in the gcc ?There should be a copy of
sgidefs.hin/usr/includersp. for crosscompilers in <prefix>/<target>/include/sgidefs.h. However the gcc varargs stuff
That file is part of libc, not gcc. OTOH, gcc when configured for
"mipsel-linux" is allowed to assume glibc is available. So there is no need to migrate the file after all.
Quoted 2 lines
has been rewritten completely; the new implementation does no longer try to include
sgidefs.h.
That's fine but for 2.95.x the issue exists.
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +