[memprof] Move YAML support to MemProfYAML.h (NFC) (#119515)
[llvm-project.git] / llvm / test / tools / llvm-nm / elf-extern-only.test
blobd8bbd664acc735fde27527ab11ea7021058786cf
1 ## Test that the --extern-only switch only shows external ELF symbols.
3 # RUN: yaml2obj %s -o %t.o
4 # RUN: llvm-nm %t.o --extern-only --no-sort | FileCheck %s
5 # RUN: llvm-nm %t.o -g --no-sort | FileCheck %s
7 ## Using --no-sort ensures that the symbols appear in the symbol table order
8 ## allowing our CHECK-NOTs to work as expected.
9 # CHECK-NOT: local
10 # CHECK: D global_data_symbol
11 # CHECK-NEXT: T global_function_symbol
12 # CHECK-NEXT: U undefined
13 # CHECK-NEXT: W weak_symbol
14 # CHECK-NOT: local
16 --- !ELF
17 FileHeader:
18   Class:   ELFCLASS32
19   Data:    ELFDATA2LSB
20   Type:    ET_REL
21   Machine: EM_386
22 Sections:
23   - Name:  .text
24     Type:  SHT_PROGBITS
25     Flags: [SHF_ALLOC, SHF_EXECINSTR]
26   - Name:  .data
27     Type:  SHT_PROGBITS
28     Flags: [SHF_ALLOC, SHF_WRITE]
29 Symbols:
30   - Name:    local_function_symbol
31     Binding: STB_LOCAL
32     Section: .text
33   - Name:    local_data_symbol
34     Binding: STB_LOCAL
35     Section: .data
36   - Name:    global_data_symbol
37     Binding: STB_GLOBAL
38     Section: .data
39   - Name:    global_function_symbol
40     Binding: STB_GLOBAL
41     Section: .text
42   - Name:    undefined
43     Binding: STB_GLOBAL
44   - Name:    weak_symbol
45     Binding: STB_WEAK
46     Section: .data
47   - Name:    local_at_end
48     Binding: STB_LOCAL
49     Section: .text