Bug 13503 - Compile failure with gcc 3.4.6 - start_kernel in paravirt.h
Summary: Compile failure with gcc 3.4.6 - start_kernel in paravirt.h
Status: CLOSED OBSOLETE
Alias: None
Product: Virtualization
Classification: Unclassified
Component: Xen (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: virtualization_xen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-10 22:04 UTC by Brad Plant
Modified: 2012-06-08 11:54 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.30
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments

Description Brad Plant 2009-06-10 22:04:27 UTC
2.6.30 fails to compile with gcc 3.4.6 (includes hardening patches). The same config however compiles with gcc 4.4.3 (ubuntu 9.04).

I have successfully compiled 2.6.2{7,8,9}.x kernels with gcc 3.4.6 before.

Compile error below:

  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-x86
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/basic/hash
  CC      kernel/bounds.s
  GEN     include/linux/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/asm/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  CC      init/main.o
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h: In function `start_kernel':
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1590: warning: asm operand 1 probably doesn't match constraints
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1570: warning: asm operand 2 probably doesn't match constraints
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1590: warning: asm operand 1 probably doesn't match constraints
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1570: warning: asm operand 2 probably doesn't match constraints
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1599: warning: asm operand 1 probably doesn't match constraints
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1590: error: impossible constraint in `asm'
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1570: error: impossible constraint in `asm'
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1590: error: impossible constraint in `asm'
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1570: error: impossible constraint in `asm'
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1599: error: impossible constraint in `asm'
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1568: warning: 'f' might be used uninitialized in this function
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1568: warning: 'f' might be used uninitialized in this function
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1568: warning: 'f' might be used uninitialized in this function
/usr/src/linux-2.6.30/arch/x86/include/asm/paravirt.h:1568: warning: 'f' might be used uninitialized in this function
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
Comment 1 Jeremy Fitzhardinge 2009-06-11 23:16:18 UTC
Have you tried compiling earlier kernels with gcc 4.4.3?  Ie, is this a new problem in the kernel, or with the compiler?
Comment 2 Brad Plant 2009-06-12 01:14:21 UTC
I just compiled 2.6.29.4 successfully with gcc 4.4.3.

I have successfully compiled 2.6.27.x, 2.6.28.x and 2.6.29.x pvops kernels before with gcc 3.4.6, but 2.6.30 fails. I believe that indicates a problem in the kernel, not the compiler.
Comment 3 Jeremy Fitzhardinge 2009-06-12 01:42:08 UTC
Oh, I misparsed the original report.  The bug is that 3.4.6 no longer works, but 4.4.3 does work.

The code in question does do some fairly involved inline asms, which commonly upset some versions of gcc, particularly if they have various non-standard patches applied (which is what I'm assuming the "hardening patches" are).

Are you using 3.4.6 specifically because of the hardening patches, or is there some other reason you're using it?  Does Ubuntu provide some other compiler package?
Comment 4 Brad Plant 2009-06-12 23:54:22 UTC
Yes, I am using 3.4.6 because of the hardening patches. This system is a Gentoo system. I have compiled several kernels with this same compiler 2.6.{18,20,21,27,28,29} with no issues so this is definitely a kernel problem.

I am able to switch between gcc profiles to disable hardened features. I tried switching to the vanilla profile, but the compile error still persists.
Comment 5 Jeremy Fitzhardinge 2009-06-19 17:25:12 UTC
Does this help at all?

diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index c7136e8..5041919 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -387,7 +387,7 @@ extern struct pv_mmu_ops pv_mmu_ops;
 extern struct pv_lock_ops pv_lock_ops;
 
 #define PARAVIRT_PATCH(x)					\
-	(offsetof(struct paravirt_patch_template, x) / sizeof(void *))
+	((int)(offsetof(struct paravirt_patch_template, x) / sizeof(void *)))
 
 #define paravirt_type(op)				\
 	[paravirt_typenum] "i" (PARAVIRT_PATCH(op)),	\
Comment 6 Brad Plant 2009-06-20 02:29:23 UTC
No, the compile error remains unchanged.

Note You need to log in before you can comment on or make changes to this bug.