<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 - clang passes meaningless flags to lld when targeting MacOS"
   href="https://bugs.llvm.org/show_bug.cgi?id=34792">34792</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang passes meaningless flags to lld when targeting MacOS
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Unpack the official Clang 5 .tar.xz from <a href="http://releases.llvm.org/download.html">http://releases.llvm.org/download.html</a>
and try to use it with the bundled copy of LLD:

$ ~/clang+llvm-5.0.0-x86_64-apple-darwin/bin/clang++ numbers.cpp  -fuse-ld=lld  
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
argument: -no_deduplicate
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
argument: -dynamic
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
argument: -arch
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unknown
emulation: acosx_version_min
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error: unable
to find library -lto_library
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld: error:
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/lib/libLTO.dylib: invalid
data encoding
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation)

Oops.

>From clang -v, we see that Clang is passing Apple-linker-specific flags to
ld.lld:

 "/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/bin/ld.lld" -demangle
-lto_library
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/lib/libLTO.dylib
-no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -o a.out
/var/folders/00/14vvr000h01000cxqpysvccm004lgg/T/numbers-0d20ee.o -lc++
-lSystem
/Users/zygoloid/clang+llvm-5.0.0-x86_64-apple-darwin/lib/clang/5.0.0/lib/darwin/libclang_rt.osx.a

Either -fuse-ld=lld should not be supported or it should pass meaningful flags.</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>