[clang] [Clang] Fix linker error for function multiversioning (PR #71706)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 10:23:44 PST 2023


elizabethandrews wrote:

I ran some tests compiling TU1 and TU2 in various combinations of clang17, trunk and g++. 

TU1.cpp

```
int foo();
int main()
{   return foo(); }
```

TU2.cpp

```
#include<iostream>

__attribute__((target_clones("default", "arch=sapphirerapids")))
int foo() {
  std::cout<<"Hello World!";
  return 0;
}
```

TU1 - Clang Trunk ; TU2 - Clang 17 : Continue to have link error as expected 
TU1 - Clang 17 ; TU2 - Clang Trunk : Passes
TU1 – g++, TU2 – Clang Trunk : Passes
TU1 – clang Trunk TU2 – G++ : Passes with -fPIE


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


More information about the cfe-commits mailing list