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

    <tr>
        <th>Summary</th>
        <td>
            [clang] attribute `__attribute__ ((ifunc("resolve_multiver")))` is accepted even when not supported by the platform (linux-musl)
        </td>
    </tr>

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

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

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

<pre>
    Hi all,

The symptoms of this issue are identical to https://github.com/llvm/llvm-project/issues/64631: The musl dynamic linker will complain about `unknown relocation 37`.

I stumbled into this issue when porting a GCC test ([ipa-pta-19.c](https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/ipa/ipa-pta-19.c)) into RISC-V Clang, except of course in RISC-V the relocation number is different, so I see `unsupported relocation type 58` instead (`R_RISCV_IRELATIVE`)

There are two strange things:
- The commit that should have fixed https://github.com/llvm/llvm-project/issues/64631 ([0c3a02b8c09bb](https://github.com/llvm/llvm-project/commit/0c3a02b8c09bb408a74a638a263e51d67c92ca74) Function multi-versioning: disable ifunc for ELF targets other than glibc/Android/FreeBSD) doesn't have any effect in my case
- but it *also* doesn't seem to have any effect in the test case that was originally posted in https://github.com/llvm/llvm-project/issues/64631.

So far I've tried with the following LLVM versions:
- 18.1.5
- 17.0.5
- commit `0c3a02b8c09bb` (the exact commit that should have introduced the fix)

Perhaps it never got tested? I noticed while debugging clang, that the function `supportsIFunc` never actually gets called
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVV1v4ygX_jXk5igRwYkdX-Si047fN1JXWs2MehthOLbZwWDBcdL8-xW4nbb7Ke1IlRss85zD83GQMZreIR7Z_hPbP6zkTIMPx1G21jh_WbVe347_NyCtZeKe8QfG75bntwEh3saJ_BjBd0CDiWBinBFkQDAaHRklLZCHgWiKrLhjomGi6Q0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