blob: 4ead46e153b055a6a375267e53124ab5f2238316 [file] [log] [blame]
David Majnemerc7d7c6f2014-10-31 05:07:00 +00001RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a - \
Matt Beaumont-Gay99fc2e12012-08-02 21:52:49 +00002RUN: | FileCheck %s -check-prefix COFF
David Majnemerc7d7c6f2014-10-31 05:07:00 +00003RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a - \
Rafael Espindola37212572013-04-26 17:54:46 +00004RUN: | FileCheck %s -check-prefix COFF
Matt Beaumont-Gay1c1a2b82011-10-31 23:56:52 +00005RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
Michael J. Spencer2d67ed82011-01-20 06:39:15 +00006RUN: | FileCheck %s -check-prefix ELF
Kevin Enderby08e1bbd2014-07-24 23:31:52 +00007RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \
8RUN: | FileCheck %s -check-prefix ELF-o
Kevin Enderby49b4f532014-07-28 23:17:38 +00009RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \
10RUN: | FileCheck %s -check-prefix ELF-u
Matt Beaumont-Gay1c1a2b82011-10-31 23:56:52 +000011RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000012RUN: | FileCheck %s -check-prefix ELF64
Rafael Espindolaf42c58d2014-02-04 23:53:15 +000013RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000014RUN: | FileCheck %s -check-prefix WEAK-ELF64
Rafael Espindola02eac9a2014-02-05 04:36:47 +000015RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000016RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000017RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
18RUN: | FileCheck %s -check-prefix macho
Kevin Enderbyacaaf902014-07-03 18:18:50 +000019RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
20RUN: | FileCheck %s -check-prefix macho-U
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000021RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
22RUN: | FileCheck %s -check-prefix macho64
Kevin Enderby1e1b9922014-06-19 22:49:21 +000023RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
24RUN: | FileCheck %s -check-prefix macho-tdb
Kevin Enderby0fd8aac2014-07-03 21:51:07 +000025RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
26RUN: | FileCheck %s -check-prefix macho-j
Kevin Enderby25a614b2014-07-02 23:23:58 +000027RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
28RUN: | FileCheck %s -check-prefix macho-r
Kevin Enderbyfe6ad972014-07-11 20:30:00 +000029RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
30RUN: | FileCheck %s -check-prefix macho-s
Kevin Enderby77b968e2014-07-16 17:38:26 +000031RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
32RUN: | FileCheck %s -check-prefix macho-x
Kevin Enderby08e1bbd2014-07-24 23:31:52 +000033RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
34RUN: | FileCheck %s -check-prefix macho-o
Kevin Enderby407cc212014-07-17 22:47:16 +000035RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
36RUN: | FileCheck %s -check-prefix macho-pa
Kevin Enderby49b4f532014-07-28 23:17:38 +000037RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
38RUN: | FileCheck %s -check-prefix macho-u
David Majnemerc7d7c6f2014-10-31 05:07:00 +000039RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
Rafael Espindolafb66ef02014-02-04 23:18:52 +000040RUN: | FileCheck %s -check-prefix COFF-COMMON
Rafael Espindolab4865d62014-04-03 00:19:35 +000041RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000042RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
Rafael Espindola5091f932014-04-03 02:20:43 +000043RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
44RUN: | FileCheck %s -check-prefix ELF-THUMB
Kevin Enderby4fc2edb2014-06-23 20:27:53 +000045RUN: mkdir -p %t
46RUN: cd %t
47RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
48RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
NAKAMURA Takumi0c2a0802014-06-23 21:07:04 +000049REQUIRES: shell
Rafael Espindola5091f932014-04-03 02:20:43 +000050
Michael J. Spencer2d67ed82011-01-20 06:39:15 +000051
52COFF: 00000000 d .data
53COFF: 00000000 t .text
54COFF: 00000000 d L{{_?}}.str
55COFF: U {{_?}}SomeOtherFunction
56COFF: 00000000 T {{_?}}main
57COFF: U {{_?}}puts
58
Rafael Espindola589b36a2014-10-08 17:19:42 +000059COFF-COMMON: 00000000 00000000 b .bss
60COFF-COMMON-NEXT: 00000000 00000000 d .data
61COFF-COMMON-NEXT: 00000000 00000014 d .drectve
62COFF-COMMON-NEXT: 00000000 00000000 n .file
63COFF-COMMON-NEXT: 00000000 00000014 r .rdata$zzz
64COFF-COMMON-NEXT: 00000000 00000000 t .text
Rafael Espindola8280fbb2014-10-08 17:37:19 +000065COFF-COMMON-NEXT: 00000004 C _a
Rafael Espindolafb66ef02014-02-04 23:18:52 +000066
67
Rafael Espindola0d6b3472013-07-22 19:24:34 +000068ELF-NOT: U
Michael J. Spencer2d67ed82011-01-20 06:39:15 +000069ELF: U SomeOtherFunction
70ELF: 00000000 T main
71ELF: U puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000072
Kevin Enderby08e1bbd2014-07-24 23:31:52 +000073ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction
74ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
75ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts
76
Kevin Enderby49b4f532014-07-28 23:17:38 +000077ELF-u: U SomeOtherFunction
78ELF-u: U puts
79
Kevin Enderby6abc2e52014-05-09 23:57:49 +000080ELF64: U SomeOtherFunction
81ELF64: 0000000000000000 T main
82ELF64: U puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000083
Kevin Enderby6abc2e52014-05-09 23:57:49 +000084WEAK-ELF64: w f1
85WEAK-ELF64: 0000000000000000 W f2
86WEAK-ELF64: v x1
87WEAK-ELF64: 0000000000000000 V x2
88
89ABSOLUTE-ELF64: 0000000000000123 a a1
90ABSOLUTE-ELF64: 0000000000000123 A a2
Rafael Espindola02eac9a2014-02-05 04:36:47 +000091
Kevin Enderby1b985af2014-05-20 23:04:47 +000092macho: U _SomeOtherFunction
Rafael Espindolaa1356322013-11-02 05:03:24 +000093macho: 00000000 T _main
Kevin Enderby1b985af2014-05-20 23:04:47 +000094macho: U _puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000095
Kevin Enderbyacaaf902014-07-03 18:18:50 +000096macho-U-NOT: U _SomeOtherFunction
97macho-U: 00000000 T _main
98macho-U-NOT: U _puts
99
Kevin Enderby6abc2e52014-05-09 23:57:49 +0000100macho64: 0000000000000028 s L_.str
Kevin Enderby1b985af2014-05-20 23:04:47 +0000101macho64: U _SomeOtherFunction
Kevin Enderby6abc2e52014-05-09 23:57:49 +0000102macho64: 0000000000000000 T _main
Kevin Enderby1b985af2014-05-20 23:04:47 +0000103macho64: U _puts
Rafael Espindolab4865d62014-04-03 00:19:35 +0000104
Kevin Enderby1e1b9922014-06-19 22:49:21 +0000105macho-tdb: 0000000000000030 s EH_frame0
106macho-tdb: 0000000000000070 b _b
107macho-tdb: 000000000000000c D _d
108macho-tdb: 0000000000000000 T _t
109macho-tdb: 0000000000000048 S _t.eh
Rafael Espindolab4865d62014-04-03 00:19:35 +0000110
Kevin Enderby0fd8aac2014-07-03 21:51:07 +0000111macho-j: EH_frame0
112macho-j: _b
113macho-j: _d
114macho-j: _t
115macho-j: _t.eh
116
Kevin Enderby25a614b2014-07-02 23:23:58 +0000117macho-r: 0000000000000048 S _t.eh
118macho-r-NEXT: 0000000000000000 T _t
119macho-r-NEXT: 000000000000000c D _d
120macho-r-NEXT: 0000000000000070 b _b
121macho-r-NEXT: 0000000000000030 s EH_frame0
122
Kevin Enderbyfe6ad972014-07-11 20:30:00 +0000123macho-s: 000000000000000c D _d
124macho-s-NOT: 0000000000000048 S _t.eh
125macho-s-NOT: 0000000000000000 T _t
126macho-s-NOT: 0000000000000070 b _b
127macho-s-NOT: 0000000000000030 s EH_frame0
128
Kevin Enderby77b968e2014-07-16 17:38:26 +0000129macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
130macho-x: 0000000000000070 0e 03 0000 0000000d _b
131macho-x: 000000000000000c 0f 02 0000 00000004 _d
132macho-x: 0000000000000000 0f 01 0000 00000001 _t
133macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
134
Kevin Enderby08e1bbd2014-07-24 23:31:52 +0000135
136macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
137macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
138macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
139macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
140macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
141
Kevin Enderby407cc212014-07-17 22:47:16 +0000142macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/
143macho-pa: 0000000000000000 - 00 0000 SO hello.c
144macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o
145macho-pa: 0000000100000f30 - 01 0000 BNSYM
146macho-pa: 0000000100000f30 - 01 0000 FUN _main
147macho-pa: 000000000000003b - 00 0000 FUN
148macho-pa: 000000000000003b - 01 0000 ENSYM
149macho-pa: 0000000000000000 - 01 0000 SO
150macho-pa: 0000000100000000 T __mh_execute_header
151macho-pa: 0000000100000f30 T _main
152macho-pa: U _printf
153macho-pa: U dyld_stub_binder
154
Kevin Enderby49b4f532014-07-28 23:17:38 +0000155macho-u: _printf
156macho-u: dyld_stub_binder
157
Rafael Espindolab4865d62014-04-03 00:19:35 +0000158Test that nm uses addresses even with ELF .o files.
Kevin Enderby6abc2e52014-05-09 23:57:49 +0000159ELF-SEC-ADDR64: 0000000000000058 D a
160ELF-SEC-ADDR64-NEXT: 000000000000005c D b
161ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
162ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
163ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
Rafael Espindola5091f932014-04-03 02:20:43 +0000164
165
166Test that we drop the thumb bit only from function addresses.
167ELF-THUMB: 00000000 t f
168ELF-THUMB: 00000003 t g
Kevin Enderby4fc2edb2014-06-23 20:27:53 +0000169
170A-OUT: U _SomeOtherFunction
171A-OUT: 00000000 T _main
172A-OUT: U _puts