<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LLD does not find system libraries on NetBSD"
   href="https://bugs.llvm.org/show_bug.cgi?id=33155">33155</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD does not find system libraries on NetBSD
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>NetBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>n54@gmx.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang with LLD cannot build any executable that uses regular system libraries.

$ cat test.c                                                                    
#include <stdio.h>
int main(int argc, char **argv)
{
        printf("Hello world!\n");
        return 0;
}

$ clang -v -fuse-ld=lld test.c 
clang version 5.0.0 (trunk)
Target: x86_64-unknown-netbsd7.99
Thread model: posix
InstalledDir: /usr/pkg/bin
 "/usr/pkg/bin/clang-5.0" -cc1 -triple x86_64-unknown-netbsd7.99 -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name test.c -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/pkg/lib/clang/5.0.0 -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 157 -fobjc-runtime=gnustep -fdiagnostics-show-option
-fcolor-diagnostics -o /var/tmp/test-24ce18.o -x c test.c
clang -cc1 version 5.0.0 based upon LLVM 5.0.0svn default target
x86_64-unknown-netbsd7.99
#include "..." search starts here:
#include <...> search starts here:
 /usr/pkg/lib/clang/5.0.0/include
 /usr/include
End of search list.
 "/usr/pkg/bin/ld.lld" --eh-frame-hdr -dynamic-linker /libexec/ld.elf_so -o
a.out /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o
/var/tmp/test-24ce18.o -lc /usr/lib/crtend.o /usr/lib/crtn.o
/usr/pkg/bin/ld.lld: error: unable to find library -lc
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation)

LLVM+Clang+LLD SVN r. 303743 (pre 5.0.0)

It's not a recent regression, it was that since ever I was trying to use it.


For the comparison GNU ld(1) works

$ clang -v -fuse-ld=ld test.c   
clang version 5.0.0 (trunk)
Target: x86_64-unknown-netbsd7.99
Thread model: posix
InstalledDir: /usr/pkg/bin
 "/usr/pkg/bin/clang-5.0" -cc1 -triple x86_64-unknown-netbsd7.99 -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name test.c -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/pkg/lib/clang/5.0.0 -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 157 -fobjc-runtime=gnustep -fdiagnostics-show-option
-fcolor-diagnostics -o /var/tmp/test-a8fc54.o -x c test.c
clang -cc1 version 5.0.0 based upon LLVM 5.0.0svn default target
x86_64-unknown-netbsd7.99
#include "..." search starts here:
#include <...> search starts here:
 /usr/pkg/lib/clang/5.0.0/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld.elf_so -o a.out
/usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o /var/tmp/test-a8fc54.o -lc
/usr/lib/crtend.o /usr/lib/crtn.o</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>