This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: restoring archive from execuable
- From: "J. Grant" <jg-lists at jguk dot org>
- To: Nicolae Mihalache <mache at abcpages dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 24 Oct 2003 20:08:26 +0100
- Subject: Re: restoring archive from execuable
- References: <3F98D6DA.6050205@abcpages.com> <Pine.LNX.4.58.0310240352010.17408@portland.hansa.lan> <3F98E1FA.9060108@abcpages.com>
Hello,
Could you please point me to a document explaining how all these things
work? In my ignorance I thought that a library is simply a collection of
function code that is copied into the executable at linking time and
moving them back in a library means only to know where exactly they have
been copied. Now, I realise that they can not be copied just like that,
the memory addresses that are used inside the objects have somehow to be
changed to fit with the memory addresses used in the executable.
An archive is mealy a collection of object files. When linked to
program code with ld, the resulting elf contains a combination of all
sections and object code etc. (See ar and ld documentation)
I do not know of a easy way to recover a collection of object files
which you could then link to from another program. You could try
disassembling and writing new code if the library is not very complex or
find an equivalent library to use.
JG