2016-05-10 05:40:06 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef.s -o %t2.o
|
2016-10-26 19:07:09 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-debug.s -o %t3.o
|
2018-03-07 23:22:58 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-bad-debug.s -o %t4.o
|
2018-08-02 19:33:54 +08:00
|
|
|
# RUN: rm -f %t2.a
|
2016-05-10 05:40:06 +08:00
|
|
|
# RUN: llvm-ar rc %t2.a %t2.o
|
2020-02-13 13:48:45 +08:00
|
|
|
# RUN: not ld.lld %t.o %t2.a %t3.o %t4.o -o /dev/null 2>&1 \
|
2019-12-20 21:51:18 +08:00
|
|
|
# RUN: | FileCheck %s --implicit-check-not="error:" --implicit-check-not="warning:"
|
2020-02-13 13:48:45 +08:00
|
|
|
# RUN: not ld.lld -pie %t.o %t2.a %t3.o %t4.o -o /dev/null 2>&1 \
|
2019-12-20 21:51:18 +08:00
|
|
|
# RUN: | FileCheck %s --implicit-check-not="error:" --implicit-check-not="warning:"
|
2017-03-31 03:13:47 +08:00
|
|
|
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: foo
|
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: {{.*}}:(.text+0x1)
|
2017-03-31 03:13:47 +08:00
|
|
|
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: bar
|
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: >>> {{.*}}:(.text+0x6)
|
2017-03-31 03:13:47 +08:00
|
|
|
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: foo(int)
|
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: >>> {{.*}}:(.text+0x10)
|
2017-03-31 03:13:47 +08:00
|
|
|
|
2020-01-28 22:04:42 +08:00
|
|
|
# CHECK: error: undefined symbol: vtable for Foo
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: >>> {{.*}}:(.text+0x15)
|
2020-03-31 18:36:23 +08:00
|
|
|
# CHECK-NEXT: >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
|
2018-12-22 03:28:49 +08:00
|
|
|
|
clang+lld: Improve clang+ld.darwinnew.lld interaction, pass -demangle
This patch:
- adds an ld64.lld.darwinnew symlink for lld, to go with f2710d4b576,
so that `clang -fuse-ld=lld.darwinnew` can be used to test new
Mach-O lld while it's in bring-up. (The expectation is that we'll
remove this again once new Mach-O lld is the defauld and only Mach-O
lld.)
- lets the clang driver know if the linker is lld (currently
only triggered if `-fuse-ld=lld` or `-fuse-ld=lld.darwinnew` is
passed). Currently only used for the next point, but could be used
to implement other features that need close coordination between
compiler and linker, e.g. having a diag for calling `clang++` instead
of `clang` when link errors are caused by a missing C++ stdlib.
- lets the clang driver pass `-demangle` to Mach-O lld (both old and
new), in addition to ld64
- implements -demangle for new Mach-O lld
- changes demangleItanium() to accept _Z, __Z, ___Z, ____Z prefixes
(and updates one test added in D68014). Mach-O has an extra
underscore for symbols, and the three (or, on Mach-O, four)
underscores are used for block names.
Differential Revision: https://reviews.llvm.org/D91884
2020-11-21 02:57:44 +08:00
|
|
|
# CHECK: error: undefined symbol: foo(int)
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: >>> {{.*}}:(.text+0x1A)
|
2019-09-27 20:24:03 +08:00
|
|
|
|
2022-01-05 11:05:10 +08:00
|
|
|
# CHECK: error: undefined symbol: Pi
|
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: >>> {{.*}}:(.text+0x1F)
|
|
|
|
|
|
|
|
# CHECK: error: undefined symbol: D main
|
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: >>> {{.*}}:(.text+0x24)
|
|
|
|
|
|
|
|
# CHECK: error: undefined symbol: a::main
|
|
|
|
# CHECK-NEXT: >>> referenced by undef.s
|
|
|
|
# CHECK-NEXT: >>> {{.*}}:(.text+0x29)
|
|
|
|
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: zed2
|
|
|
|
# CHECK-NEXT: >>> referenced by {{.*}}.o:(.text+0x0) in archive {{.*}}2.a
|
2017-03-31 03:13:47 +08:00
|
|
|
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: zed3
|
|
|
|
# CHECK-NEXT: >>> referenced by undef-debug.s:3 (dir{{/|\\}}undef-debug.s:3)
|
|
|
|
# CHECK-NEXT: >>> {{.*}}.o:(.text+0x0)
|
2017-03-31 03:13:47 +08:00
|
|
|
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: zed4
|
|
|
|
# CHECK-NEXT: >>> referenced by undef-debug.s:7 (dir{{/|\\}}undef-debug.s:7)
|
|
|
|
# CHECK-NEXT: >>> {{.*}}.o:(.text.1+0x0)
|
2017-03-31 03:13:47 +08:00
|
|
|
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: zed5
|
|
|
|
# CHECK-NEXT: >>> referenced by undef-debug.s:11 (dir{{/|\\}}undef-debug.s:11)
|
|
|
|
# CHECK-NEXT: >>> {{.*}}.o:(.text.2+0x0)
|
2015-07-25 05:03:07 +08:00
|
|
|
|
2018-05-10 18:52:21 +08:00
|
|
|
# Show that all line table problems are mentioned as soon as the object's line information
|
|
|
|
# is requested, even if that particular part of the line information is not currently required.
|
2019-12-20 21:51:18 +08:00
|
|
|
# Also show that the warnings are only printed once.
|
2020-06-11 19:04:26 +08:00
|
|
|
# CHECK: warning: unknown data in line table prologue at offset 0x00000000: parsing ended (at offset 0x00000037) before reaching the prologue end at offset 0x00000038
|
2020-03-02 18:28:48 +08:00
|
|
|
# CHECK-NEXT: warning: parsing line table prologue at offset 0x0000005b: unsupported version 1
|
2020-01-28 22:04:42 +08:00
|
|
|
# CHECK-NEXT: warning: last sequence in debug line table at offset 0x00000061 is not terminated
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: zed6a
|
2020-01-28 22:04:42 +08:00
|
|
|
# CHECK-NEXT: >>> referenced by undef-bad-debug.s:11 (dir{{/|\\}}undef-bad-debug.s:11)
|
|
|
|
# CHECK-NEXT: >>> {{.*}}4.o:(.text+0x0)
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK: error: undefined symbol: zed6b
|
2020-01-28 22:04:42 +08:00
|
|
|
# CHECK-NEXT: >>> referenced by undef-bad-debug.s:21 (dir{{/|\\}}undef-bad-debug.s:21)
|
|
|
|
# CHECK-NEXT: >>> {{.*}}4.o:(.text+0x8)
|
|
|
|
|
|
|
|
# Show that a problem in a line table that prevents further parsing of that
|
|
|
|
# table means that no line information is displayed in the wardning.
|
|
|
|
# CHECK: error: undefined symbol: zed7
|
|
|
|
# CHECK-NEXT: >>> referenced by {{.*}}4.o:(.text+0x10)
|
2018-03-07 23:22:58 +08:00
|
|
|
|
2018-05-10 18:52:21 +08:00
|
|
|
# Show that a problem with one line table's information doesn't affect getting information from
|
|
|
|
# a different one in the same object.
|
2020-01-28 22:04:42 +08:00
|
|
|
# CHECK: error: undefined symbol: zed8
|
2020-01-03 01:31:52 +08:00
|
|
|
# CHECK-NEXT: >>> referenced by undef-bad-debug2.s:11 (dir2{{/|\\}}undef-bad-debug2.s:11)
|
2020-01-28 22:04:42 +08:00
|
|
|
# CHECK-NEXT: >>> {{.*}}tmp4.o:(.text+0x18)
|
2018-05-10 18:52:21 +08:00
|
|
|
|
2020-02-13 13:48:45 +08:00
|
|
|
# RUN: not ld.lld %t.o %t2.a -o /dev/null -no-demangle 2>&1 | \
|
2016-09-16 11:52:45 +08:00
|
|
|
# RUN: FileCheck -check-prefix=NO-DEMANGLE %s
|
2017-03-31 03:13:47 +08:00
|
|
|
# NO-DEMANGLE: error: undefined symbol: _Z3fooi
|
2016-10-26 19:07:09 +08:00
|
|
|
|
|
|
|
.file "undef.s"
|
2016-09-16 11:52:45 +08:00
|
|
|
|
2016-01-29 06:56:29 +08:00
|
|
|
.globl _start
|
2015-07-25 05:03:07 +08:00
|
|
|
_start:
|
|
|
|
call foo
|
2016-01-29 06:56:29 +08:00
|
|
|
call bar
|
2016-05-10 05:40:06 +08:00
|
|
|
call zed1
|
2016-09-16 11:52:45 +08:00
|
|
|
call _Z3fooi
|
2018-12-22 03:28:49 +08:00
|
|
|
call _ZTV3Foo
|
2019-09-27 20:24:03 +08:00
|
|
|
call __Z3fooi
|
2022-01-05 11:05:10 +08:00
|
|
|
call Pi
|
|
|
|
call _Dmain
|
|
|
|
call _RNvC1a4main
|