Bug 8992

Summary: -mtune=generic failure
Product: Other Reporter: Daniel Walker (dwalker)
Component: OtherAssignee: other_other
Status: REJECTED INVALID    
Severity: normal CC: akpm, andi-bz, sam
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.17 Subsystem:
Regression: --- Bisected commit-id:

Description Daniel Walker 2007-09-07 20:13:13 UTC
Most recent kernel where this bug did not occur: 2.6.16
Distribution: Fedora
Hardware Environment: i386
Software Environment:
Problem Description:
When building with CONFIG_X86_GENERIC the kernel fails with the following message,
arch/i386/kernel/asm-offsets.c:1: error: bad value (generic) for -mtune= switch

With gcc version 4.1.2. If I compile anything else with -mtune=generic it won't have this error. I narrowed it down to gcc failing with -mtune=generic and the -S option.

for instance, if foo.c is "void main(void) { }"
and you compile with "gcc -S -mtune=generic foo.c -o foo" It fails. Removing -S and it compile fine ..
Comment 1 Andrew Morton 2007-09-07 22:06:51 UTC
Gad, 2.6.17.  Is current mainline busted too?
Comment 2 Daniel Walker 2007-09-07 22:16:22 UTC
(In reply to comment #1)
> Gad, 2.6.17.  Is current mainline busted too?
> 

yeah ..

I noticed that -S combined with -mtune=core2 also fails .. 
Comment 3 Daniel Walker 2007-09-08 09:37:27 UTC
It looks more and more like a compiler problem.. gcc should work with -S and any -mtune options but doens't for -mtune=core2 or -mtune=generic .. However, -S does work with -mtune=pentium3 and -mtune ..

According to the gcc man page -mtune=generic is the same as -mtune=i686 , the later works fine (at least on my gcc)..
Comment 4 Daniel Walker 2007-09-08 10:33:25 UTC
I'm not an expect on the build system , but I think Linux build scripts check for -mtune=generic support using the following command line,

gcc -mtune=generic -S -xc /dev/null -o tmpfile

from scripts/Kbuild.include "try-run" , and "cc-option-yn" .. The above command returns that -mtune=generic works as a gcc command line option ..

If I change the commandline slightly, creating an actual C source file called foo.c .

gcc -mtune=generic -S -xc foo.c -o foo

This command line has no errors either .. Then remove "-xc"

gcc -mtune=generic -S foo.c -o foo

And your get failure .. 
Comment 5 Daniel Walker 2007-09-08 10:53:52 UTC
This is getting so weird, I'm wondering if it's related to my system ..
Comment 6 Daniel Walker 2007-09-08 11:06:20 UTC
The good news is that this appears to be a distcc issue on my system.. Boils down to different compilers (even tho they all the same version) .. Appears that distcc across distro's is a no-no (even with equal gcc versions).. 

So I'll close this, and figure it out myself .. Sorry for the noise ..
Comment 7 Sam Ravnborg 2007-09-08 11:50:20 UTC
> If I change the commandline slightly, creating an actual C source file called
> foo.c .
> 
> gcc -mtune=generic -S -xc foo.c -o foo
> 
> This command line has no errors either .. Then remove "-xc"
> 
> gcc -mtune=generic -S foo.c -o foo
> 
> And your get failure .. 

Very strange. -xc just tell gcc that it is dealing with a .c file
no matter the extension of the file.
It is often used when reading from standard input.

	Sam