Re: Extract static object from dynamic one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brian Dessent wrote:
>
> Tom Browder wrote:
>
>> On Dec 3, 2007 5:21 PM, Thomas Köppe <t.koeppe@xxxxxxxx> wrote:
>>
>>> [...]
>>>
>>> Suppose I have a dynamic C library libfoo.so (or foo.dll) along with
>>> headers in foo.h. Is it possible to build from the binary a static
>>> library libfoo.a?
>>
>> I believe GNU libtool can be used to do that.
>> [...]
>
> Libtool is useful for creating both shared and static at the same
> (build) time, but it won't let you create a static library from an
> already linked shared library.  There is no way to do that, as far as I
> know.  You need to recompile from source.
>
> Brian

I agree that libtool does not deal with binary files in that way; that's why I was thinking about something from binutils.

But is there a reason that it should be impossible in principle to reconstruct a statically linkable object from a shared library? After all, the code is there, I know the function signatures, and relocatable addresses can be resolved to fixed addresses at link time.

Is there an obstruction in principle (that some vital information is lost in the shared library), or is it simply that no such tool has been written?

Many thanks,

Thomas

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux