Open mablinov opened 5 months ago
@llvm/issue-subscribers-clang-frontend
Author: Maxim Blinov (mablinov)
While target_clones
allows multiple implementations that Clang can readily adopt a portable one (not using ifunc), __attribute__((ifunc("resolve_multiver")))
instructs Clang to generate STT_GNU_IFUNC
symbols.
This raises the question of whether Clang should check all Linux environments whether ifunc is supported.
Firefox used/uses elfhack/relrhack to support relative relocations. A similar mechanism can be used to handle IRELATIVE relocations. Lacking dynamic loader doesn't mean ifunc cannot be emulated in an environment.
I feel that the compiler might not be the playce to enforce this. A much more common way to use ifunc is inline assembly, and Clang cannot reject it.
Hi all,
The symptoms of this issue are identical to https://github.com/llvm/llvm-project/issues/64631: The musl dynamic linker will complain about
unknown relocation 37
.I stumbled into this issue when porting a GCC test (ipa-pta-19.c) into RISC-V Clang, except of course in RISC-V the relocation number is different, so I see
unsupported relocation type 58
instead (R_RISCV_IRELATIVE
)two items of note:
So far I've tried with the following LLVM versions:
0c3a02b8c09bb
(the exact commit that should have introduced the fix)Perhaps it never got tested? I noticed while debugging clang, that the function
supportsIFunc
never actually gets called