[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / undefined-glob.s
blobf6d692acf2ebf93038757f6f468c2189055d33eb
1 # REQUIRES: x86
3 # RUN: echo '.globl foo1; foo1:' | \
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t1.o
5 # RUN: echo '.globl foo2; foo2:' | \
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t2.o
7 # RUN: echo '.globl foo32; foo32:' | \
8 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t3.o
9 # RUN: echo '.globl bar; bar:' | \
10 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t4.o
11 # RUN: rm -f %t.a
12 # RUN: llvm-ar rcs %t.a %t1.o %t2.o %t3.o %t4.o
14 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
16 # RUN: ld.lld -o %t.exe %t.o %t.a
17 # RUN: llvm-nm %t.exe | FileCheck --check-prefix=NO-OPT %s
19 # NO-OPT-NOT: foo
20 # NO-OPT-NOT: bar
22 # RUN: ld.lld -o %t.exe %t.o %t.a --undefined-glob foo1
23 # RUN: llvm-readobj --symbols %t.exe | FileCheck --check-prefix=FOO1 %s
25 # FOO1: foo1
26 # FOO1-NOT: foo2
28 # RUN: ld.lld -o %t.exe %t.o %t.a --undefined-glob 'foo*'
29 # RUN: llvm-readobj --symbols %t.exe | FileCheck --check-prefix=FOO-STAR %s
31 # FOO-STAR: foo1
32 # FOO-STAR: foo2
33 # FOO-STAR: foo32
34 # FOO-STAR-NOT: bar
36 # RUN: ld.lld -o %t.exe %t.o %t.a --undefined-glob 'foo?'
37 # RUN: llvm-readobj --symbols %t.exe | FileCheck --check-prefix=FOO-Q %s
39 # FOO-Q: foo1
40 # FOO-Q: foo2
41 # FOO-Q-NOT: foo32
42 # FOO-Q-NOT: bar
44 # RUN: ld.lld -o %t.exe %t.o %t.a --undefined-glob 'foo[13]*'
45 # RUN: llvm-readobj --symbols %t.exe | FileCheck --check-prefix=FOO13 %s
47 # FOO13: foo1
48 # FOO13-NOT: foo2
49 # FOO13: foo32
50 # FOO13-NOT: bar
52 # RUN: not ld.lld -o /dev/null %t.o %t.a --undefined-glob '[' 2>&1 | \
53 # RUN: FileCheck -check-prefix=BAD-PATTERN %s
55 # BAD-PATTERN: --undefined-glob: invalid glob pattern: [
57 .globl _start
58 _start: