Option -static

H.J. Lu hjl.tools@gmail.com
Thu Jan 7 18:14:00 GMT 2010

On Thu, Jan 7, 2010 at 10:02 AM, Ian Lance Taylor <iant@google.com> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>> On Thu, Jan 7, 2010 at 9:26 AM, Takis Psarogiannakopoulos
>> <takis@xfree86.org> wrote:
>>> On Thu, 7 Jan 2010, Jakub Jelinek wrote:
>>>> You can use -Bstatic -la -lb -ld -Bdynamic -le
>>>> to link liba.a, libb.b, libd.a and libe.so (or libe.a if libe.a doesn't
>>>> exist).
>>> You are right, in my example,  but in general that means that you have
>>> specific knowledge of which libs are static and which are in dynamic form
>>> in the system.
>>> I was thinking over a more wide approach where a certain lib doesnt not
>>> exists on static form and of course you would still want the final linking to
>>> take place right? In such a scenario if the ld decides by itself to use
>>> what is available (prinitng a warning) violating the -static option seems
>>> to me not that much wrong.
>>> Anyway if thats the case withthe  out of the box gnu ld maybe gold hould
>>> stick with it too.
>> You are looking for a new option, something like -prefer-static.
> If anybody actually implements this, I think better would be something
> like -Bprefer-static and -Bprefer-dynamic, and make them position
> dependent like -Bstatic and -Bdynamic.

Sounds good to me.


More information about the Binutils mailing list