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 -o %p/Inputs/trivial-object-test.elf-i386 \
8 RUN: | FileCheck %s -check-prefix ELF-o
9 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
10 RUN: | FileCheck %s -check-prefix ELF64
11 RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
12 RUN: | FileCheck %s -check-prefix WEAK-ELF64
13 RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
14 RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
15 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
16 RUN: | FileCheck %s -check-prefix macho
17 RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
18 RUN: | FileCheck %s -check-prefix macho-U
19 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
20 RUN: | FileCheck %s -check-prefix macho64
21 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
22 RUN: | FileCheck %s -check-prefix macho-tdb
23 RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
24 RUN: | FileCheck %s -check-prefix macho-j
25 RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
26 RUN: | FileCheck %s -check-prefix macho-r
27 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
28 RUN: | FileCheck %s -check-prefix macho-s
29 RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
30 RUN: | FileCheck %s -check-prefix macho-x
31 RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
32 RUN: | FileCheck %s -check-prefix macho-o
33 RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
34 RUN: | FileCheck %s -check-prefix macho-pa
35 RUN: llvm-nm %p/Inputs/common.coff-i386 \
36 RUN: | FileCheck %s -check-prefix COFF-COMMON
37 RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
38 RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
39 RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
40 RUN: | FileCheck %s -check-prefix ELF-THUMB
43 RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
44 RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
48 COFF: 00000000 d .data
49 COFF: 00000000 t .text
50 COFF: 00000000 d L{{_?}}.str
51 COFF: U {{_?}}SomeOtherFunction
52 COFF: 00000000 T {{_?}}main
55 COFF-COMMON: 00000000 b .bss
56 COFF-COMMON-NEXT: 00000000 d .data
57 COFF-COMMON-NEXT: 00000000 d .drectve
58 COFF-COMMON-NEXT: 00000000 n .file
59 COFF-COMMON-NEXT: 00000000 r .rdata$zzz
60 COFF-COMMON-NEXT: 00000000 t .text
61 COFF-COMMON-NEXT: C _a
65 ELF: U SomeOtherFunction
69 ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction
70 ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
71 ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts
73 ELF64: U SomeOtherFunction
74 ELF64: 0000000000000000 T main
78 WEAK-ELF64: 0000000000000000 W f2
80 WEAK-ELF64: 0000000000000000 V x2
82 ABSOLUTE-ELF64: 0000000000000123 a a1
83 ABSOLUTE-ELF64: 0000000000000123 A a2
85 macho: U _SomeOtherFunction
86 macho: 00000000 T _main
89 macho-U-NOT: U _SomeOtherFunction
90 macho-U: 00000000 T _main
93 macho64: 0000000000000028 s L_.str
94 macho64: U _SomeOtherFunction
95 macho64: 0000000000000000 T _main
98 macho-tdb: 0000000000000030 s EH_frame0
99 macho-tdb: 0000000000000070 b _b
100 macho-tdb: 000000000000000c D _d
101 macho-tdb: 0000000000000000 T _t
102 macho-tdb: 0000000000000048 S _t.eh
110 macho-r: 0000000000000048 S _t.eh
111 macho-r-NEXT: 0000000000000000 T _t
112 macho-r-NEXT: 000000000000000c D _d
113 macho-r-NEXT: 0000000000000070 b _b
114 macho-r-NEXT: 0000000000000030 s EH_frame0
116 macho-s: 000000000000000c D _d
117 macho-s-NOT: 0000000000000048 S _t.eh
118 macho-s-NOT: 0000000000000000 T _t
119 macho-s-NOT: 0000000000000070 b _b
120 macho-s-NOT: 0000000000000030 s EH_frame0
122 macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
123 macho-x: 0000000000000070 0e 03 0000 0000000d _b
124 macho-x: 000000000000000c 0f 02 0000 00000004 _d
125 macho-x: 0000000000000000 0f 01 0000 00000001 _t
126 macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
129 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
130 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
131 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
132 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
133 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
135 macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/
136 macho-pa: 0000000000000000 - 00 0000 SO hello.c
137 macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o
138 macho-pa: 0000000100000f30 - 01 0000 BNSYM
139 macho-pa: 0000000100000f30 - 01 0000 FUN _main
140 macho-pa: 000000000000003b - 00 0000 FUN
141 macho-pa: 000000000000003b - 01 0000 ENSYM
142 macho-pa: 0000000000000000 - 01 0000 SO
143 macho-pa: 0000000100000000 T __mh_execute_header
144 macho-pa: 0000000100000f30 T _main
146 macho-pa: U dyld_stub_binder
148 Test that nm uses addresses even with ELF .o files.
149 ELF-SEC-ADDR64: 0000000000000058 D a
150 ELF-SEC-ADDR64-NEXT: 000000000000005c D b
151 ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
152 ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
153 ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
156 Test that we drop the thumb bit only from function addresses.
157 ELF-THUMB: 00000000 t f
158 ELF-THUMB: 00000003 t g
160 A-OUT: U _SomeOtherFunction
161 A-OUT: 00000000 T _main