[all-commits] [llvm/llvm-project] cee5b8: [Clang] Fix linker error for function multiversio...

elizabethandrews via All-commits all-commits at lists.llvm.org
Tue Dec 5 15:12:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cee5b8777fa98312b05bf8aa81554910a8f867c5
      https://github.com/llvm/llvm-project/commit/cee5b8777fa98312b05bf8aa81554910a8f867c5
  Author: elizabethandrews <elizabeth.andrews at intel.com>
  Date:   2023-12-05 (Tue, 05 Dec 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/AttrDocs.td
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGen/attr-target-clones.c
    M clang/test/CodeGenCXX/attr-target-clones.cpp

  Log Message:
  -----------
  [Clang]  Fix linker error for function multiversioning (#71706)

Currently target_clones attribute results in a linker error when there
are no multi-versioned function declarations in the calling TU.

In the calling TU, the call is generated with the ‘normal’ assembly
name. This does not match any of the versions or the ifunc, since
version mangling includes a .versionstring, and the ifunc includes
.ifunc suffix. The linker error is not seen with GCC since the mangling
for the ifunc symbol in GCC is the ‘normal’ assembly name for function
i.e. no ifunc suffix.

This PR removes the .ifunc suffix to match GCC. It also adds alias with
the .ifunc suffix so as to ensure backward compatibility.

The changes exclude aarch64 target because the mangling for default
versions on aarch64 does not include a .default suffix and is the
'normal' assembly name, unlike other targets. It is not clear to me what
the correct behavior for this target is.

Old Phabricator review - https://reviews.llvm.org/D158666

---------

Co-authored-by: Tom Honermann <tom at honermann.net>




More information about the All-commits mailing list