xref: /llvm-project/lld/test/ELF/undefined-glob.s (revision ebb0a210995dcf69d9696f8e14629e1378e63a21)
1# REQUIRES: x86
2
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
13
14# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
15
16# RUN: ld.lld -o %t.exe %t.o %t.a
17# RUN: llvm-nm %t.exe | FileCheck --check-prefix=NO-OPT %s
18
19# NO-OPT-NOT: foo
20# NO-OPT-NOT: bar
21
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
24
25# FOO1: foo1
26# FOO1-NOT: foo2
27
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
30
31# FOO-STAR: foo1
32# FOO-STAR: foo2
33# FOO-STAR: foo32
34# FOO-STAR-NOT: bar
35
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
38
39# FOO-Q: foo1
40# FOO-Q: foo2
41# FOO-Q-NOT: foo32
42# FOO-Q-NOT: bar
43
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
46
47# FOO13: foo1
48# FOO13-NOT: foo2
49# FOO13: foo32
50# FOO13-NOT: bar
51
52# RUN: not ld.lld -o /dev/null %t.o %t.a --undefined-glob '[' 2>&1 | \
53# RUN:   FileCheck -check-prefix=BAD-PATTERN %s
54
55# BAD-PATTERN: --undefined-glob: invalid glob pattern, unmatched '[': [
56
57.globl _start
58_start:
59