Ignore llvm.* globals.
[oota-llvm.git] / test / Object / nm-trivial-object.test
1 RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm - \
2 RUN:         | FileCheck %s -check-prefix COFF
3 RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm - \
4 RUN:         | FileCheck %s -check-prefix COFF
5 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
6 RUN:         | FileCheck %s -check-prefix ELF
7 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
8 RUN:         | FileCheck %s -check-prefix ELF64
9 RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
10 RUN:         | FileCheck %s -check-prefix WEAK-ELF64
11 RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
12 RUN:         | FileCheck %s -check-prefix ABSOLUTE-ELF64
13 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
14 RUN:         | FileCheck %s -check-prefix macho
15 RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
16 RUN:         | FileCheck %s -check-prefix macho-U
17 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
18 RUN:         | FileCheck %s -check-prefix macho64
19 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
20 RUN:         | FileCheck %s -check-prefix macho-tdb
21 RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
22 RUN:         | FileCheck %s -check-prefix macho-j
23 RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
24 RUN:         | FileCheck %s -check-prefix macho-r
25 RUN: llvm-nm %p/Inputs/common.coff-i386 \
26 RUN:         | FileCheck %s -check-prefix COFF-COMMON
27 RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
28 RUN:         | FileCheck %s -check-prefix ELF-SEC-ADDR64
29 RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
30 RUN:         | FileCheck %s -check-prefix ELF-THUMB
31 RUN: mkdir -p %t
32 RUN: cd %t
33 RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
34 RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
35 REQUIRES: shell
36
37
38 COFF: 00000000 d .data
39 COFF: 00000000 t .text
40 COFF: 00000000 d L{{_?}}.str
41 COFF:          U {{_?}}SomeOtherFunction
42 COFF: 00000000 T {{_?}}main
43 COFF:          U {{_?}}puts
44
45 COFF-COMMON: 00000000 b .bss
46 COFF-COMMON-NEXT: 00000000 d .data
47 COFF-COMMON-NEXT: 00000000 d .drectve
48 COFF-COMMON-NEXT: 00000000 n .file
49 COFF-COMMON-NEXT: 00000000 r .rdata$zzz
50 COFF-COMMON-NEXT: 00000000 t .text
51 COFF-COMMON-NEXT:          C _a
52
53
54 ELF-NOT:      U
55 ELF:          U SomeOtherFunction
56 ELF: 00000000 T main
57 ELF:          U puts
58
59 ELF64:                  U SomeOtherFunction
60 ELF64: 0000000000000000 T main
61 ELF64:                  U puts
62
63 WEAK-ELF64:                  w f1
64 WEAK-ELF64: 0000000000000000 W f2
65 WEAK-ELF64:                  v x1
66 WEAK-ELF64: 0000000000000000 V x2
67
68 ABSOLUTE-ELF64: 0000000000000123 a a1
69 ABSOLUTE-ELF64: 0000000000000123 A a2
70
71 macho:          U _SomeOtherFunction
72 macho: 00000000 T _main
73 macho:          U _puts
74
75 macho-U-NOT:          U _SomeOtherFunction
76 macho-U: 00000000 T _main
77 macho-U-NOT:          U _puts
78
79 macho64: 0000000000000028 s L_.str
80 macho64:                  U _SomeOtherFunction
81 macho64: 0000000000000000 T _main
82 macho64:                  U _puts
83
84 macho-tdb: 0000000000000030 s EH_frame0
85 macho-tdb: 0000000000000070 b _b
86 macho-tdb: 000000000000000c D _d
87 macho-tdb: 0000000000000000 T _t
88 macho-tdb: 0000000000000048 S _t.eh
89
90 macho-j: EH_frame0
91 macho-j: _b
92 macho-j: _d
93 macho-j: _t
94 macho-j: _t.eh
95
96 macho-r: 0000000000000048 S _t.eh
97 macho-r-NEXT: 0000000000000000 T _t
98 macho-r-NEXT: 000000000000000c D _d
99 macho-r-NEXT: 0000000000000070 b _b
100 macho-r-NEXT: 0000000000000030 s EH_frame0
101
102 Test that nm uses addresses even with ELF .o files.
103 ELF-SEC-ADDR64:      0000000000000058 D a
104 ELF-SEC-ADDR64-NEXT: 000000000000005c D b
105 ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
106 ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
107 ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
108
109
110 Test that we drop the thumb bit only from function addresses.
111 ELF-THUMB: 00000000 t f
112 ELF-THUMB: 00000003 t g
113
114 A-OUT:          U _SomeOtherFunction
115 A-OUT: 00000000 T _main
116 A-OUT:          U _puts