<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 - .symver directive not properly handled with -flto=thin"
   href="https://bugs.llvm.org/show_bug.cgi?id=37065">37065</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>.symver directive not properly handled with -flto=thin
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>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>thomasanderson@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang version 7.0.0 (trunk 328716)

Using .symver to bind an imported symbol to a specific version causes problems
with LTO.  The symbol with the version appears to be defined when it shouldn't
be.  This causes a build failure when linking multiple bitcode files that both
want to import the symbol as now the symbol is duplicated.

$ cat test.c
#include <math.h>

__asm__(".symver exp2f, <a href="mailto:exp2f@GLIBC_2.2.5">exp2f@GLIBC_2.2.5</a>");
float test(float f) {
  return exp2f(f);
}

$ clang test.c -c -o test.o
$ nm test.o | grep exp2f
                 U <a href="mailto:exp2f@GLIBC_2.2.5">exp2f@GLIBC_2.2.5</a>

$ clang test.c -c -o test.o -flto=thin
$ llvm-nm-5.0 test.o | grep exp2f
                 U exp2f
                 U exp2f
---------------- T <a href="mailto:exp2f@GLIBC_2.2.5">exp2f@GLIBC_2.2.5</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>