This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: objcopy question
- To: "Roberts, Jeffery M" <jeffery dot m dot roberts at opbu dot xerox dot com>
- Subject: Re: objcopy question
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 05 Oct 2001 20:10:44 +0100
- Cc: "'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- References: <C9CFA3B7B0EFD3119D2600508B556DC138ACF4@UsaWvMS04.opbu.xerox.com>
Hi Jeffery,
> We're using a gcc variant provided by WindRiver for use with the
> VxWorks OS.
Since WindRiver sell support for their OS, and its tools, you should
probably ask them this question, however...
> I'd like to be able to add some text (version) information to object
> files using objcopy --add-section.
Why ? Why not just create some assembler source containing the text
you want to add, using a section name that you want to use, and then
just assemble it and link it in as a normal object file ?
> Are there any gotchas in doing this?
Well it depends upon the file format you are using. Not all file
formats can support arbitrary section names. Also if you use the name
of an already existing section you may get some strange behaviour.
But in general it should just work.
> Can this be done in object files that are linked during the build
> process, or dynamically linked later?
I doubt if it will work satisfactorily on dynamically linked files.
It would be best to stick to altering object files before they are
linked.
> Also, I've noticed that I can only add one new section to the object
> file. Is this normal?
No. You should be able to use the --add-section switch multiple times
to add multiple sections. Of course you may have an old/buggy version
of objcopy.
Cheers
Nick