This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using objcopy to replace elftoaout


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]