Fix the output of llvm-nm for Mach-O files to use the characters ‘d’ and ‘b’ for
[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 %p/Inputs/trivial-object-test.macho-x86-64 \
16 RUN:         | FileCheck %s -check-prefix macho64
17 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
18 RUN:         | FileCheck %s -check-prefix macho-tdb
19 RUN: llvm-nm %p/Inputs/common.coff-i386 \
20 RUN:         | FileCheck %s -check-prefix COFF-COMMON
21 RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
22 RUN:         | FileCheck %s -check-prefix ELF-SEC-ADDR64
23 RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
24 RUN:         | FileCheck %s -check-prefix ELF-THUMB
25
26
27 COFF: 00000000 d .data
28 COFF: 00000000 t .text
29 COFF: 00000000 d L{{_?}}.str
30 COFF:          U {{_?}}SomeOtherFunction
31 COFF: 00000000 T {{_?}}main
32 COFF:          U {{_?}}puts
33
34 COFF-COMMON: 00000000 b .bss
35 COFF-COMMON-NEXT: 00000000 d .data
36 COFF-COMMON-NEXT: 00000000 d .drectve
37 COFF-COMMON-NEXT: 00000000 n .file
38 COFF-COMMON-NEXT: 00000000 r .rdata$zzz
39 COFF-COMMON-NEXT: 00000000 t .text
40 COFF-COMMON-NEXT:          C _a
41
42
43 ELF-NOT:      U
44 ELF:          U SomeOtherFunction
45 ELF: 00000000 T main
46 ELF:          U puts
47
48 ELF64:                  U SomeOtherFunction
49 ELF64: 0000000000000000 T main
50 ELF64:                  U puts
51
52 WEAK-ELF64:                  w f1
53 WEAK-ELF64: 0000000000000000 W f2
54 WEAK-ELF64:                  v x1
55 WEAK-ELF64: 0000000000000000 V x2
56
57 ABSOLUTE-ELF64: 0000000000000123 a a1
58 ABSOLUTE-ELF64: 0000000000000123 A a2
59
60 macho:          U _SomeOtherFunction
61 macho: 00000000 T _main
62 macho:          U _puts
63
64 macho64: 0000000000000028 s L_.str
65 macho64:                  U _SomeOtherFunction
66 macho64: 0000000000000000 T _main
67 macho64:                  U _puts
68
69 macho-tdb: 0000000000000030 s EH_frame0
70 macho-tdb: 0000000000000070 b _b
71 macho-tdb: 000000000000000c D _d
72 macho-tdb: 0000000000000000 T _t
73 macho-tdb: 0000000000000048 S _t.eh
74
75 Test that nm uses addresses even with ELF .o files.
76 ELF-SEC-ADDR64:      0000000000000058 D a
77 ELF-SEC-ADDR64-NEXT: 000000000000005c D b
78 ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
79 ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
80 ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
81
82
83 Test that we drop the thumb bit only from function addresses.
84 ELF-THUMB: 00000000 t f
85 ELF-THUMB: 00000003 t g