<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56385>56385</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            lld: symbol foo@@ has undefined version when linking with lld
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          eastB233
      </td>
    </tr>
</table>

<pre>
    Hi everyone, I use LLVM 12 on AArch64 backend, and I try to compile the following reduced test case and get the undefined version errors.
```
$ cat foo.c
void _foo() { return; }
asm(".symver _foo, foo@@");

$ clang -O2 -fuse-ld=lld foo.c -fPIC -shared -o liba.so
ld.lld: error: /tmp/foo-535714.o: symbol foo@@ has undefined version
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
$ clang -O2 -fuse-ld=gold foo.c -fPIC -shared -o liba.so
$ clang -O2 -fuse-ld=ld foo.c -fPIC -shared -o liba.so
$
```
It is OK if I use `ld.gold` or `ld`, but gets errors if I use `lld`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNUsuO2zAM_Br5Qtiw5Vdy8CHZoOiiW2xPvRayRdvqKlYgyUnz96XsLIJFHwgg2KLIGZJDtkZem88K8Iz2aiZk_AmeYXYILy_fv0LGwUyw29lurApoRfeGkwwxYpIU5-0VvIHOHE9KI_gRoTdam4uaBrAo5w4leHQeOkGUATSgX-LmSWKvJvJTZqcoC1prrEtYemDpjlXp7awmL4jCE7tJuvXpbJSEH_TA-IbxLbB6Tyn9bCeW78k6rGHCHZcAnrjrkVLdIE-BihVpOJwTnkC3VPeEWlAb8SuHuCdFYi1ZftBarlXQ47fnJ4jdKKhTiA1o1YrEmZVAy0QHwG7tK1wY_-SPJ_oSPi7zss6KxAQHVdYafa8IRuH-FGjlXYqKM_6BWavpjVqjORyDxr2gaUi4KD8C_lKkvpEIGRWwCZONz2FoDhHUdDYkayAnBf7f-GAe7Pzf0j2M_-sOPHtQDl6_gOpvK0oukjkURjcwdn0IAJpvO_uwbO62Vx9RS1QSySaX23wrIq-8xuY2sMfGAZcRp0X5sOyL1oSPZqub0fuTIyYaNZ2BXHOb0HDI0Pr8_otP1vzEzpOpnJvR0aWs8k0ZjU3a9zyTeb3NK0zLou76ohdllVa8En2d80iLFrVrWLln5SFSDU85T-u0zHi5yeoEs1bwAiuJ-bYvi466wCNtRRISJ8YOkW2WGtp5cOTUynl3dwrn1DAhvvOL2Y_GNiic3_M8j5Z6m6XY31kXUAw">