Open llvmbot opened 4 years ago
A patch trying to solve this issue is under review: https://reviews.llvm.org/D82745
I think this bug has been solved already so perhaps this issue should be closed? The original example given above seems to build fine. Also, a project I tried that used to have a problem with the IFUNC now seems to work correctly.
Extended Description
The code example:
$ cat thinlto-ifunc.c typedef int (*func)(void);
int called(void) { return 1; }
func resolver(void) { return called; }
attribute ((ifunc ("resolver"))) int foo(void);
int main(int argc, char *argv[]) { foo(); }
$ clang -O3 -flto=thin thinlto-ifunc.c -o out /usr/bin/ld: /tmp/lto-llvm-1798eb.o: in function
main': thinlto-ifunc.c:(.text.main+0x2): undefined reference to
resolver' clang: error: linker command failed with exit code 1 (use -v to see invocation)And in case if ifunc call is in another C file: $ clang -O3 -flto=thin thinlto-ifunc.c ex.c -o out /tmp/lto-llvm-d8c1fd.o: in function
main': ex.c:(.text.main+0x2): undefined reference to
foo' clang: error: linker command failed with exit code 1 (use -v to see invocation)