10 changes: 6 additions & 4 deletions lld/test/ELF/unresolved-symbols.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
## Check that %t2.o contains undefined symbol undef.
# RUN: not ld.lld %t1.o %t2.o -o %t 2>&1 | \
# RUN: FileCheck -check-prefix=UNDCHECK %s
# UNDCHECK: error: {{.*}}2.o:(.text+0x1): undefined symbol 'undef'
# UNDCHECK: error: undefined symbol: undef
# UNDCHECK: >>> referenced by {{.*}}2.o:(.text+0x1)

## Error out if unknown option value was set.
# RUN: not ld.lld %t1.o %t2.o -o %t --unresolved-symbols=xxx 2>&1 | \
Expand All @@ -19,7 +20,9 @@
# RUN: llvm-readobj %t1_1 > /dev/null 2>&1
# RUN: not ld.lld %t2.o -o %t1_2 --unresolved-symbols=ignore-all --no-undefined 2>&1 | \
# RUN: FileCheck -check-prefix=ERRUND %s
# ERRUND: error: {{.*}}:(.text+0x1): undefined symbol 'undef'
# ERRUND: error: undefined symbol: undef
# ERRUND: >>> referenced by {{.*}}:(.text+0x1)

## Also ignore all should not produce error for symbols from DSOs.
# RUN: ld.lld %t1.o %t.so -o %t1_3 --unresolved-symbols=ignore-all
# RUN: llvm-readobj %t1_3 > /dev/null 2>&1
Expand Down Expand Up @@ -56,8 +59,7 @@
# RUN: llvm-readobj %t6_1 > /dev/null 2>&1
# RUN: not ld.lld %t2.o -o %t7 --unresolved-symbols=report-all 2>&1 | \
# RUN: FileCheck -check-prefix=ERRUND %s
# RUN: not ld.lld %t2.o -o %t7_1 2>&1 | \
# RUN: FileCheck -check-prefix=ERRUND %s
# RUN: not ld.lld %t2.o -o %t7_1 2>&1 | FileCheck -check-prefix=ERRUND %s

.globl _start
_start:
3 changes: 2 additions & 1 deletion lld/test/ELF/verneed-local.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: not ld.lld %t.o %S/Inputs/verneed1.so -o %t 2>&1 | FileCheck %s

# CHECK: error: {{.*}}:(.text+0x1): undefined symbol 'f3'
# CHECK: error: undefined symbol: f3
# CHECK: >>> referenced by {{.*}}:(.text+0x1)
.globl _start
_start:
call f3
18 changes: 9 additions & 9 deletions lld/test/ELF/warn-unresolved-symbols-hidden.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: not ld.lld -shared %t.o -o %t.so -z defs --warn-unresolved-symbols 2>&1| FileCheck %s

# CHECK: warning: {{.*}}: undefined symbol 'foo'
# CHECK: error: {{.*}}: undefined symbol 'bar'
# CHECK: error: {{.*}}: undefined symbol 'zed'
# CHECK: warning: undefined symbol: foo
# CHECK: error: undefined symbol: bar
# CHECK: error: undefined symbol: zed

.data
.quad foo
.hidden bar
.quad bar
.protected zed
.quad zed
.data
.quad foo
.hidden bar
.quad bar
.protected zed
.quad zed
15 changes: 11 additions & 4 deletions lld/test/ELF/warn-unresolved-symbols.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@
# RUN: ld.lld -shared %t1.o -o %t10.so --warn-unresolved-symbols 2>&1 | \
# RUN: FileCheck -allow-empty -check-prefix=NOWARN %s

# ERRUND: error: {{.*}}:(.text+0x1): undefined symbol 'undef'
# WARNUND: warning: {{.*}}:(.text+0x1): undefined symbol 'undef'
# NOERR-NOT: error: {{.*}}:(.text+0x1): undefined symbol 'undef'
# NOWARN-NOT: warning: {{.*}}:(.text+0x1): undefined symbol 'undef'
# ERRUND: error: undefined symbol: undef
# ERRUND: >>> referenced by {{.*}}:(.text+0x1)

# WARNUND: warning: undefined symbol: undef
# WARNUND: >>> referenced by {{.*}}:(.text+0x1)

# NOERR-NOT: error: undefined symbol: undef
# NOERR-NOT: >>> referenced by {{.*}}:(.text+0x1)

# NOWARN-NOT: warning: undefined symbol: undef
# NOWARN-NOT: >>> referenced by {{.*}}:(.text+0x1)

.globl _start
_start:
Expand Down
3 changes: 2 additions & 1 deletion lld/test/ELF/zdefs.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# RUN: ld.lld -shared %t.o -o %t1.so

# RUN: not ld.lld -z defs -shared %t.o -o %t1.so 2>&1 | FileCheck -check-prefix=ERR %s
# ERR: error: {{.*}}:(.text+0x1): undefined symbol 'foo'
# ERR: error: undefined symbol: foo
# ERR: >>> referenced by {{.*}}:(.text+0x1)

callq foo@PLT