<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 --- - thinlto link failure"
   href="https://llvm.org/bugs/show_bug.cgi?id=31027">31027</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>thinlto link failure
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>parag.warudkar@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Trying to build ZeroC ICE (<a href="https://zeroc.com/distributions/ice#source">https://zeroc.com/distributions/ice#source</a>) on
Ubuntu 14.04 using clang++-3.9. 

/usr/bin/ld is symlinked to /usr/bin/ld.gold. The build fails in
<SRC>/cpp/src/slice2cs directory if -flto=thin is used. 

clang++-3.9 -rdynamic -m64 -flto=thin -fvisibility=hidden -Wall -Werror
-pthread -fPIC -g -L../../lib/x86_64-linux-gnu -Wl,--disable-new-dtags
-Wl,-rpath,\$ORIGIN/../lib/x86_64-linux-gnu -o ../../bin/slice2cs Gen.o Main.o
-lSlice -lIceUtil
Gen.cpp:2996: error: undefined reference to
'Slice::Gen::TieVisitor::TieVisitor(IceUtilInternal::Output&)'
Gen.cpp:3003: error: undefined reference to
'Slice::Gen::ImplVisitor::ImplVisitor(IceUtilInternal::Output&)'
Gen.cpp:3010: error: undefined reference to
'Slice::Gen::ImplTieVisitor::ImplTieVisitor(IceUtilInternal::Output&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Replacing the -flto=thin with just -flto and keeping the same rest of the
command line the link succeeds. I am not sure however since normal LTO
succeeds, it looks like this is a bug with ThinLTO?

[ If anyone wants to reproduce this, ICE is easy to build with few dependencies
 -mcpp, libssl-dev etc- and requires passing CXX=clang++-3.9 to make along with
modifying the Make.rules.Linux to treat clang++-3.9 as g++ and adding
-flto=thin to CXXFLAGS.]</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>