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

    <tr>
        <th>Summary</th>
        <td>
            "ifunc must point to a defined function" error for static IFUNC resolver functions in C++ mode
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The following code compiles correctly (using both Clang 13.0.1 and trunk) in C mode, but returns an "ifunc must point to a defined function" when compiled with `clang++`.

```c
#ifdef __cplusplus
extern "C" {
#endif

__attribute__((used)) static void* resolve_foo() {
    return 0;
}

__attribute__((ifunc("resolve_foo"))) void foo();
#ifdef __cplusplus
}
#endif
```

The documentation explicitly states that IFUNC resolver functions may be `static`, so I think this is a bug.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVU02ToyAQ_TV66VqLoCbx4GGS1FTNZU-7ZwuljewgWIDJ5N9vY75mDlNbayGCDe91Px6tlZf614DQW63tWZkjdFYideOkNHoaOIdd0BdI-Hb2cUFrwwB7LWi4yjOWrUAYCcHN5j3hFSgDexgJJOF7aOcADsPsjKdVhMFVP5sOxtkHmKwyAYIFARJ7ZVBCDAZlDS2E84DmnoiEsyLWZM26SJzwXWxrliXskLCXW79m19bd5jxXPSFD03STnn18rxH8COiWdPaRKdnsHjvQSNV_Rm0aEYJTVAk2DYmw6ICSSo3V-iCC6uBkFf15oVq91SdsemuXpdUTG-i5SgEsye-Em8M_uBa9liH_As6vCUSKSA4Pxif2t-U_Wb_We9fvc0rRHNJ284gmlmoN4MekVaeiJ2L1ZJIwiABvr79_7u8CuMdJehjFBVqMZ3cVKxKQNbyFN9qpzHvsPVAT5Jdjlso6l1VeiTQQCdb_ZRp0zhI5vbeT-Tat6NOrjxa3prPT9RDC5JOcdHmldiTLzW1GFqSJ1qf758fk7B-6FDRV3s_oaVAWZVGlQ11WZdlJuaoE2_RtL3LZ9kxuW4ai52LDUy1a1L5OSmLmBs-wQMTzLA-pqjnjnOW8ZNtyXZQZoz09tpJttpuyK4qkYDgKpbOYR2bdMXX1khIJ5ymolQ_-GRTeq6NBXOgIX8xhsK7eoQuC7hERRvJ6Sf4vVGFE-w">