Description
Bugzilla Link | 42542 |
Resolution | FIXED |
Resolved on | Aug 23, 2019 08:24 |
Version | trunk |
OS | Linux |
CC | @nickdesaulniers,@pcc,@samitolvanen |
Extended Description
C code that defines an alias to a weak function, which is then referred to in assembly code that also overrides the same weak function, fails to compile with -flto=thin on Aarch64:
$ cat alias.c
attribute((weak)) int __a(int n)
{
return n;
}
int a(int n) attribute((alias("__a")));
int main()
{
return __a(0);
}
$ cat alias.s
.arch armv8-a
__a:
b a
.globl __a
$ clang -flto=thin -fvisibility=hidden -fuse-ld=lld --target=aarch64-linux-gnu- alias.s alias.c
Alias must point to a definition
i32 (i32)* @a
LLVM ERROR: Broken module found, compilation aborted!
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
Using -flto instead of -flto=thin works.
This bug prevents us from compiling the Linux kernel with ThinLTO, as explained here:
ClangBuiltLinux/linux#509