On Sep 14, 11:46 pm, John Reiser wrote:
> > If I have an ELF executable that dynamically linked against 6
> > different shared objects, is there a way to link it "again" to
> > pull one of those in as a static library?

> > Or do I have to re-do the link that was used to create the
> > executable?

> In order to do any linking, then /bin/ld requires inputs that are ET_REL.
> You could try using objcopy, and/or --oformat of /bin/ld, to take apart
> the executable and the library, generating pieces that are ET_REL and
> with symbols and relocations intact. Consider using a binary editor
> to change the two-byte tag Elf32_Ehdr.e_type from ET_EXEC or ET_DYN
> into ET_REL. In general you require the "linking view" information
> contained in Elf32_Shdr records (and not the "execution view" information
> contained in Elf32_Phdr records). Any input that has been "stripped"
> will be a disaster.
> Study the loading done at the last stages of making Linux kernels.
> See the Makefiles and ".*.cmd" files [after successful load] in
> linux/arch/$ARCH/boot{,compressed}.
> You could do it yourself, particularly if total cleanliness was not required.
> Concatenate the PT_LOADs, and concatenate/merge the non-PT_LOAD info. The
> output would have as many PT_LOAD as the sum of the input PT_LOAD. Most
> of the tables referenced from the Elf32_Ehdr could move to beyond the end
> of the original ET_EXEC. The old tables may be left in place, unreferenced.
> See also the 'statifier' project http://statifier.sourceforge.net
> and the 'jumpstart' tool http://BitWagon.com/jumpstart/jumpstart.html
> Both of these create "packages" of executables "bound" to shared libraries.

One can also try 'Ermine' (http://magicErmine.com)

> --