blob: 98bf9f92f2f6286fd0f03be0113a064da7299fff [file] [log] [blame]
Kevin Enderby4fc2edb2014-06-23 20:27:53 +00001RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm - \
Matt Beaumont-Gay99fc2e12012-08-02 21:52:49 +00002RUN: | FileCheck %s -check-prefix COFF
Kevin Enderby4fc2edb2014-06-23 20:27:53 +00003RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm - \
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
Matt Beaumont-Gay1c1a2b82011-10-31 23:56:52 +00007RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +00008RUN: | FileCheck %s -check-prefix ELF64
Rafael Espindolaf42c58d2014-02-04 23:53:15 +00009RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000010RUN: | FileCheck %s -check-prefix WEAK-ELF64
Rafael Espindola02eac9a2014-02-05 04:36:47 +000011RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000012RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000013RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
14RUN: | FileCheck %s -check-prefix macho
Kevin Enderbyacaaf902014-07-03 18:18:50 +000015RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
16RUN: | FileCheck %s -check-prefix macho-U
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000017RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
18RUN: | FileCheck %s -check-prefix macho64
Kevin Enderby1e1b9922014-06-19 22:49:21 +000019RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
20RUN: | FileCheck %s -check-prefix macho-tdb
Kevin Enderby0fd8aac2014-07-03 21:51:07 +000021RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
22RUN: | FileCheck %s -check-prefix macho-j
Kevin Enderby25a614b2014-07-02 23:23:58 +000023RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
24RUN: | FileCheck %s -check-prefix macho-r
Kevin Enderbyfe6ad972014-07-11 20:30:00 +000025RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
26RUN: | FileCheck %s -check-prefix macho-s
Kevin Enderby77b968e2014-07-16 17:38:26 +000027RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
28RUN: | FileCheck %s -check-prefix macho-x
Rafael Espindolafb66ef02014-02-04 23:18:52 +000029RUN: llvm-nm %p/Inputs/common.coff-i386 \
30RUN: | FileCheck %s -check-prefix COFF-COMMON
Rafael Espindolab4865d62014-04-03 00:19:35 +000031RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000032RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
Rafael Espindola5091f932014-04-03 02:20:43 +000033RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
34RUN: | FileCheck %s -check-prefix ELF-THUMB
Kevin Enderby4fc2edb2014-06-23 20:27:53 +000035RUN: mkdir -p %t
36RUN: cd %t
37RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
38RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
NAKAMURA Takumi0c2a0802014-06-23 21:07:04 +000039REQUIRES: shell
Rafael Espindola5091f932014-04-03 02:20:43 +000040
Michael J. Spencer2d67ed82011-01-20 06:39:15 +000041
42COFF: 00000000 d .data
43COFF: 00000000 t .text
44COFF: 00000000 d L{{_?}}.str
45COFF: U {{_?}}SomeOtherFunction
46COFF: 00000000 T {{_?}}main
47COFF: U {{_?}}puts
48
Rafael Espindolafb66ef02014-02-04 23:18:52 +000049COFF-COMMON: 00000000 b .bss
50COFF-COMMON-NEXT: 00000000 d .data
51COFF-COMMON-NEXT: 00000000 d .drectve
52COFF-COMMON-NEXT: 00000000 n .file
53COFF-COMMON-NEXT: 00000000 r .rdata$zzz
54COFF-COMMON-NEXT: 00000000 t .text
55COFF-COMMON-NEXT: C _a
56
57
Rafael Espindola0d6b3472013-07-22 19:24:34 +000058ELF-NOT: U
Michael J. Spencer2d67ed82011-01-20 06:39:15 +000059ELF: U SomeOtherFunction
60ELF: 00000000 T main
61ELF: U puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000062
Kevin Enderby6abc2e52014-05-09 23:57:49 +000063ELF64: U SomeOtherFunction
64ELF64: 0000000000000000 T main
65ELF64: U puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000066
Kevin Enderby6abc2e52014-05-09 23:57:49 +000067WEAK-ELF64: w f1
68WEAK-ELF64: 0000000000000000 W f2
69WEAK-ELF64: v x1
70WEAK-ELF64: 0000000000000000 V x2
71
72ABSOLUTE-ELF64: 0000000000000123 a a1
73ABSOLUTE-ELF64: 0000000000000123 A a2
Rafael Espindola02eac9a2014-02-05 04:36:47 +000074
Kevin Enderby1b985af2014-05-20 23:04:47 +000075macho: U _SomeOtherFunction
Rafael Espindolaa1356322013-11-02 05:03:24 +000076macho: 00000000 T _main
Kevin Enderby1b985af2014-05-20 23:04:47 +000077macho: U _puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000078
Kevin Enderbyacaaf902014-07-03 18:18:50 +000079macho-U-NOT: U _SomeOtherFunction
80macho-U: 00000000 T _main
81macho-U-NOT: U _puts
82
Kevin Enderby6abc2e52014-05-09 23:57:49 +000083macho64: 0000000000000028 s L_.str
Kevin Enderby1b985af2014-05-20 23:04:47 +000084macho64: U _SomeOtherFunction
Kevin Enderby6abc2e52014-05-09 23:57:49 +000085macho64: 0000000000000000 T _main
Kevin Enderby1b985af2014-05-20 23:04:47 +000086macho64: U _puts
Rafael Espindolab4865d62014-04-03 00:19:35 +000087
Kevin Enderby1e1b9922014-06-19 22:49:21 +000088macho-tdb: 0000000000000030 s EH_frame0
89macho-tdb: 0000000000000070 b _b
90macho-tdb: 000000000000000c D _d
91macho-tdb: 0000000000000000 T _t
92macho-tdb: 0000000000000048 S _t.eh
Rafael Espindolab4865d62014-04-03 00:19:35 +000093
Kevin Enderby0fd8aac2014-07-03 21:51:07 +000094macho-j: EH_frame0
95macho-j: _b
96macho-j: _d
97macho-j: _t
98macho-j: _t.eh
99
Kevin Enderby25a614b2014-07-02 23:23:58 +0000100macho-r: 0000000000000048 S _t.eh
101macho-r-NEXT: 0000000000000000 T _t
102macho-r-NEXT: 000000000000000c D _d
103macho-r-NEXT: 0000000000000070 b _b
104macho-r-NEXT: 0000000000000030 s EH_frame0
105
Kevin Enderbyfe6ad972014-07-11 20:30:00 +0000106macho-s: 000000000000000c D _d
107macho-s-NOT: 0000000000000048 S _t.eh
108macho-s-NOT: 0000000000000000 T _t
109macho-s-NOT: 0000000000000070 b _b
110macho-s-NOT: 0000000000000030 s EH_frame0
111
Kevin Enderby77b968e2014-07-16 17:38:26 +0000112macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
113macho-x: 0000000000000070 0e 03 0000 0000000d _b
114macho-x: 000000000000000c 0f 02 0000 00000004 _d
115macho-x: 0000000000000000 0f 01 0000 00000001 _t
116macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
117
Rafael Espindolab4865d62014-04-03 00:19:35 +0000118Test that nm uses addresses even with ELF .o files.
Kevin Enderby6abc2e52014-05-09 23:57:49 +0000119ELF-SEC-ADDR64: 0000000000000058 D a
120ELF-SEC-ADDR64-NEXT: 000000000000005c D b
121ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
122ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
123ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
Rafael Espindola5091f932014-04-03 02:20:43 +0000124
125
126Test that we drop the thumb bit only from function addresses.
127ELF-THUMB: 00000000 t f
128ELF-THUMB: 00000003 t g
Kevin Enderby4fc2edb2014-06-23 20:27:53 +0000129
130A-OUT: U _SomeOtherFunction
131A-OUT: 00000000 T _main
132A-OUT: U _puts