2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
4 ## The link should fail with an undef error by default
5 # RUN: not ld.lld %t1.o -o /dev/null 2>&1 | \
6 # RUN: FileCheck -check-prefix=ERRUND %s
8 ## --error-unresolved-symbols should generate an error
9 # RUN: not ld.lld %t1.o -o /dev/null --error-unresolved-symbols 2>&1 | \
10 # RUN: FileCheck -check-prefix=ERRUND %s
12 ## --warn-unresolved-symbols should generate a warning
13 # RUN: ld.lld %t1.o -o %t5 --warn-unresolved-symbols 2>&1 | \
14 # RUN: FileCheck -check-prefix=WARNUND %s
16 ## Test that the last option wins
17 # RUN: ld.lld %t1.o -o %t5 --error-unresolved-symbols --warn-unresolved-symbols 2>&1 | \
18 # RUN: FileCheck -check-prefix=WARNUND %s
19 # RUN: not ld.lld %t1.o -o /dev/null --warn-unresolved-symbols --error-unresolved-symbols 2>&1 | \
20 # RUN: FileCheck -check-prefix=ERRUND %s
22 ## Do not report undefines if linking relocatable or shared.
23 ## And while we're at it, check that we can accept single -
24 ## variants of these options.
25 # RUN: ld.lld -r %t1.o -o /dev/null -error-unresolved-symbols 2>&1 | \
26 # RUN: FileCheck -allow-empty -check-prefix=NOERR %s
27 # RUN: ld.lld -shared %t1.o -o /dev/null --error-unresolved-symbols 2>&1 | \
28 # RUN: FileCheck -allow-empty -check-prefix=NOERR %s
29 # RUN: ld.lld -r %t1.o -o /dev/null -warn-unresolved-symbols 2>&1 | \
30 # RUN: FileCheck -allow-empty -check-prefix=NOWARN %s
31 # RUN: ld.lld -shared %t1.o -o /dev/null --warn-unresolved-symbols 2>&1 | \
32 # RUN: FileCheck -allow-empty -check-prefix=NOWARN %s
34 # ERRUND: error: undefined symbol: undef
35 # ERRUND: >>> referenced by {{.*}}:(.text+0x1)
37 # WARNUND: warning: undefined symbol: undef
38 # WARNUND: >>> referenced by {{.*}}:(.text+0x1)
40 # NOERR-NOT: error: undefined symbol: undef
41 # NOERR-NOT: >>> referenced by {{.*}}:(.text+0x1)
43 # NOWARN-NOT: warning: undefined symbol: undef
44 # NOWARN-NOT: >>> referenced by {{.*}}:(.text+0x1)