xref: /llvm-project/llvm/test/tools/llvm-nm/defined-only.test (revision 37c89803d860c6dd954cda1480dae6917f006972)
1## Show that the --defined-only option omits undefined symbols.
2
3# RUN: yaml2obj %s -o %t.o
4# RUN: llvm-nm %t.o --defined-only > %t.defonly.txt
5# RUN: llvm-nm %t.o -U > %t.U.txt
6
7# RUN: cmp %t.defonly.txt %t.U.txt
8
9# RUN: FileCheck %s --input-file=%t.defonly.txt --implicit-check-not={{.}}
10
11# CHECK: 0000000000000000 T defined
12
13--- !ELF
14FileHeader:
15  Class:   ELFCLASS64
16  Data:    ELFDATA2LSB
17  Type:    ET_REL
18Sections:
19  - Name:  .text
20    Type:  SHT_PROGBITS
21    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
22Symbols:
23  - Name:    defined
24    Section: .text
25    Binding: STB_GLOBAL
26  - Name:    undefined
27    Binding: STB_GLOBAL
28