* 2.6.19-rc5-mm1 fails to compile with gcc 4.2
@ 2006-11-11 22:34 Bernhard Rosenkraenzer
2006-11-12 8:22 ` Avi Kivity
0 siblings, 1 reply; 13+ messages in thread
From: Bernhard Rosenkraenzer @ 2006-11-11 22:34 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm
drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible constraints
drivers/kvm/kvm_main.c:158: error: 'asm' operand has impossible constraints
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-11 22:34 2.6.19-rc5-mm1 fails to compile with gcc 4.2 Bernhard Rosenkraenzer
@ 2006-11-12 8:22 ` Avi Kivity
2006-11-12 9:05 ` Bernhard Rosenkraenzer
2006-11-12 13:43 ` Bernhard Rosenkraenzer
0 siblings, 2 replies; 13+ messages in thread
From: Avi Kivity @ 2006-11-12 8:22 UTC (permalink / raw)
To: Bernhard Rosenkraenzer; +Cc: linux-kernel, akpm
Bernhard Rosenkraenzer wrote:
> drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
> drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible constraints
> drivers/kvm/kvm_main.c:158: error: 'asm' operand has impossible constraints
>
Smells like a gcc regression. Can you send .config?
Or better yet, preprocessed source and full gcc command line (as seen on
'make V=1').
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 8:22 ` Avi Kivity
@ 2006-11-12 9:05 ` Bernhard Rosenkraenzer
2006-11-12 9:24 ` Avi Kivity
2006-11-12 11:17 ` Segher Boessenkool
2006-11-12 13:43 ` Bernhard Rosenkraenzer
1 sibling, 2 replies; 13+ messages in thread
From: Bernhard Rosenkraenzer @ 2006-11-12 9:05 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, akpm
On Sunday, 12. November 2006 09:22, Avi Kivity wrote:
> Bernhard Rosenkraenzer wrote:
> > drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
> > drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible
> > constraints drivers/kvm/kvm_main.c:158: error: 'asm' operand has
> > impossible constraints
>
> Smells like a gcc regression. Can you send .config?
>
> Or better yet, preprocessed source and full gcc command line (as seen on
> 'make V=1').
It does look like a gcc bug -- -O0 makes it go away.
Details at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 9:05 ` Bernhard Rosenkraenzer
@ 2006-11-12 9:24 ` Avi Kivity
2006-11-12 13:36 ` Bernhard Rosenkraenzer
2006-11-12 11:17 ` Segher Boessenkool
1 sibling, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2006-11-12 9:24 UTC (permalink / raw)
To: Bernhard Rosenkraenzer; +Cc: linux-kernel, akpm
Bernhard Rosenkraenzer wrote:
> On Sunday, 12. November 2006 09:22, Avi Kivity wrote:
>
>> Bernhard Rosenkraenzer wrote:
>>
>>> drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
>>> drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible
>>> constraints drivers/kvm/kvm_main.c:158: error: 'asm' operand has
>>> impossible constraints
>>>
>> Smells like a gcc regression. Can you send .config?
>>
>> Or better yet, preprocessed source and full gcc command line (as seen on
>> 'make V=1').
>>
>
> It does look like a gcc bug -- -O0 makes it go away.
> Details at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808
>
That's a different bug, gcc generates code that the assembler can't
handle. Might be an assembler bug.
Can you compile it with -S and post the generated assembly?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 9:05 ` Bernhard Rosenkraenzer
2006-11-12 9:24 ` Avi Kivity
@ 2006-11-12 11:17 ` Segher Boessenkool
1 sibling, 0 replies; 13+ messages in thread
From: Segher Boessenkool @ 2006-11-12 11:17 UTC (permalink / raw)
To: Bernhard Rosenkraenzer; +Cc: Avi Kivity, linux-kernel, akpm
>>> drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
>>> drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible
>>> constraints drivers/kvm/kvm_main.c:158: error: 'asm' operand has
>>> impossible constraints
>>
>> Smells like a gcc regression. Can you send .config?
>>
>> Or better yet, preprocessed source and full gcc command line (as
>> seen on
>> 'make V=1').
Just the function containing those lines (please mark which
lines they are) would do probably.
> It does look like a gcc bug -- -O0 makes it go away.
> Details at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808
PR29808 is not a GCC bug, but invalid code.
Segher
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 9:24 ` Avi Kivity
@ 2006-11-12 13:36 ` Bernhard Rosenkraenzer
2006-11-12 13:43 ` Avi Kivity
2006-11-12 14:10 ` Segher Boessenkool
0 siblings, 2 replies; 13+ messages in thread
From: Bernhard Rosenkraenzer @ 2006-11-12 13:36 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, akpm
On Sunday, 12. November 2006 10:24, Avi Kivity wrote:
> >> Or better yet, preprocessed source and full gcc command line (as seen on
> >> 'make V=1').
gcc -m32 -Wp,-MD,drivers/kvm/.kvm_main.o.d -nostdinc -isystem /usr/lib/gcc/i586-ark-linux/4.2.0/include -D__KERNEL__ -Iinclude -include
include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O2 -pipe -msoft-float -mpreferred-stack-boundary=2 -march=i686 -mtune=pentium3 -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-default -fomit-frame-pointer -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(kvm_main)" -D"KBUILD_MODNAME=KBUILD_STR(kvm)" -c -o
drivers/kvm/.tmp_kvm_main.o drivers/kvm/kvm_main.c
drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible constraints
drivers/kvm/kvm_main.c:158: error: 'asm' operand has impossible constraints
> > It does look like a gcc bug -- -O0 makes it go away.
> > Details at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808
>
> That's a different bug, gcc generates code that the assembler can't
> handle. Might be an assembler bug.
It's the same thing, the code is taken from kvm_main.c:
static void load_fs(u16 sel)
{
asm ("mov %0, %%fs" : : "g"(sel)); <--- line 153
}
static void load_gs(u16 sel)
{
asm ("mov %0, %%gs" : : "g"(sel)); <--- line 158
}
> Can you compile it with -S and post the generated assembly?
It can't generate assembly with asm() constructs it perceives as invalid -- -S
produces the same error.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 13:36 ` Bernhard Rosenkraenzer
@ 2006-11-12 13:43 ` Avi Kivity
2006-11-12 13:50 ` Bernhard Rosenkraenzer
2006-11-12 14:13 ` Segher Boessenkool
2006-11-12 14:10 ` Segher Boessenkool
1 sibling, 2 replies; 13+ messages in thread
From: Avi Kivity @ 2006-11-12 13:43 UTC (permalink / raw)
To: Bernhard Rosenkraenzer; +Cc: linux-kernel, akpm
Bernhard Rosenkraenzer wrote:
> On Sunday, 12. November 2006 10:24, Avi Kivity wrote:
>
>>>> Or better yet, preprocessed source and full gcc command line (as seen on
>>>> 'make V=1').
>>>>
>
> gcc -m32 -Wp,-MD,drivers/kvm/.kvm_main.o.d -nostdinc -isystem /usr/lib/gcc/i586-ark-linux/4.2.0/include -D__KERNEL__ -Iinclude -include
> include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O2 -pipe -msoft-float -mpreferred-stack-boundary=2 -march=i686 -mtune=pentium3 -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-default -fomit-frame-pointer -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(kvm_main)" -D"KBUILD_MODNAME=KBUILD_STR(kvm)" -c -o
> drivers/kvm/.tmp_kvm_main.o drivers/kvm/kvm_main.c
> drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
> drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible constraints
> drivers/kvm/kvm_main.c:158: error: 'asm' operand has impossible constraints
>
>
>>> It does look like a gcc bug -- -O0 makes it go away.
>>> Details at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808
>>>
>> That's a different bug, gcc generates code that the assembler can't
>> handle. Might be an assembler bug.
>>
>
> It's the same thing, the code is taken from kvm_main.c:
>
> static void load_fs(u16 sel)
> {
> asm ("mov %0, %%fs" : : "g"(sel)); <--- line 153
> }
>
> static void load_gs(u16 sel)
> {
> asm ("mov %0, %%gs" : : "g"(sel)); <--- line 158
> }
>
>
'sel' is a variable, so gcc can't provide it as an immediate operand.
Specifying it as "rm" instead of "g" would have been better, but can't
have any real influence.
>
>> Can you compile it with -S and post the generated assembly?
>>
>
> It can't generate assembly with asm() constructs it perceives as invalid -- -S
> produces the same error.
>
Well, for the code you posted in in the gcc bug, it probaby generated
something like
mov $0, %fs
which is indeed invalid assembly. But the kvm miscompile is something
else (running out of registers or something like that).
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 8:22 ` Avi Kivity
2006-11-12 9:05 ` Bernhard Rosenkraenzer
@ 2006-11-12 13:43 ` Bernhard Rosenkraenzer
2006-11-12 13:50 ` Avi Kivity
1 sibling, 1 reply; 13+ messages in thread
From: Bernhard Rosenkraenzer @ 2006-11-12 13:43 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, akpm
[-- Attachment #1: Type: text/plain, Size: 446 bytes --]
On Sunday, 12. November 2006 09:22, Avi Kivity wrote:
> Bernhard Rosenkraenzer wrote:
> > drivers/kvm/kvm_main.c: In function 'kvm_dev_ioctl_run':
> > drivers/kvm/kvm_main.c:153: error: 'asm' operand has impossible
> > constraints drivers/kvm/kvm_main.c:158: error: 'asm' operand has
> > impossible constraints
The attached patch makes it compile (but I'm not 100% sure it's the right
thing to do, I'm not very experienced with gcc-style asm).
[-- Attachment #2: kvm_main-compilefix.patch --]
[-- Type: text/x-diff, Size: 422 bytes --]
--- linux-2.6.18/drivers/kvm/kvm_main.c.ark 2006-11-12 14:40:09.000000000 +0100
+++ linux-2.6.18/drivers/kvm/kvm_main.c 2006-11-12 14:38:51.000000000 +0100
@@ -150,12 +150,12 @@
static void load_fs(u16 sel)
{
- asm ("mov %0, %%fs" : : "g"(sel));
+ asm ("mov %0, %%fs" : : "m"(sel));
}
static void load_gs(u16 sel)
{
- asm ("mov %0, %%gs" : : "g"(sel));
+ asm ("mov %0, %%gs" : : "m"(sel));
}
#ifndef load_ldt
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 13:43 ` Bernhard Rosenkraenzer
@ 2006-11-12 13:50 ` Avi Kivity
0 siblings, 0 replies; 13+ messages in thread
From: Avi Kivity @ 2006-11-12 13:50 UTC (permalink / raw)
To: Bernhard Rosenkraenzer; +Cc: linux-kernel, akpm
Bernhard Rosenkraenzer wrote:
> The attached patch makes it compile (but I'm not 100% sure it's the right
> thing to do, I'm not very experienced with gcc-style asm).
>
> ------------------------------------------------------------------------
>
> --- linux-2.6.18/drivers/kvm/kvm_main.c.ark 2006-11-12 14:40:09.000000000 +0100
> +++ linux-2.6.18/drivers/kvm/kvm_main.c 2006-11-12 14:38:51.000000000 +0100
> @@ -150,12 +150,12 @@
>
> static void load_fs(u16 sel)
> {
> - asm ("mov %0, %%fs" : : "g"(sel));
> + asm ("mov %0, %%fs" : : "m"(sel));
> }
>
> static void load_gs(u16 sel)
> {
> - asm ("mov %0, %%gs" : : "g"(sel));
> + asm ("mov %0, %%gs" : : "m"(sel));
> }
>
> #ifndef load_ldt
>
Does "rm" instead of "m" work as well?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 13:43 ` Avi Kivity
@ 2006-11-12 13:50 ` Bernhard Rosenkraenzer
2006-11-12 13:55 ` Avi Kivity
2006-11-12 14:13 ` Segher Boessenkool
1 sibling, 1 reply; 13+ messages in thread
From: Bernhard Rosenkraenzer @ 2006-11-12 13:50 UTC (permalink / raw)
To: Avi Kivity; +Cc: linux-kernel, akpm
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
On Sunday, 12. November 2006 14:43, Avi Kivity wrote:
> 'sel' is a variable, so gcc can't provide it as an immediate operand.
> Specifying it as "rm" instead of "g" would have been better, but can't
> have any real influence.
Specifying it as "rm" instead of "g" does fix it -- patch attached.
> Well, for the code you posted in in the gcc bug, it probaby generated
> something like
>
> mov $0, %fs
>
> which is indeed invalid assembly. But the kvm miscompile is something
> else (running out of registers or something like that).
What am I overlooking? The code is the exact same (except I replaced "u16"
with "unsigned short" to avoid the #include), and produces the exact same
error message, and the fix is the same ("g" -> "rm").
[-- Attachment #2: kvm_main-compilefix.patch --]
[-- Type: text/x-diff, Size: 424 bytes --]
--- linux-2.6.18/drivers/kvm/kvm_main.c.ark 2006-11-12 14:40:09.000000000 +0100
+++ linux-2.6.18/drivers/kvm/kvm_main.c 2006-11-12 14:44:57.000000000 +0100
@@ -150,12 +150,12 @@
static void load_fs(u16 sel)
{
- asm ("mov %0, %%fs" : : "g"(sel));
+ asm ("mov %0, %%fs" : : "rm"(sel));
}
static void load_gs(u16 sel)
{
- asm ("mov %0, %%gs" : : "g"(sel));
+ asm ("mov %0, %%gs" : : "rm"(sel));
}
#ifndef load_ldt
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 13:50 ` Bernhard Rosenkraenzer
@ 2006-11-12 13:55 ` Avi Kivity
0 siblings, 0 replies; 13+ messages in thread
From: Avi Kivity @ 2006-11-12 13:55 UTC (permalink / raw)
To: Bernhard Rosenkraenzer; +Cc: linux-kernel, akpm
Bernhard Rosenkraenzer wrote:
> On Sunday, 12. November 2006 14:43, Avi Kivity wrote:
>
>> 'sel' is a variable, so gcc can't provide it as an immediate operand.
>> Specifying it as "rm" instead of "g" would have been better, but can't
>> have any real influence.
>>
>
> Specifying it as "rm" instead of "g" does fix it -- patch attached.
>
>
>> Well, for the code you posted in in the gcc bug, it probaby generated
>> something like
>>
>> mov $0, %fs
>>
>> which is indeed invalid assembly. But the kvm miscompile is something
>> else (running out of registers or something like that).
>>
>
> What am I overlooking? The code is the exact same (except I replaced "u16"
> with "unsigned short" to avoid the #include), and produces the exact same
> error message, and the fix is the same ("g" -> "rm").
>
Well, since it works, I guess I'm overlooking something. Maybe it's
just a bad error message from gcc.
I'll apply this. Thanks!
> ------------------------------------------------------------------------
>
> --- linux-2.6.18/drivers/kvm/kvm_main.c.ark 2006-11-12 14:40:09.000000000 +0100
> +++ linux-2.6.18/drivers/kvm/kvm_main.c 2006-11-12 14:44:57.000000000 +0100
> @@ -150,12 +150,12 @@
>
> static void load_fs(u16 sel)
> {
> - asm ("mov %0, %%fs" : : "g"(sel));
> + asm ("mov %0, %%fs" : : "rm"(sel));
> }
>
> static void load_gs(u16 sel)
> {
> - asm ("mov %0, %%gs" : : "g"(sel));
> + asm ("mov %0, %%gs" : : "rm"(sel));
> }
>
> #ifndef load_ldt
>
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 13:36 ` Bernhard Rosenkraenzer
2006-11-12 13:43 ` Avi Kivity
@ 2006-11-12 14:10 ` Segher Boessenkool
1 sibling, 0 replies; 13+ messages in thread
From: Segher Boessenkool @ 2006-11-12 14:10 UTC (permalink / raw)
To: Bernhard Rosenkraenzer; +Cc: Avi Kivity, linux-kernel, akpm
>>> It does look like a gcc bug -- -O0 makes it go away.
>>> Details at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808
>>
>> That's a different bug, gcc generates code that the assembler can't
>> handle. Might be an assembler bug.
>
> It's the same thing, the code is taken from kvm_main.c:
>
> static void load_fs(u16 sel)
> {
> asm ("mov %0, %%fs" : : "g"(sel)); <--- line 153
> }
Like I said in GCC PR29808, it's invalid -- use "r" instead.
Segher
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 2.6.19-rc5-mm1 fails to compile with gcc 4.2
2006-11-12 13:43 ` Avi Kivity
2006-11-12 13:50 ` Bernhard Rosenkraenzer
@ 2006-11-12 14:13 ` Segher Boessenkool
1 sibling, 0 replies; 13+ messages in thread
From: Segher Boessenkool @ 2006-11-12 14:13 UTC (permalink / raw)
To: Avi Kivity; +Cc: Bernhard Rosenkraenzer, linux-kernel, akpm
> 'sel' is a variable, so gcc can't provide it as an immediate
> operand. Specifying it as "rm" instead of "g" would have been
> better, but can't have any real influence.
It can become an immediate operand if the function
gets inlined into a caller.
Segher
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-11-12 14:13 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-11 22:34 2.6.19-rc5-mm1 fails to compile with gcc 4.2 Bernhard Rosenkraenzer
2006-11-12 8:22 ` Avi Kivity
2006-11-12 9:05 ` Bernhard Rosenkraenzer
2006-11-12 9:24 ` Avi Kivity
2006-11-12 13:36 ` Bernhard Rosenkraenzer
2006-11-12 13:43 ` Avi Kivity
2006-11-12 13:50 ` Bernhard Rosenkraenzer
2006-11-12 13:55 ` Avi Kivity
2006-11-12 14:13 ` Segher Boessenkool
2006-11-12 14:10 ` Segher Boessenkool
2006-11-12 11:17 ` Segher Boessenkool
2006-11-12 13:43 ` Bernhard Rosenkraenzer
2006-11-12 13:50 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox