<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 - symbol lookup of runtime function with multiple definitions uses different definition in LTO vs. non-LTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=42273">42273</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>symbol lookup of runtime function with multiple definitions uses different definition in LTO vs. non-LTO
          </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>Windows NT
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>efriedma@quicinc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Demonstration:

echo "struct S { int x[100]; }; void f(struct S* s) { s[0] = s[1]; }" > input.c
echo "void* memcpy(void* dest, const void* src, unsigned long size) {}" >
memcpy.c
clang -c input.c
clang -c memcpy.c
clang -flto input.c -c -o input-lto.o
ar cr memcpy.a memcpy.o
clang -shared memcpy.o -o memcpy.so
clang -shared -fuse-ld=lld input.o memcpy.a memcpy.so
nm a.out | grep memcpy
clang -shared -fuse-ld=lld input-lto.o memcpy.a memcpy.so
nm a.out | grep memcpy

The first "nm" (the non-LTO case) prints "T", the second (the LTO case) prints
"U".

Having multiple definitions of memcpy is sort of weird, but it would be nice to
behave consistently here.</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>