[LLVMbugs] [Bug 20976] New: The -Bstatic / -Bdynamic switches should be compatible with GNU ld

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 17 07:33:32 PDT 2014


            Bug ID: 20976
           Summary: The -Bstatic / -Bdynamic switches should be compatible
                    with GNU ld
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm.mail.list at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

Lld behaves differently.
-Bdynamic is not recognized at all, whereas -Bstatic applies static linkage on
the output file level. The output file is considered static and 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.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140917/77e3af45/attachment.html>

More information about the llvm-bugs mailing list