On Thu, Jan 6, 2011 at 12:42 PM, Dzianis Kahanovich
<mahatma@xxxxxxxxxxxxxx> wrote:
Andrew Morton wrote:did you report this to gcc folks ?
Fixing broken automatic inlining for GCC 4.5+ Â(breaks build with
-finline-functions or -O3 on x86_*).
Please always quote the compiler output when addressing build errors
and warnings.
Sorry. linux-next, yesterday, gcc version 4.5.1 (Gentoo 4.5.1-r1 p1.4, pie-0.4.5):
make -j5 -s HOSTCC=x86_64-pc-linux-gnu-gcc ARCH=i386
CROSS_COMPILE=i586-pc-linux-gnu- all -i
arch/x86/kvm/vmx.c: Assembler messages:
arch/x86/kvm/vmx.c:4036: Error: symbol `.Llaunched' is already defined
arch/x86/kvm/vmx.c:4048: Error: symbol `.Lkvm_vmx_return' is already defined
i586-pc-linux-gnu-ld: cannot find arch/x86/kvm/vmx.o: No such file or directory
...
ERROR: "__bad_udelay" [drivers/media/radio/radio-aimslab.ko] undefined!
Btw, you said it showed with "-O3" or "-finline-functions", but I do
not see any specific option passed to make. Could you remove the "-j5"
switch and add "V=1" to see the full compiler command line ?
Generally speaking, neither "-O3" or "-finline-functions" seems to be
passed by default by kbuild, so I am not sure they are meant to be
supported at all.
- Arnaud
I unsure in precise version boundaries, but first found on release tree weeks
ago and first error only sometimes happened on x86_64 (version related?). On my
own builds I used -fno-inline-functions in local Makefile's, but this is more
local fix.
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -569,7 +569,7 @@ static inline void ept_sync_individual_a
  Â}
Â}
-static unsigned long vmcs_readl(unsigned long field)
+static noinline unsigned long vmcs_readl(unsigned long field)
Â{
  Âunsigned long value = 0;
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -71,7 +71,7 @@ static struct rtrack rtrack_card;
Â/* local things */
-static void sleep_delay(long n)
+static noinline void sleep_delay(long n)
Â{
  Â/* Sleep nicely for 'n' uS */
  Âint d = n / msecs_to_jiffies(1000);
A golden rule is that when a programmer reads some code, he should be
able to understand why it's there. ÂThere is no way on this little
earth that a programmer will be able to look at this code and say
"ah-hah, that must be a workaround for gcc-4.5 -finline-functions!".
We fix that problem this way:
--- a/arch/x86/kvm/vmx.c~fix-miscompiling-with-gcc-45-finline-functions-fix
+++ a/arch/x86/kvm/vmx.c
@@ -569,6 +569,7 @@ static inline void ept_sync_individual_a
   }
Â}
+/* noinline works around gcc-4.5+ build error with -finline-functions */
Âstatic noinline unsigned long vmcs_readl(unsigned long field)
Â{
   unsigned long value = 0;
--- a/drivers/media/radio/radio-aimslab.c~fix-miscompiling-with-gcc-45-finline-functions-fix
+++ a/drivers/media/radio/radio-aimslab.c
@@ -71,6 +71,7 @@ static struct rtrack rtrack_card;
Â/* local things */
+/* noinline works around gcc-4.5+ build error with -finline-functions */
Âstatic noinline void sleep_delay(long n)
Â{
   /* Sleep nicely for 'n' uS */
_