[clang] [clang-tools-extra] [llvm] [Clang] Fix linker error for function multiversioning (PR #71706)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 22 16:20:27 PST 2023


https://github.com/tahonermann requested changes to this pull request.

I requested some minor changes.

Can we document the `.ifunc` symbols as a deprecated feature? With this change, they will never be referenced except by code compiled by older compiler versions. Maybe plan to deprecate them a year from now?

It looks like there is a related issue in which multiple ifunc symbols are emitted for the `cpu_dispatch` attribute. See https://godbolt.org/z/71vr8ceza. The relevant symbols emitted are listed below. Note that both `_Z12cpu_specificv` and `_Z12cpu_specificv.ifunc` are "i" symbols with the same address. The caller in this case calls the `.ifunc` symbol (just as for `target_clones` prior to this change). It would be nice if we can fix this issue at the same time and likewise deprecate the `.ifunc` symbol for `cpu_dispatch`/`cpu_specific`.
```
00000000000024c0 i _Z12cpu_specificv
0000000000002480 T _Z12cpu_specificv.A
0000000000002490 T _Z12cpu_specificv.M
00000000000024c0 i _Z12cpu_specificv.ifunc
00000000000024c0 W _Z12cpu_specificv.resolver
```

I think the only time a symbol with a `.ifunc` suffix is actually needed is when the `target` attribute is used in an overloading context (since in that situation, the `target(default)` definition gets the non-suffixed name.

https://github.com/llvm/llvm-project/pull/71706


More information about the cfe-commits mailing list