Recommended compiler version
Quoted 5 lines · John B.
Quote from Adrian Bunk <[email protected]>:
Quoted 1 line
Whether support for gcc 2.95 should be dropped is a discussion for 2.7.
Is there any single 3.x.x version of GCC that's actively in use by a large number of core developers? How do we make a sensible recommendation if not?
As an aside, it seems like gcc-3.3.3 is pretty good.
There are some known problems with it, but the number is small. I haven't tried gcc-3.4.0 much yet, but I have seen a few kernel patches to fix issues 3.4.0 found in the kernel source.
I agree 2.6 should continue to support and compile correctly under gcc-2.95.3, even if that means working around compiler bugs. By the time linux-2.7 rolls around, I suspect nobody will mind if we drop 2.95.3 in favor of 3.4.x. It'll be interesting to see if newer gccs optimize the kernel better...
- Dan
Signature · 2 lines
My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change
Quoted 4 lines · Dan Kegel
As an aside, it seems like gcc-3.3.3 is pretty good.
There are some known problems with it, but the number is small. I haven't tried gcc-3.4.0 much yet, but I have seen a few kernel patches to fix issues 3.4.0 found in the kernel source.
I thought I'd drop in here while there's mention of the kernel and 3.4.0 to describe some recent experiences I've been having on that topic.
Here's some detilas of what I've been trying to get to work:
- hardware: Motorola MCP750 - Mesquite / PowerPC 750
- kernel: 2.4.18 patched with motorola patches for MCP750
- binutils: 2.15
- gcc: 3.4.0
- glibc: 2.3.2
First off, I was able to get the toolchain to build. Needed a few hacks, but nothing really major.
RANT: It's really about time that someone within the GNU project took it upon herself to actually get the GNU toolchain to build for cross-dev without having to require walking-on-water talents. Anyhow ...
I built the kernel with the toolchain, and here's what I got when trying to launch it from ppc-bug:
---------------------------------------------------------------
PPC1-Bug>nbo 0 0,,, zImage.prep
Network Booting from: DEC21140, Controller 0, Device 0 Device Name: /pci@80000000/pci1011,9@e,0:0,0
Loading: zImage.prep
Client IP Address = 192.168.12.3 Server IP Address = 192.168.12.8 Gateway IP Address = 0.0.0.0
Subnet IP Address Mask = 255.255.255.0
Boot File Name = zImage.prep
Argument File Name =
Network Boot File load in progress... To abort hit <BREAK>
Bytes Received =&1018969, Bytes Loaded =&1018969
Bytes/Second =&1018969, Elapsed Time =1 Second(s)
Residual-Data Located at: $07E88000 loaded at: 00005400 00019234 relocated to: 01000000 01013E34 board data at: 07E88000 07E8EA0C relocated to: 0100A14C 01010B58 zimage at: 0000F400 000FBC17 relocated to: 01014000 01100817 avail ram: 00400000 00800000
Linux/PPC load: console=ttyS0,9600cmd_line located > 16Mhold_residual located > 16M
Uncompressing Linux...done.
Now booting the kernel
vector: 300 at pc = 900108b4, lr = 901b847c
msr = 1032, sp = 9019dc80 [9019dbd0]
dar = 0, dsisr = 40000000
current = 9019bcd0, pid = 0, comm = swapper
mon>
---------------------------------------------------------------
[To even get the 2.4.18 kernel to build, I had to modify a few syscall clobber statements which the recent toolchain didn't like much. Peaked into 2.4.26's include/asm-ppc/unistd.h for some inspiration ;)]
To make a very long story short, I was able to actually get this kernel to start only if I commented out parse_options() and do_initcalls() in init/main.c. No need to say how ugly this is. Somehow, if I set cmd_line[0] = '\0' it actually went through parse options without any problem, but still died in do_initcalls. Yet, if I looped around and printed out the content of the command line, it was all OK:
{
int i;
for (i = 0; i < 256; i++)
if (command_line[i] != '\0')
printk("Command line entry %d is %c \n", i, command_line[i]);
else
printk("Command line entry %d is NULL \n");
}Feeling that this might be a problem with the 2.4.18 kernel I was using, I tried a variety of different kernels without the mot patch: 2.4.25-debian, 2.4.26-vanilla, 2.4.25-benh1, 2.6.6, etc. Nothing worked. At best, I got to the same spot as earlier.
[ BTW, the 2.6.6 kernel wouldn't build without the following modifications to the main makefile:
AS = $(CROSS_COMPILE)as -maltivec CFLAGS_KERNEL = -maltivec AFLAGS_KERNEL = -maltivec
For some reason 3.4.0 forgets to tell AS that this CPU may have Altivec instructions -- there are some postings about this if you google around.]
Finally, despite my reservations about what such a thing would really change, I decided to try gcc 3.3.2 and gcc 3.2.3. Surprisingly, this actually worked. The patched 2.4.18 above booted without any problem whatsoever. I tried a couple of other kernels as well, to see if they too would work. I noticed that some that actually failed as above (causing a fault very early at boot time), now didn't fail with 3.3.2, but printed nothing to the terminal and the system would eventually reboot -- as if console=ttyS0,9600 had no effect and the kernel panicked as expected because of the missing rootfs.
But I wanted to at least have another kernel than the mot 2.4.18 with gcc 3.3.2 working, so I went back to the kernel dated 2004/05/22 downloaded from http://www.ppckernel.org/kernel.php?id=26
-- it's actually a modified 2.4.26 -- and hacked the Makefile and misc.c files in arch/ppc/boot/prep directory to get it to build. Once I did this, I was actually able to get this one to build and boot successfully on the board with both gcc 3.3.2 and gcc 3.4.0. So there's at least one kernel I was able to get working with 3.4.0.
What's most frustrating is that I came away with not much more understanding as to why the same parse_options() and do_initcalls() would build without a warning on gcc 3.4.0 but would cause a fault at runtime, while building and running flawlessly with gcc 3.3.2 and gcc 3.2.3 ...
Karim
Signature · 3 lines
Author, Speaker, Developer, Consultant Pushing Embedded and Real-Time Linux Systems Beyond the Limits http://www.opersys.com || [email protected] || 1-866-677-4546
Quoted 3 lines · Karim Yaghmour
RANT: It's really about time that someone within the GNU project took it upon herself to actually get the GNU toolchain to build for cross-dev without having to require walking-on-water talents.
Quite. I'm heading up to the gcc summit next week to make that point (see also http://gcc.gnu.org/ml/gcc/2004-05/msg01417.html,
which rumors that Paolo Bonzini and Nathanael Nerode are working on detangling gcc bootstrap).
And I've been busting my ass for the last year maintaining the 'crosstool' script so people without walking-on-water talents can build the GNU toolchain for cross-development. (But before Karim objects to the concept of a canned build script, I hasten to add that I fully agree with him that the gnu toolchain build process shouldn't need such an ugly and fragile wrapper script around it.)
Quoted 8 lines
BTW, the 2.6.6 kernel wouldn't build without the following modifications to the main makefile:
AS = $(CROSS_COMPILE)as -maltivec CFLAGS_KERNEL = -maltivec AFLAGS_KERNEL = -maltivecFor some reason 3.4.0 forgets to tell AS that this CPU may have Altivec instructions -- there are some postings about this if you google around.
I think the issue is that binutils-2.15 started checking its input more strictly, in a way that broke several apps. Binutils cvs has the following patch which is said to relex the check:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/opcodes/ppc-opc.c.diff?r1=1.70&r2=1.71&cvsroot=src
That patch'll be in the next crosstool, of course.
Thanks for posting about your experiences with gcc-3.4.0 and the link to http://www.ppckernel.org, which I wasn't aware of...
- Dan
Signature · 2 lines
My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change
Karim Yaghmour wrote:
...
Quoted 6 lines
kernels as well, to see if they too would work. I noticed that some that actually failed as above (causing a fault very early at boot time), now didn't fail with 3.3.2, but printed nothing to the terminal and the system would eventually reboot -- as if console=ttyS0,9600 had no effect and the kernel panicked as expected because of the missing rootfs.
This just above is actually due pilot error. I had been trying so many different kernels that I had forgotten to check whether console on serial was enabled ... No wonder nothing was displayed.
To recap, I've also got the 2.4.25-ben1 and 2.6.6 working with gcc 3.3.2. 2.4.25-ben1 still has the same problem as described earlier with gcc 3.4.0, but 2.6.6 works fine with gcc 3.4.0.
I'm probably going to stick to 3.3.2, though, as I have no intention of chasing gcc 3.4.0's breaking of some user-space stuff.
Karim
Signature · 3 lines
Author, Speaker, Developer, Consultant Pushing Embedded and Real-Time Linux Systems Beyond the Limits http://www.opersys.com || [email protected] || 1-866-677-4546
Quoted 4 lines · Dan Kegel
Quite. I'm heading up to the gcc summit next week to make that point (see also http://gcc.gnu.org/ml/gcc/2004-05/msg01417.html,
which rumors that Paolo Bonzini and Nathanael Nerode are working on detangling gcc bootstrap).
You have my full support.
Quoted 4 lines
the GNU toolchain for cross-development. (But before Karim objects to the concept of a canned build script, I hasten to add that I fully agree with him that the gnu toolchain build process shouldn't need such an ugly and fragile wrapper script around it.)
:)
Karim
Signature · 3 lines
Author, Speaker, Developer, Consultant Pushing Embedded and Real-Time Linux Systems Beyond the Limits http://www.opersys.com || [email protected] || 1-866-677-4546
Quote from Dan Kegel <[email protected]>:
Quoted 4 lines
I agree 2.6 should continue to support and compile correctly under gcc-2.95.3, even if that means working around compiler bugs. By the time linux-2.7 rolls around, I suspect nobody will mind if we drop 2.95.3 in favor of 3.4.x.
Especially as newer versions of glibc won't compile with 2.95.3 anymore - so if you're building a system completely from source, a 3.x.x version of GCC is more or less a necessity anyway.
John.