• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Test that the --extern-only switch only shows external ELF symbols.
2
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
6
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
15
16--- !ELF
17FileHeader:
18  Class:   ELFCLASS32
19  Data:    ELFDATA2LSB
20  Type:    ET_REL
21  Machine: EM_386
22Sections:
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]
29Symbols:
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
50