Using objcopy to replace elftoaout

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using objcopy to replace elftoaout

Jim Gifford
I'm trying to get rid of using the elftoaout tool in my silo and linux
kernel builds, since the tool is not being maintained.

The problem I have is .rodata gives me errors in the conversion.
BFD: arch/sparc64/boot/vmlinux.aout: can not represent section `.rodata'
in a.out object file format

In my research I found this
http://mail-index.netbsd.org/netbsd-bugs/2001/04/04/0006.html

Which basically said the elftoaout converts symbols to .text.
"elftoaout(1) folds .rodata and .data section into text"

How can I accomplish this using objcopy?

--
----
Jim Gifford
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Using objcopy to replace elftoaout

Nick Clifton
Hi Jim,

> Which basically said the elftoaout converts symbols to .text.
> "elftoaout(1) folds .rodata and .data section into text"
>
> How can I accomplish this using objcopy?

I do not believe that objcopy can do this (at the moment, anyway).  What
you need is the ability to merge one section into another.  One thing
that might work, although it is rather complicated and completely
untested is:

   Make a copy of the file.

   In the copy use "objcopy --remove-section ..." to remove all sections
except say the .rodata section.

   Then use "objcopy --rename-section
.rodata=.text,alloc,load,readonly,code,contents" to get a .text section.

   Repeat the first three steps to get another file which contains the
.data section renamed to .text.

   Now use "objcopy --remove-section..." to remove the .rodata and .data
sections from the original file.

   Finally use the linker to link together these three new files, all of
which contain .text sections.  The linker should now merge these
sections together giving you the output that you want.


Or you could just write a patch for objcopy that does all of this for you...

Cheers
   Nick