[LLVMdev] [lld] -Bstatic / -Bdynamic switches handling

Oleg Ranevskyy llvm.mail.list at gmail.com
Wed Sep 17 05:30:53 PDT 2014


Hello LLD developers!

Lld is claimed to be compatible with the existing linker options.
However, there is a discrepancy in how the -Bstatic switch (disable 
linking against shared libs) is treated by lld and GNU ld.

According to the GNU ld docs, the switch affects library searching for 
-l options *which follow it*.
This means -Bstatic can be used multiple times in the command line to 
disable dynamic linking for particular -l options. For example:

ld -Bstatic -lslib1 -lslib2 -Bdynamic -ldlib1 -Bstatic -lslib3...

Even though the GNU linker won't search for so-files for slib1, slib2 
and slib3, so-file for dlib1 will still be considered as it is preceded 
by -Bdynamic.

Lld behaves differently.
-Bdynamic is not recognized yet, whereas -Bstatic applies static linkage 
on the binary level, i.e. it's no longer possible to link against any 
shared lib. Lld looks for static archives only if -Bstatic is met in the 
command line.

Is this intentional behaviour or this functionality just hasn't been 
fully implemented yet?

Thank you!

Kind regards,
Oleg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140917/9b7aeaf2/attachment.html>


More information about the llvm-dev mailing list