| Issue |
64631
|
| Summary |
[clang] __attribute__((target_clones)) is accepted even when not supported by the platform (linux-musl)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
nekopsykose
|
doing
```console
/ # cat main.cc
static int __attribute__((target_clones("default,avx")))
has_target_clones(void) {
return 0;
}
int main(void) {
return has_target_clones();
}
/ # clang++ main.cc -o x
/ # echo $?
0
```
successfully compiles, but then
```console
/ # ldd x
/lib/ld-musl-x86_64.so.1 (0x7fbb9a2ee000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fbb9a2ee000)
Error relocating x: unsupported relocation type 37
```
by contrast, gcc
```console
/ # g++ main.cc -o x
main.cc:2:1: error: the call requires 'ifunc', which is not supported by this target
2 | has_target_clones(void) {
| ^~~~~~~~~~~~~~~~~
```
this is because musl does not support ifunc.
i can perhaps imagine some rationale for why it would successfully compile anyway (despite the musl target not supporting it ever), but this breaks configure tests that [check if it's supported](https://github.com/libvips/libvips/blob/8d5f33174c956623c1b7eb82c43c828c0511cc22/meson.build#L149) (it detects as valid and uses it, generating a broken exe). a compile+executable test would catch it instead, but that is less feasible when cross compiling.
perhaps clang should follow what gcc does?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs