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

    <tr>
        <th>Summary</th>
        <td>
            [FMV] mangling of forward-declared multi-versioned callee differs between gcc and clang
        </td>
    </tr>

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

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

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

<pre>
    https://clang.godbolt.org/z/zeeTxd3va

```
__attribute__((target_version("fp16")))
void foo(void);

__attribute__((target_version("fp16fml")))
void foo(void);

__attribute__((target_version("default")))
void foo(void);

void caller() {
    foo();
}
```

Note how clang calls it `_Z3foov.ifunc`, and gcc refers to it as `_Z3foov`. IMO gcc's behavior is the desirable one: it lets you forward-declare foo in a header without having to promise that the implementation is multi-versioned. This is useful for libraries that have to provide a stable ABI to be able to adopt FMV in the implementation of those interfaces, without having to write an excessive number of shims.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VMGOpDYQ_RpzKQ0yBpruA4eetJD2MMlltYdcWjYug1cGt-yC3s3XR_YgZTPZSyJFcruxefVelf0oGaOdVsSeta-svRVyo9mH_mvw6LyJhfL6ez8TPSKrr0wMTAyjk-tUTl4r76j0YWJi-CP9ED9_0_UuGb8xfj3mEz9GXt7vkihYtRHe70ycmTiTDBPSfccQrV_znjCP6sSEYOJyjBy8e6vBeM_EOT2m_fr1R7F_wW4W9_8JaDRyc_QfBDJglM5hyFQXYN0BAIAj9G9h3e2nB_0-_-oJYfZPyHeWiSNYAnbi999r4_1eWrOtYwoTv4BcNUzjCAENhgjkE1bGH-DsxEv49PZbgjHRRVA4y936ADYCzQgaow1SOQS_IquvicEhRfjuNzA-PGXQLxpHJwOmcsCuIGFGqTHA09LsN4JEuU5J_xH8YiMCzZIyv10eDhdcSZL1a1JdNkf25Th_1CV8nm1ML7aIZnNJFJxVQQaL8Z1oljse7LvVCBIi5Zyvr5_SvkLIS_IgtX8QDG9fUqI_ScAboNlHBLsSBiNHjOkk_1nJM1hCkCvgtxFjtDvCui0KQ6KIs11iWei-1pf6Igvsq453dVNdOl7Mfa3P3fmkTaM61Yiqa7mR2kh9arqmbc6msL3gouGCd6KqLzUvZVWptq2786lS7XjirOG4SOtK5_YlfbOFjXHD_lzxpi6cVOhibgFCZKsk67a3IvQJ_6K2KbKGOxsp_sVAllzuG8PbF9beYJHr5FK13ny8af3xlt49jqCtyVZTSE_ENbsvuTAnUWzBfeg9k6V5U-XoFyaGlMnx9_II_iuOxMSQC4tMDLm2PwMAAP__wpaOHw">