https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81213

            Bug ID: 81213
           Summary: GCC target_clone support does not work for static
                    functions
           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 41632
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41632&action=edit
Test case.

The current target_clone support does not work if the function is static.  The
ifunc entry has to be a global entry point for ifunc to work.  The code does
not change the name for the ifunc handler to be unique.

With attached source compiled for -O3, the following are the symbols in the
object file.

-> ~/fsf-install-x86_64/trunk-249567-x86_64/bin/gcc -O3  -save-temps -c
test-x86-clone2.c && nm test-x86-clone2.o
                 U __cpu_indicator_init
                 U __cpu_model
0000000000000540 i vadd
0000000000000380 t vadd.arch_core_avx2.2.default.3
00000000000002a0 t vadd.arch_slm.1.default.4
00000000000000e0 t vadd.avx.0.default.5
0000000000000000 t vadd.default.6
0000000000000540 T vadd._GLOBAL___vdbl.resolver
0000000000000590 T vdbl

Note that vadd is external (which it needs to be), but it isn't unique.

The resolver function is external, but it doesn't need to be external.  It can
be internal.  The function name is changed by calling make_unique_name in the
i386.c function make_resolver_func.  The i386 code explicitly sets the resolver
function to static, but it is changed in the machine dependent code.

Reply via email to