Bug 1472 - Sparc a.out using binutils -
Summary: Sparc a.out using binutils -
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-13 21:42 UTC by Jim Gifford
Modified: 2005-10-28 17:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Modifed version of silo to utilize objcopy (148.64 KB, application/octet-stream)
2005-10-13 21:53 UTC, Jim Gifford
Details
Sparc 64 - netboot config (4.35 KB, text/plain)
2005-10-13 22:13 UTC, Jim Gifford
Details
Modifed version of silo to utilize objcopy (142.65 KB, application/octet-stream)
2005-10-13 22:23 UTC, Jim Gifford
Details
Source with .o files (355.45 KB, application/octet-stream)
2005-10-14 01:44 UTC, Jim Gifford
Details
Working silo.b files (108.12 KB, application/octet-stream)
2005-10-14 01:45 UTC, Jim Gifford
Details
A linker script (889 bytes, text/plain)
2005-10-14 17:01 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Gifford 2005-10-13 21:42:21 UTC
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.
Comment 1 Jim Gifford 2005-10-13 21:52:24 UTC
Copy of a working vmlinux.aout is available from 
http://ftp.jg555.com/vmlinux.aout.bz2 unable to attached due to it's size
Comment 2 Jim Gifford 2005-10-13 21:53:26 UTC
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.
Comment 3 H.J. Lu 2005-10-13 22:00:58 UTC
Please provide all input files needed to reproduce it with a cross binutils.
Comment 4 Jim Gifford 2005-10-13 22:13:16 UTC
Created attachment 705 [details]
Sparc 64 - netboot config

Kernel config for 2.6.12.6 sparc 64 build.

use make vmlinux.aout to build
Comment 5 Jim Gifford 2005-10-13 22:15:01 UTC
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/
Comment 6 Jim Gifford 2005-10-13 22:23:04 UTC
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.
Comment 7 Jim Gifford 2005-10-13 22:24:50 UTC
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
Comment 8 H.J. Lu 2005-10-13 23:23:14 UTC
Please provide all input .o/.a files. I have cross binutils, but not cross gcc.
Comment 9 Jim Gifford 2005-10-14 01:44:04 UTC
Created attachment 707 [details]
Source with .o files
Comment 10 Jim Gifford 2005-10-14 01:45:10 UTC
Created attachment 708 [details]
Working silo.b files
Comment 11 H.J. Lu 2005-10-14 03:08:44 UTC
Please show me how I can duplicate the problem on Linux/x86 with the
cross linker.
Comment 12 Jim Gifford 2005-10-14 03:36:24 UTC
Steps to recreate

cd /usr/src/silo-1.4.9/second
objcopy -I elf32-sparc -O a.out-sunos-big second second.aout
Comment 13 H.J. Lu 2005-10-14 04:27:36 UTC
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
Comment 14 Jim Gifford 2005-10-14 04:52:40 UTC
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
Comment 15 H.J. Lu 2005-10-14 17:01:53 UTC
Created attachment 711 [details]
A linker script

Can you try this linker script and change "-m elf64_sparc" to "-m sun4"?
Comment 16 Jim Gifford 2005-10-15 04:27:28 UTC
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.
Comment 17 H.J. Lu 2005-10-20 21:13:58 UTC
The odd thing is vmlinux is 64bit and sun4 32bit. Does objcopy work with
32bit vmlinux?
Comment 18 Jim Gifford 2005-10-23 18:20:31 UTC
Yes it does.
Comment 19 H.J. Lu 2005-10-24 00:38:20 UTC
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?
Comment 20 H.J. Lu 2005-10-27 16:31:16 UTC
It looks like objcopy bug. Please try this patch

http://sourceware.org/ml/binutils/2005-10/msg00420.html
Comment 21 H.J. Lu 2005-10-28 17:05:58 UTC
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.