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
33 RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
34 RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
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
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
55 ELF: U SomeOtherFunction
59 ELF64: U SomeOtherFunction
60 ELF64: 0000000000000000 T main
64 WEAK-ELF64: 0000000000000000 W f2
66 WEAK-ELF64: 0000000000000000 V x2
68 ABSOLUTE-ELF64: 0000000000000123 a a1
69 ABSOLUTE-ELF64: 0000000000000123 A a2
71 macho: U _SomeOtherFunction
72 macho: 00000000 T _main
75 macho-U-NOT: U _SomeOtherFunction
76 macho-U: 00000000 T _main
79 macho64: 0000000000000028 s L_.str
80 macho64: U _SomeOtherFunction
81 macho64: 0000000000000000 T _main
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
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
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
110 Test that we drop the thumb bit only from function addresses.
111 ELF-THUMB: 00000000 t f
112 ELF-THUMB: 00000003 t g
114 A-OUT: U _SomeOtherFunction
115 A-OUT: 00000000 T _main