<html>
    <head>
      <base href="http://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 --- - Build failure with gcc LTO"
   href="http://llvm.org/bugs/show_bug.cgi?id=18301">18301</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Build failure with gcc LTO
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>octoploid@yandex.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When I try to build LLVM with gcc -flto I get:

lib/libLLVMAsmParser.so: error: undefined reference to
'llvm::SymbolTableListTraits<llvm::BasicBlock,
llvm::Function>::transferNodesFromList(llvm::ilist_traits<llvm::BasicBlo
ck>&, llvm::ilist_iterator<llvm::BasicBlock>,
llvm::ilist_iterator<llvm::BasicBlock>)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed

This happens because the symbol is undefined in LLParser.cpp.o:
  % nm lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o | grep
_ZN4llvm21SymbolTableListTraitsINS_10BasicBlockENS_8FunctionEE21transferNodesFromListERNS_12ilist_traitsIS1_EENS_14ilist_iteratorIS1_EES8_
                 U
_ZN4llvm21SymbolTableListTraitsINS_10BasicBlockENS_8FunctionEE21transferNodesFromListERNS_12ilist_traitsIS1_EENS_14ilist_iteratorIS1_EES8_

And with -flto the weak symbol in lib/libLLVMCore.so is optimized out.
(Without lto one has:
lib/libLLVMCore.so:
0000000000071e90 W
_ZN4llvm21SymbolTableListTraitsINS_10BasicBlockENS_8FunctionEE21transferNodesFromListERNS_12ilist_traitsIS1_EENS_14ilist_iteratorIS1_EES8
and everything works fine)

I think an explicit instantiation of the SymbolTableListTraits template
is missing in LLParser.cpp.</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>