https://bugs.llvm.org/show_bug.cgi?id=42542

            Bug ID: 42542
           Summary: ThinLTO on Aarch64 fails to handle aliases to
                    overridden weak functions
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: samitolva...@google.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

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:
https://github.com/ClangBuiltLinux/linux/issues/509

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to