We are currently attempting to remove the use of elftoaout from our builds for Silo and the vmlinux.aout kernel. Our first attempt was utilizing objcopy, but we received these errors. BFD: arch/sparc64/boot/vmlinux.aout: can not represent section `.rodata' in a.out object file format objcopy: arch/sparc64/boot/vmlinux.aout: Nonrepresentable section on output objcopy: arch/sparc64/boot/vmlinux.aout: File truncated When we researched, we found out that .rodata in elftoaout is moved into .text. http://mail-index.netbsd.org/netbsd-bugs/2001/04/04/0006.html We know a solution is probably utilizing a ld.script, but need guidance in correcting this issue. PowerPC also uses openfirmware, we are looking into that as a starting point. Also related to this is silo build, which even using elftoaout fails, we have most of the fixes utilizing objcopy, but a few of the files have the .rodata issue as well.
Copy of a working vmlinux.aout is available from http://ftp.jg555.com/vmlinux.aout.bz2 unable to attached due to it's size
Created attachment 704 [details] Modifed version of silo to utilize objcopy This shows the modifications we are making and also demostrates the errors messages we are seeing on a smaller scale.
Please provide all input files needed to reproduce it with a cross binutils.
Created attachment 705 [details] Sparc 64 - netboot config Kernel config for 2.6.12.6 sparc 64 build. use make vmlinux.aout to build
To build the attached silo use make CROSS_COMPILE="sparc64-unknown-linux-gnu-" Our build instructions are located at http://www.linuxfromscratch.org/lfs/view/cross-lfs/sparc64/
Created attachment 706 [details] Modifed version of silo to utilize objcopy This is the corrected build version which demostrates the build error we are also seeing in the kernel builds.
Error message for the silo build (to show that it's the same) objcopy -I elf32-sparc -O a.out-sunos-big second second.aout BFD: second.aout: can not represent section `.rodata' in a.out object file format objcopy: second.aout: Nonrepresentable section on output BFD: second.aout: can not represent section `.rodata' in a.out object file format objcopy: second.aout: Nonrepresentable section on output make[1]: *** [second.b] Error 1 make[1]: Leaving directory `/usr/src/silo-1.4.9/second' make: *** [all] Error 1
Please provide all input .o/.a files. I have cross binutils, but not cross gcc.
Created attachment 707 [details] Source with .o files
Created attachment 708 [details] Working silo.b files
Please show me how I can duplicate the problem on Linux/x86 with the cross linker.
Steps to recreate cd /usr/src/silo-1.4.9/second objcopy -I elf32-sparc -O a.out-sunos-big second second.aout
I understand objcopy won't work and I am not sure if there is anything we can do with objcopy. The best hope is to make the linke to generate kernel in a.out from the ELF .o files. To check it out, I need 1. All input files for cross linker 2. The working kernel in a.out from elf2aout
Unable to attach them due to there size. But have made them available on my server for public download until this bug is resolved. http://ftp.jg555.com/linux.tar.bz2 - all .a and .o files build.sh http://ftp.jg555.com/vmlinux.aout.bz2 - a working elftoaout conversion file All files are compressed
Created attachment 711 [details] A linker script Can you try this linker script and change "-m elf64_sparc" to "-m sun4"?
changed "-m elf64_sparc" to "-m sun4" Received following error on every file ld: warning: sparc:v9 architecture of input file ` ' is incompatible with sparc output It did create a file and I did attempt to boot. Said file was not an executable and exited.
The odd thing is vmlinux is 64bit and sun4 32bit. Does objcopy work with 32bit vmlinux?
Yes it does.
So, the problem is objcopy can't covert 64bit SPARC/ELF to 32bit SPARC/a.out. Could you post the working 32bit kernel linker script?
It looks like objcopy bug. Please try this patch http://sourceware.org/ml/binutils/2005-10/msg00420.html
I checked in my patch. I think objcopy should work now as long as you don't create those sections which a.out doesn't support.