Description of problem: Get a copy of the kernel source code. Get a config for an x86 (32 bit kernel). use either "make ARCH=x86" or "i386" and then "make". On a 32 bit machine, this will compile correctly. On a 64 bit machine it will segfault on the link. Using the exact same code on Fedora 12 this works as expected. Something in the current GCC is bjorked. Version-Release number of selected component (if applicable): gcc-4.4.4-2.fc13.x86_64 How reproducible: Always. Steps to Reproduce: 1. Get kernel and config. 2. make ARCH=x86 3. Watch it segfault on link Actual results: Segfault on link. Expected results: Proper compile. Additional info:
Please post the exact error (and a few lines before it/after it, ideally with make V=1 so that it is clear what commands are executed. From the above it isn't even clear which program segfaulted. If it is gcc, please provide preprocessed source.
Here is the crash point. I have tried this on two different 64 bit machines on Fedora 13 and one with Fedora 12. CC arch/x86/lib/usercopy_32.o AR arch/x86/lib/lib.a LD vmlinux.o MODPOST vmlinux.o /bin/sh: line 1: 26787 Segmentation fault (core dumped) scripts/mod/modpost -a -o /home/alan/GitTrees/linux-2.6/Module.symvers -S vmlinux.o make[1]: *** [vmlinux.o] Error 139 make: *** [vmlinux.o] Error 2 With V=1 make -f scripts/Makefile.build obj=arch/x86/lib (cat /dev/null; ) > arch/x86/lib/modules.order make -f scripts/Makefile.modbuiltin obj=arch/x86/lib (for m in ; do echo kernel/$m; done; \ cat /dev/null ) > arch/x86/lib/modules.builtin ld -m elf_i386 -r -o vmlinux.o arch/x86/kernel/head_32.o arch/x86/kernel/head32.o arch/x86/kernel/head.o arch/x86/kernel/init_task.o init/built-in.o --start-group usr/built-in.o arch/x86/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 block/built-in.o lib/lib.a arch/x86/lib/lib.a lib/built-in.o arch/x86/lib/built-in.o drivers/built-in.o sound/built-in.o firmware/built-in.o arch/x86/pci/built-in.o arch/x86/power/built-in.o arch/x86/video/built-in.o net/built-in.o --end-group make -f /home/alan/GitTrees/linux-2.6/scripts/Makefile.modpost vmlinux.o scripts/mod/modpost -a -o /home/alan/GitTrees/linux-2.6/Module.symvers -S vmlinux.o /bin/sh: line 1: 7152 Segmentation fault (core dumped) scripts/mod/modpost -a -o /home/alan/GitTrees/linux-2.6/Module.symvers -S vmlinux.o make[1]: *** [vmlinux.o] Error 139 make: *** [vmlinux.o] Error 2
So it is modpost rather than gcc or ld that segfaults. That doesn't look like a gcc bug, most probably it is instead kernel bug.
The exact same code compiles correctly under Fedora 12.
Try using setarch when building 32-bit on 64-bit: setarch i386 make <...>
I have used setarch, I have used i386 (which creates a i386 chroot), and I have used ARCH=. All of them give the same segfault results. All of them work on Fedora 12 with the exact same code.
http://git.kernel.org/?p=linux/kernel/git/mmarek/kbuild-2.6.git;a=commitdiff_plain;h=1c938663d58b5b2965976a6f54cc51b5d6f691aa
I have the same problem to build a new kernel-2.6.33.112.fc13.x86_64 on a machine with this kernel. uname -a Linux mariane.enst.fr 2.6.33.5-112.fc13.x86_64 #1 SMP Thu May 27 02:28:31 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux make CHK include/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h LD vmlinux.o MODPOST vmlinux.o /bin/sh: line 1: 27725 Segmentation fault (core dumped) scripts/mod/modpost -a -o /root/rpmbuild/BUILD/kernel-2.6.33.new/Module.symvers -S -c vmlinux.o make[1]: *** [vmlinux.o] Error 139 make: *** [vmlinux.o] Error 2
Try the patch in comment 7. It works for me. (It should get into mainline sometime soon.)
(In reply to comment #9) > Try the patch in comment 7. It works for me. (It should get into mainline > sometime soon.) Sorry, I posted before read your patch, thanks it works !
Patch wen in kernel-2.6.34.1-6.fc13
kernel-2.6.34.3-37.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/kernel-2.6.34.3-37.fc13
kernel-2.6.34.3-37.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update kernel'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/kernel-2.6.34.3-37.fc13
2.6.34 kernel has been withdrawn. This will be fixed in a 2.6.33 update kernel.
kernel-2.6.33.8-149.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/kernel-2.6.33.8-149.fc13
kernel-2.6.33.8-149.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update kernel'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/kernel-2.6.33.8-149.fc13
kernel-2.6.33.8-149.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.