<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Unconditionally passed `-lto_library` to the linker on Darwin confused by symlinks"
   href="https://llvm.org/bugs/show_bug.cgi?id=30811">30811</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unconditionally passed `-lto_library` to the linker on Darwin confused by symlinks
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>howarth.mailing.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The change <a href="https://reviews.llvm.org/rL285254">https://reviews.llvm.org/rL285254</a> to unconditionally pass
`-lto_library` to the linker on Darwin is confused by the use of compiler
symlinks.

This approach doesn't work if the user installs clang in a buried subdirectory
such as /sw/opt/llvm-4.0 but accesses the compilers via a /sw/bin/clang-4.0
symlink pointing at /sw/opt/llvm-4.0/bin/clang-4.0...

$ /sw/bin/clang-4.0 -flto himenoBMTxpa.c
clang-4.0: warning: libLTO.dylib relative to clang installed dir not found;
using 'ld' default search path instead [-Wliblto]
...
"/usr/bin/ld" -demangle -object_path_lto
/var/folders/vh/xthx1f251nqfj804049zl1wm0000gn/T/cc-083c59.o -no_deduplicate
-dynamic -arch x86_64 -macosx_version_min 10.11.0 -o a.out
/var/folders/vh/xthx1f251nqfj804049zl1wm0000gn/T/himenoBMTxpa-34b8ea.o -lSystem
/sw/opt/llvm-4.0/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a

$ /sw/opt/llvm-4.0/bin/clang-4.0 -flto himenoBMTxpa.c -v
...
"/usr/bin/ld" -demangle -object_path_lto
/var/folders/vh/xthx1f251nqfj804049zl1wm0000gn/T/cc-afbbef.o -lto_library
/sw/opt/llvm-4.0/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64
-macosx_version_min 10.11.0 -o a.out
/var/folders/vh/xthx1f251nqfj804049zl1wm0000gn/T/himenoBMTxpa-44b09e.o -lSystem
/sw/opt/llvm-4.0/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a</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>