https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81214
Bug ID: 81214 Summary: GCC target_clone support does not work for global functions with no references Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: meissner at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- Created attachment 41633 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41633&action=edit Test case. If you define a global target_clone function but there are no references to it, because the references will be in another file, the compiler deletes the ifunc entry and the ifunc resolver function, but it leaves the target clone functions (which no longer have references to them once the resolver function was deleted). The following is the NM output from the attached file compiled with -O3: $ file="test-x86-clone3"; ~/fsf-install-x86_64/trunk-249567-x86_64/bin/gcc -O3 -save-temps -c $file.c && nm $file.o 00000000000001b0 t vadd.arch_core_avx2.2.default.3 0000000000000150 t vadd.arch_slm.1.default.4 0000000000000060 t vadd.avx.0.default.5 0000000000000000 T vadd.default.6