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
Have you tried compiling earlier kernels with gcc 4.4.3? Ie, is this a new problem in the kernel, or with the compiler?
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.
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?
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.
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)), \
No, the compile error remains unchanged.