xref: /llvm-project/lld/test/ELF/lto/duplicated.ll (revision 88d66f6ed1e5a3a9370a3181b7307fe65590e3ac)
1; REQUIRES: x86
2; RUN: rm -rf %t && split-file %s %t
3; RUN: llvm-as %t/a.ll -o %t/a.bc
4; RUN: llvm-mc --triple=x86_64-unknown-linux-gnu -filetype=obj %t/b.s -o %t/b.o
5; RUN: llvm-as %t/c.ll -o %t/c.bc
6; RUN: not ld.lld %t/a.bc %t/a.bc -o /dev/null -shared 2>&1 | FileCheck %s
7
8;; --thinlto-index-only skips some passes. Test the error is present.
9; RUN: not ld.lld %t/a.bc %t/a.bc --thinlto-index-only -o /dev/null 2>&1 | FileCheck %s
10; RUN: not ld.lld %t/b.o %t/a.bc --lto-emit-asm -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK2
11; RUN: not ld.lld %t/a.bc %t/b.o --thinlto-index-only -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK2
12
13;; --undefined-glob g extracts %t/c.bc which causes a duplicate symbol error.
14; RUN: not ld.lld %t/a.bc --start-lib %t/c.bc --undefined-glob g --thinlto-index-only -o /dev/null 2>&1 | FileCheck %s
15
16; CHECK:      duplicate symbol: f
17; CHECK-NEXT: >>> defined in {{.*}}.bc
18; CHECK-NEXT: >>> defined in {{.*}}.bc
19
20; CHECK2:      duplicate symbol: f
21; CHECK2-NEXT: >>> defined in {{.*}}
22; CHECK2-NEXT: >>> defined in {{.*}}
23
24;--- a.ll
25target triple = "x86_64-unknown-linux-gnu"
26target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
27
28define void @_start() {
29  ret void
30}
31
32define void @f() {
33  ret void
34}
35
36;--- b.s
37.globl f
38f:
39
40;--- c.ll
41target triple = "x86_64-unknown-linux-gnu"
42target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
43
44define void @f() {
45  ret void
46}
47
48define void @g() {
49  ret void
50}
51