<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 --- - LLD fails to link an obj using versioned symbols"
   href="https://llvm.org/bugs/show_bug.cgi?id=31261">31261</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD fails to link an obj using versioned symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mail+llvm@tzik.jp
          </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>LLD fails to handle a .symver hack done in gRPC.
<a href="https://chromium.googlesource.com/external/github.com/grpc/grpc/+/master/src/core/lib/support/wrap_memcpy.c">https://chromium.googlesource.com/external/github.com/grpc/grpc/+/master/src/core/lib/support/wrap_memcpy.c</a>

Here is a repro case:
----
$ cat > failcase.s <<EOF
  .text
  <a href="mailto:memcpy@GLIBC_2.2.5">memcpy@GLIBC_2.2.5</a> = memcpy

  .globl main
  .p2align 4, 0x90
  .type main,@function
main:
  callq»  memcpy
  retq
EOF
$ clang -fuse-ld=lld failcase.s
symbol <a href="mailto:memcpy@GLIBC_2.2.5">memcpy@GLIBC_2.2.5</a> has undefined version GLIBC_2.2.5
----

Or, in C.
----
$ cat > failcase.c <<EOF
__asm__(".symver memcpy,<a href="mailto:memcpy@GLIBC_2.2.5">memcpy@GLIBC_2.2.5</a>");

void* memcpy(void* dest, const void* src, unsigned long size);

void* foo(void* dest, const void* src, unsigned long size) {
  return memcpy(dest, src, size);
}

int main(int argc, const char** argv) {
   return 0;
}
EOF
$ clang -fuse-ld=lld failcase.c
symbol <a href="mailto:memcpy@GLIBC_2.2.5">memcpy@GLIBC_2.2.5</a> has undefined version GLIBC_2.2.5
----</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>