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

    <tr>
        <th>Summary</th>
        <td>
            Clang reporting unused function with ifunc resolver
        </td>
    </tr>

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

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

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

<pre>
    Hello!

Clang 16.0.0 and older report a warning when compiling a program that uses `__attribute__((__ifunc__()))` with `-Wunused-function`. The resolver function appears to trigger this when it is only referenced by the `__attribute__`. Here is an example program that should trigger the warning:

```C
static void resolved(void) {
 return;
}

static void (*resolver (void)) (void) {
        return resolved;
}

void indirect_function(void) __attribute__((__ifunc__("resolver")));

int main() {
 indirect_function();
}
```
GCC does not issue a warning for the above program. [Here](https://godbolt.org/z/9f1TnjG7h) is a godbolt.org snippet of the above code to allow you to easily test it. Let me know if you need anymore information.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVF2PqzYQ_TXmZbTIMQHCAw-7G-VeVX1cqY-RwQP41tjIHjZNf31lyAe33epKyNEoM2eOz5mxDEH3FrFm-RvLj4mcaXC-_k3LjzJPGqeu9Xc0xjGxY_zI-Ot6vhtpe9gVKU85SKvAGYUePE7OE0i4SG-17eEyoIXWjZM2MZQwedd7OQINkmAOGIAV_HyWRF43M-H5zMSBicP5rLvZtrewun0Fh4umIda8_DHbOaB6iWmknWUFT-FjQPAYnPlED_d_QE4TSh-AHJDXfY8eaNBhZacJdABnzRU8dujRtqiguQIN-F9yscl39BhrpAX8S46TwZ-vFQY3G7VphXc9WPa6VZEVfP3e1ziQJN3Cp9PqfgvFxCHGTFTAyrc1DzzS7C3LbjErj1vYLcwi3-tDkifaAvgFNuPViv5k8D9tFnxtlfbY0vlhwxPzl7aKOy8mxNPkR7vl1JZglNquc7DR4KvOP5U_2N5VXsNv7--gHAawLjofZtzMa-dWv2TjPh-upsDyt2g6y49MHAaiKUQnxYmJU-9U4wylzvdMnP5m4lR1uw_741s5RL5xTGCTA8HqaUIC120atU5hnE5pjLvA1c0xQBm0uQJhINCUwu9IMCL8ad0FdLdkWUQF0l5HFyfSds6PMkqRJqrOVJVVMsF6VxyqsizKYp8MtVSNUoeOC95JVWTtXnZZVyDucrXfyX2V6FpwkfFyV-32ouBZKmRZKNGWlSgPvOGS7TmOUpvUmM8xXilZRKyLrMrLxMgGTVheEyEsXlaFo7_5MfF1rHlp5j6wPTc6UHiikCaD9fqwrO9INGRd8ucqL-u_zNBjz5PZm_pfpmga5iZt3cjEKXa4_bxM3v3Alpg4LbwCE6eF9z8BAAD__0iYmto">