linking problem with 2.6.0-test6-bk10
Hi all,
I decided to give 2.6.10-test6-bk10 a spin on my gateway box, as I'm already using it successfully on the desktop machines. The compile went smoothly, but I came accross this linking error:
ld -m elf_i386 -T arch/i386/kernel/vmlinux.lds.s
arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/built-in.o --start-group usr/built-in.o arch/i386/kernel/built-in.o arch/i386/mm/built-in.o arch/i386/mach-default/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o lib/lib.a arch/i386/lib/lib.a lib/built-in.o arch/i386/lib/built-in.o drivers/built-in.o sound/built-in.o arch/i386/pci/built-in.o net/built-in.o --end-group -o vmlinux arch/i386/kernel/built-in.o(.init.text+0x2ebd): In function `centaur_mcr_insert':
: undefined reference to `mtrr_centaur_report_mcr'
make: *** [vmlinux] Error 1
I'm building for a Winchip C6 machine (although the build host is an AthlonXP), gcc is
$ /opt/bin/gcc -v Reading specs from /opt/lib/gcc-lib/i686-pc-linux-gnu/2.95.4/specs gcc version 2.95.4 20010319 (prerelease)
but the exact same error occurs with mdk 9.2rc gcc 3.3.1. Binutils used:
$ ld -v GNU ld version 2.14.90.0.5 20030722
I couldn't find any references to this particular problem in google (only 1 hit for "mtrr_centaur_report_mcr", in a bk changelog I think) or marc.theaimsgroup.com. I issued "make oldconfig" twice, as someone not long ago advised here on lkml, to work around some dependency mishap when changing processor types (this tree had been used to compile for a Pentium M and Athlon XP before, several 'make distclean' in between, both compiles were successful). I'm attaching the config used, for reference.
Please advise.
Regards,
Nuno
Quoted 13 lines · Nuno Monteiro
ld -m elf_i386 -T arch/i386/kernel/vmlinux.lds.s
arch/i386/kernel/head.oarch/i386/kernel/init_task.oinit/built-in.o--start-groupusr/built-in.oarch/i386/kernel/built-in.oarch/i386/mm/built-in.oarch/i386/mach-default/built-in.okernel/built-in.omm/built-in.ofs/built-in.oipc/built-in.osecurity/built-in.ocrypto/built-in.olib/lib.aarch/i386/lib/lib.alib/built-in.oarch/i386/lib/built-in.odrivers/built-in.osound/built-in.oarch/i386/pci/built-in.onet/built-in.o--end-group -o vmlinux arch/i386/kernel/built-in.o(.init.text+0x2ebd): In function `centaur_mcr_insert':
: undefined reference to `mtrr_centaur_report_mcr'
make: *** [vmlinux] Error 1
Try this.
Dave
arch/i386/kernel/cpu/centaur.c +2 -0
@@ -8,6 +8,8 @@#ifdef CONFIG_X86_OOSTORE +extern void mtrr_centaur_report_mcr (int mcr,u32 lo,u32 hi); +static u32 __init power2 (u32 x) {u32 s=1 ;
Signature · 1 line
Dave Jones http://www.codemonkey.org.uk
Quoted 5 lines · Nuno Monteiro
Try this.
Dave
Hi Dave,
Thanks for the input, but still no joy. I applied that to a pristine -test7 tree, same error as before (altough the address is a little
different: 2ebd, now 2eb6).
ld -m elf_i386 -T arch/i386/kernel/vmlinux.lds.s
arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/built-in.o --start-group usr/built-in.o arch/i386/kernel/built-in.o arch/i386/mm/built-in.o arch/i386/mach-default/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o lib/lib.a arch/i386/lib/lib.a lib/built-in.o arch/i386/lib/built-in.o drivers/built-in.o sound/built-in.o arch/i386/pci/built-in.o net/built-in.o --end-group -o vmlinux arch/i386/kernel/built-in.o(.init.text+0x2eb6): In function `centaur_mcr_insert':
: undefined reference to `mtrr_centaur_report_mcr'
make: *** [vmlinux] Error 1 nuno@hobbes:/usr/local/src/linux-2.6.0-test7$
Regards,
Nuno
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Nuno Monteiro
Quoted 5 lines · Nuno Monteiro
Try this.
Dave
Hi Dave,
Thanks for the input, but still no joy.
Hi,
Got 5 minutes to look at this today, here is the proper fix. This allows to compile for Winchip when CONFIG_MTRR is off. The alternative would be to pull in asm/mtrr.h and asm/errno.h, but it seems a bit overkill since we only need mtrr_centaur_report_mcr.
Booted and working fine here on my small gateway box for the past hour. Please apply.
Regards,
Nuno
arch/i386/kernel/cpu/centaur.c +4 -0
@@ -8,6 +8,10 @@#ifdef CONFIG_X86_OOSTORE +#ifndef CONFIG_MTRR +static __inline__void mtrr_centaur_report_mcr (int mcr,u32 lo,u32 hi) {;} +#endif +static u32 __init power2 (u32 x) {u32 s=1 ;
arch/i386/kernel/cpu/centaur.c line 14
Quoted 12 lines · Nuno Monteiro
Got 5 minutes to look at this today, here is the proper fix. This allows to compile for Winchip when
CONFIG_MTRRis off. The alternative would be to pull inasm/mtrr.handasm/errno.h, but it seems a bit overkill since we only needmtrr_centaur_report_mcr.Booted and working fine here on my small gateway box for the past hour. Please apply.
arch/i386/kernel/cpu/centaur.c +4
-0+#ifndef CONFIG_MTRR +static __inline__void mtrr_centaur_report_mcr (int mcr,u32 lo,u32 hi) {;} +#endif +
As well as looking pretty ugly, I can't convince myself this is safe. I think it's going to be better off making that whole code compile out if MTRRs are disabled. MTRR is a must-have if we want this code to actually work anyway.
Either change the ifdef at the top of centaur.c to #ifdef CONFIG_X86_OOSTORE && CONFIG_MTRR, or futz around it in the Kconfig, by changing the X86_OOSTORE depends line to
depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR Dave
Signature · 1 line
Dave Jones http://www.codemonkey.org.uk
Quoted 10 lines · Dave Jones
As well as looking pretty ugly, I can't convince myself this is safe. I think it's going to be better off making that whole code compile out if MTRRs are disabled. MTRR is a must-have if we want this code to actually work anyway.
Either change the ifdef at the top of
centaur.cto #ifdefCONFIG_X86_OOSTORE&&CONFIG_MTRR, or futz around it in theKconfig, by changing theX86_OOSTOREdepends line to
Hi Dave,
Right you are :)
Here is the updated fix.
arch/i386/Kconfig renamed from arch/i386/Kconfig.orig +1 -1
@@ -394,7 +394,7 @@ config X86_USE_3DNOW config X86_OOSTORE bool - depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 + depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR default y config HPET_TIMER