cmpxchg() in recent kernels
Hello!
I've probably missed something, but how to compile recent kernels on ARM? I've been using GCC 3.4.3 from Cirrus for my EP9302 boards up to 2.6.35.4 But 2.6.36-rc and upper won't compile anymore.
The problem is appearing in multiplatform code of cmpxchg() function. First in kernel/pid.c (2.6.36-rc4 - 2.6.36-rc6)
Then 4 times in 2.6.36-rc7-next... atomic_cmpxchg compiles fine, and when I replace cmpxhg with atomic_ version, everything compiles fine.
Here is output of make from 2.6.36-rc7-next:
...
CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o LD vmlinux
kernel/built-in.o: In function `alloc_pid':
elfcore.c:(.text+0x1c258): undefined reference to wrong_size_cmpxchg' net/built-in.o: In function rt_bind_peer':
sysctl_net.c:(.text+0x3bb38): undefined reference to wrong_size_cmpxchg' net/built-in.o: In function inet_add_protocol':
sysctl_net.c:(.text+0x3f4dc): undefined reference to wrong_size_cmpxchg' net/built-in.o: In function inet_del_protocol':
sysctl_net.c:(.text+0x3f5a8): undefined reference to wrong_size_cmpxchg' net/built-in.o: In function build_ehash_secret':
sysctl_net.c:(.text+0x6a034): undefined reference to `wrong_size_cmpxchg' make[1]: *** [vmlinux] Error 1
...
Best regards!
Quoted 22 lines · Alex Sverdlin
Hello!
I've probably missed something, but how to compile recent kernels on ARM? I've been using GCC 3.4.3 from Cirrus for my EP9302 boards up to 2.6.35.4 But 2.6.36-rc and upper won't compile anymore.
The problem is appearing in multiplatform code ofcmpxchg()function. First inkernel/pid.c(2.6.36-rc4 - 2.6.36-rc6)
Then 4 times in 2.6.36-rc7-next...atomic_cmpxchgcompiles fine, and when I replace cmpxhg withatomic_version, everything compiles fine.Here is output of make from 2.6.36-rc7-next:
...
?CHK ? ?include/generated/compile.h
?UPD ? ?include/generated/compile.h
?CC ? ? ?init/version.o
?LD ? ? ?init/built-in.o
?LD ? ? ?vmlinuxkernel/built-in.o: In function `alloc_pid':
elfcore.c:(.text+0x1c258): undefined reference towrong_size_cmpxchg' net/built-in.o: In functionrt_bind_peer':
sysctl_net.c:(.text+0x3bb38): undefined reference to `wrong_size_cmpxchg'
Quoted 8 lines
net/built-in.o: In function `inet_add_protocol':
sysctl_net.c:(.text+0x3f4dc): undefined reference towrong_size_cmpxchg' net/built-in.o: In functioninet_del_protocol':
sysctl_net.c:(.text+0x3f5a8): undefined reference towrong_size_cmpxchg' net/built-in.o: In functionbuild_ehash_secret':
sysctl_net.c:(.text+0x6a034): undefined reference to `wrong_size_cmpxchg' make[1]: *** [vmlinux] Error 1
...
Sorry, no answer, but I can confirm that I am having the same problem as well. ARM AT91RM9200, 2.6.33.7 + at91 + rt
kernel/built-in.o: In function `__tasklet_hi_schedule':
utsname_sysctl.c:(.text+0xca1c): undefined reference to wrong_size_cmpxchg' kernel/built-in.o: In function __tasklet_schedule':
utsname_sysctl.c:(.text+0xcb7c): undefined reference to wrong_size_cmpxchg' kernel/built-in.o: In function __tasklet_action':
utsname_sysctl.c:(.text+0xce4c): undefined reference to wrong_size_cmpxchg' kernel/built-in.o: In function sched_init_smp':
utsname_sysctl.c:(.init.text+0xec): undefined reference to `____ilog2_NaN'
make: *** [.tmp_vmlinux1] Error 1
also
kernel/built-in.o: In function `__tasklet_hi_schedule':
slow-work.c:(.text+0xc86c): undefined reference to wrong_size_cmpxchg' kernel/built-in.o: In function __tasklet_schedule':
slow-work.c:(.text+0xc9cc): undefined reference to wrong_size_cmpxchg' kernel/built-in.o: In function __tasklet_action':
slow-work.c:(.text+0xcc9c): undefined reference to wrong_size_cmpxchg' kernel/built-in.o: In function sched_init_smp':
slow-work.c:(.init.text+0xec): undefined reference to `____ilog2_NaN'
make: *** [.tmp_vmlinux1] Error 1
Aras
Quoted 57 lines · Aras Vaichas
Quoted 22 lines · Alex Sverdlin
Hello!
I've probably missed something, but how to compile recent kernels on ARM? I've been using GCC 3.4.3 from Cirrus for my EP9302 boards up to 2.6.35.4 But 2.6.36-rc and upper won't compile anymore.
The problem is appearing in multiplatform code ofcmpxchg()function. First inkernel/pid.c(2.6.36-rc4 - 2.6.36-rc6)
Then 4 times in 2.6.36-rc7-next...atomic_cmpxchgcompiles fine, and when I replace cmpxhg withatomic_version, everything compiles fine.Here is output of make from 2.6.36-rc7-next:
...
?CHK ? ?include/generated/compile.h
?UPD ? ?include/generated/compile.h
?CC ? ? ?init/version.o
?LD ? ? ?init/built-in.o
?LD ? ? ?vmlinuxkernel/built-in.o: In function `alloc_pid':
elfcore.c:(.text+0x1c258): undefined reference towrong_size_cmpxchg' net/built-in.o: In functionrt_bind_peer':
sysctl_net.c:(.text+0x3bb38): undefined reference to `wrong_size_cmpxchg'Quoted 8 lines
net/built-in.o: In function `inet_add_protocol':
sysctl_net.c:(.text+0x3f4dc): undefined reference towrong_size_cmpxchg' net/built-in.o: In functioninet_del_protocol':
sysctl_net.c:(.text+0x3f5a8): undefined reference towrong_size_cmpxchg' net/built-in.o: In functionbuild_ehash_secret':
sysctl_net.c:(.text+0x6a034): undefined reference to `wrong_size_cmpxchg' make[1]: *** [vmlinux] Error 1
...Sorry, no answer, but I can confirm that I am having the same problem as well. ARM AT91RM9200, 2.6.33.7 + at91 + rt
kernel/built-in.o: In function `__tasklet_hi_schedule':
utsname_sysctl.c:(.text+0xca1c): undefined reference towrong_size_cmpxchg' kernel/built-in.o: In function__tasklet_schedule':
utsname_sysctl.c:(.text+0xcb7c): undefined reference towrong_size_cmpxchg' kernel/built-in.o: In function__tasklet_action':
utsname_sysctl.c:(.text+0xce4c): undefined reference towrong_size_cmpxchg' kernel/built-in.o: In functionsched_init_smp':
utsname_sysctl.c:(.init.text+0xec): undefined reference to `____ilog2_NaN'
make: *** [.tmp_vmlinux1] Error 1also
kernel/built-in.o: In function `__tasklet_hi_schedule':
slow-work.c:(.text+0xc86c): undefined reference towrong_size_cmpxchg' kernel/built-in.o: In function__tasklet_schedule':
slow-work.c:(.text+0xc9cc): undefined reference towrong_size_cmpxchg' kernel/built-in.o: In function__tasklet_action':
slow-work.c:(.text+0xcc9c): undefined reference towrong_size_cmpxchg' kernel/built-in.o: In functionsched_init_smp':
slow-work.c:(.init.text+0xec): undefined reference to `____ilog2_NaN'
make: *** [.tmp_vmlinux1] Error 1
Quoted 1 line
Aras
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36
GZIP kernel/config_data.gz IKCFG kernel/config_data.h CC kernel/configs.o LD kernel/built-in.o LD drivers/pcmcia/built-in.o LD drivers/built-in.o LD vmlinux.o
MODPOST vmlinux.o
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o LD .tmp_vmlinux1
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1
Kristoffer
Quoted 5 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 20 lines · Kristoffer Ericson
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36GZIP kernel/config_data.gz IKCFG kernel/config_data.h CC kernel/configs.o LD kernel/built-in.o LD drivers/pcmcia/built-in.o LD drivers/built-in.o LD vmlinux.oMODPOST vmlinux.o
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'makeCONFIG_DEBUG_SECTION_MISMATCH=y'GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o LD .tmp_vmlinux1
Quoted 3 lines
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':
include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1
Probably needs to be bisected, but I think in the long run we'll have to accept that gcc 4 will become the minimum compiler version.
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Kristoffer Ericson
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36
snip ...
Quoted 6 lines
Quoted 3 lines
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':
include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1Probably needs to be bisected, but I think in the long run we'll have to accept that gcc 4 will become the minimum compiler version.
I just tested a build with GCC 4.2.3 and it linked correctly. The only problem is that the kernel image size is now 3x as big.
Using gcc-3.4.4-glibc-2.3.5:
* fails to link without patch to cmpxchg-local.h, but size is similar to my previous builds
Created: Mon Oct 25 11:59:04 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 1471354 Bytes = 1436.87 kB = 1.40 MB
Using gcc-4.2.3-glibc-2.7:
* compiles and links correctly, but size is way too big
Created: Mon Oct 25 11:48:26 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 4576155 Bytes = 4468.90 kB = 4.36 MB
Exact same code, I just changed my CROSS symbol to point to different GCC directories.
Aras
Hello Aras,
Quoted 32 lines · Aras Vaichas
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Kristoffer Ericson
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36snip ...
Quoted 6 lines
Quoted 3 lines
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':
include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1Probably needs to be bisected, but I think in the long run we'll have to accept that gcc 4 will become the minimum compiler version.
I just tested a build with GCC 4.2.3 and it linked correctly. The only problem is that the kernel image size is now 3x as big.
Using gcc-3.4.4-glibc-2.3.5:
* fails to link without patch to
cmpxchg-local.h, but size is similar to my previous buildsCreated: Mon Oct 25 11:59:04 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 1471354 Bytes = 1436.87 kB = 1.40 MBUsing gcc-4.2.3-glibc-2.7:
* compiles and links correctly, but size is way too big
Quoted 7 lines
Created: Mon Oct 25 11:48:26 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 4576155 Bytes = 4468.90 kB = 4.36 MBExact same code, I just changed my CROSS symbol to point to different GCC directories.
Can you compare the section headers of the resulting vmlinux images? (I.e. $CROSS-objdump -h vmlinux) and report bag which section(s) got bigger?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 28 lines · Aras Vaichas
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Kristoffer Ericson
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36snip ...
Quoted 6 lines
Quoted 3 lines
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':
include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1Probably needs to be bisected, but I think in the long run we'll have to accept that gcc 4 will become the minimum compiler version.
I just tested a build with GCC 4.2.3 and it linked correctly. The only problem is that the kernel image size is now 3x as big.
Using gcc-3.4.4-glibc-2.3.5:
* fails to link without patch to
cmpxchg-local.h, but size is similar to my previous buildsCreated: Mon Oct 25 11:59:04 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 1471354 Bytes = 1436.87 kB = 1.40 MB
Quoted 7 lines
Using gcc-4.2.3-glibc-2.7:
* compiles and links correctly, but size is way too big
Created: Mon Oct 25 11:48:26 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 4576155 Bytes = 4468.90 kB = 4.36 MB
This sounds like a regression - can you please bisect to try and find which change caused tihs?
Quoted 31 lines · Russell King - ARM Linux
Quoted 30 lines · Aras Vaichas
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Kristoffer Ericson
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36snip ...
Quoted 6 lines
Quoted 3 lines
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':
include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1Probably needs to be bisected, but I think in the long run we'll have to accept that gcc 4 will become the minimum compiler version.
I just tested a build with GCC 4.2.3 and it linked correctly. The only problem is that the kernel image size is now 3x as big.
Using gcc-3.4.4-glibc-2.3.5:
* fails to link without patch to
cmpxchg-local.h, but size is similar to my previous buildsCreated: ? ? ?Mon Oct 25 11:59:04 2010
Image Type: ? ARM Linux Kernel Image (gzip compressed) Data Size: ? ?1471354 Bytes = 1436.87 kB = 1.40 MBUsing gcc-4.2.3-glibc-2.7:
Quoted 8 lines
Quoted 5 lines
* compiles and links correctly, but size is way too big
Created: ? ? ?Mon Oct 25 11:48:26 2010
Image Type: ? ARM Linux Kernel Image (gzip compressed) Data Size: ? ?4576155 Bytes = 4468.90 kB = 4.36 MBThis sounds like a regression - can you please bisect to try and find which change caused tihs?
OK, problem solved. I had this problem:
http://lists.busybox.net/pipermail/buildroot/2008-June/021158.html
The fix for this problem was included as a patch for the kernel as shown here:
http://lists.busybox.net/pipermail/buildroot/2008-June/021162.html
But my U-Boot uImage build script does its own objcopy and thus didn't get patched. I've added the extra objcopy arguments to my script and my final image size is now 1.36MB.
For reference, this is my uImage make script:
make ARCH=arm CROSS_COMPILE=${CROSS_PATH} INSTALL_MOD_PATH=${FS_PATH} Image
${CROSS_PATH}objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux linux.bin
gzip -v9 linux.bin
${MKIMAGE} -A arm -O linux -C gzip -a 0x20008000 -e 0x20008000 -d linux.bin.gz uImage
Aras
Hello Aras,
Quoted 6 lines
For reference, this is my uImage make script:
make ARCH=arm CROSS_COMPILE=${CROSS_PATH} INSTALL_MOD_PATH=${FS_PATH} Image
${CROSS_PATH}objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux linux.bin
Why don't you use arch/arm/boot/Image instead of doing the objcopy yourself? (If it's intended you might want to make vmlinux only instead of Image.)
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
2010/10/26 Uwe Kleine-K?nig <[email protected]>:
Quoted 4 lines
Hello Aras,
Quoted 2 lines
For reference, this is my uImage make script:
Quoted 8 lines
Quoted 4 lines
make ARCH=arm CROSS_COMPILE=${CROSS_PATH} INSTALL_MOD_PATH=${FS_PATH} Image
${CROSS_PATH}objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux linux.bin
Why don't you use
arch/arm/boot/Imageinstead of doing the objcopy yourself? ?(If it's intended you might want to make vmlinux only instead of Image.)
My best guess is that it's carried over from my 2.4.x days.
A quick Google search shows several U-Boot image building tutorials that do this.
e.g. http://www.ronetix.at/an008_ARM_Linux_Debugging.html
It was never a problem until GCC v4 was required for a clean kernel build but I will certainly review my build scripts with this in mind. :)
I only do kernel work every few years as needed for the company product, so I tend to play catchups on these changes.
Aras
Quoted 11 lines · Aras Vaichas
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Kristoffer Ericson
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36snip ...
Quoted 4 lines
Quoted 3 lines
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':
include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1
Quoted 6 lines
Quoted 2 lines
Probably needs to be bisected, but I think in the long run we'll have to accept that gcc 4 will become the minimum compiler version.
I just tested a build with GCC 4.2.3 and it linked correctly. The only problem is that the kernel image size is now 3x as big.
Im using a GCC 4.2.2 here and Im not seeing those issues, size is pretty much exactly the same. Just FYI.
Quoted 24 lines
Using gcc-3.4.4-glibc-2.3.5:
* fails to link without patch to
cmpxchg-local.h, but size is similar to my previous buildsCreated: Mon Oct 25 11:59:04 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 1471354 Bytes = 1436.87 kB = 1.40 MBUsing gcc-4.2.3-glibc-2.7:
* compiles and links correctly, but size is way too big
Created: Mon Oct 25 11:48:26 2010 Image Type: ARM Linux Kernel Image (gzip compressed) Data Size: 4576155 Bytes = 4468.90 kB = 4.36 MBExact same code, I just changed my CROSS symbol to point to different GCC directories.
Aras
Quoted 15 lines · Kristoffer Ericson
Quoted 14 lines · Aras Vaichas
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Kristoffer Ericson
Im seeing something similiar, using GCC 3.4.5
ARM HP Jornada 720, 2.6.36snip ...
Quoted 6 lines
Quoted 3 lines
kernel/built-in.o(.text+0x1d038): In function `alloc_pid':
include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make: *** [.tmp_vmlinux1] Error 1Probably needs to be bisected, but I think in the long run we'll have to accept that gcc 4 will become the minimum compiler version.
Quoted 7 lines
Quoted 3 lines
I just tested a build with GCC 4.2.3 and it linked correctly. The only problem is that the kernel image size is now 3x as big.
Im using a GCC 4.2.2 here and Im not seeing those issues, size is pretty much exactly the same. Just FYI.
Since I've switched from gcc 3.4.3 to gcc 4.4.1, problem with cmpxchg() disappeared. And yes, size for my config is pretty much the same as before, about 1.2-1.4mb.
Alexander.