https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95780
Bug ID: 95780 Summary: target_clones treats internal visibility different from static functions Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: yyc1992 at gmail dot com Target Milestone: --- Again using the code in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95778. If the static function `f2` is changed to `visibility("internal")`, i.e. ``` __attribute__((visibility("internal"),noinline,target_clones("default,avx2"))) int f2(int *p) { asm volatile ("" :: "r"(p) : "memory"); return *p; } __attribute__((noinline,target_clones("default,avx2"))) int g2(int *p) { return f2(p); } ``` the call to `f2` will then use the PLT again. Without `target_clone` the two has similar effects and both produce a direct call.