1RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \ 2RUN: | FileCheck %s -check-prefix COFF32 3RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \ 4RUN: | FileCheck %s -check-prefix COFF64 5RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \ 6RUN: | FileCheck %s -check-prefix ELF 7RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 -S \ 8RUN: | FileCheck %s -check-prefix ELF-SIZE 9RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \ 10RUN: | FileCheck %s -check-prefix ELF-o 11RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \ 12RUN: | FileCheck %s -check-prefix ELF-u 13RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \ 14RUN: | FileCheck %s -check-prefix ELF64 15RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \ 16RUN: | FileCheck %s -check-prefix WEAK-ELF64 17RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \ 18RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64 19RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \ 20RUN: | FileCheck %s -check-prefix macho 21RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \ 22RUN: | FileCheck %s -check-prefix macho-U 23RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \ 24RUN: | FileCheck %s -check-prefix macho64 25RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \ 26RUN: | FileCheck %s -check-prefix macho-tdb 27RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \ 28RUN: | FileCheck %s -check-prefix macho-j 29RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \ 30RUN: | FileCheck %s -check-prefix macho-r 31RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \ 32RUN: | FileCheck %s -check-prefix macho-s 33RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \ 34RUN: | FileCheck %s -check-prefix macho-x 35RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \ 36RUN: | FileCheck %s -check-prefix macho-o 37RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \ 38RUN: | FileCheck %s -check-prefix macho-pa 39RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \ 40RUN: | FileCheck %s -check-prefix macho-u 41RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \ 42RUN: | FileCheck %s -check-prefix COFF-COMMON 43RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \ 44RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64 45RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \ 46RUN: | FileCheck %s -check-prefix ELF-THUMB 47RUN: mkdir -p %t 48RUN: cd %t 49RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out 50RUN: llvm-nm | FileCheck %s -check-prefix A-OUT 51 52 53COFF32: 00000000 d .data 54COFF32-NEXT: 00000000 t .text 55COFF32-NEXT: 00000000 d L_.str 56COFF32-NEXT: U _SomeOtherFunction 57COFF32-NEXT: 00000000 T _main 58COFF32-NEXT: U _puts 59 60COFF64: 00000000 d .data 61COFF64-NEXT: 00000000 t .text 62COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ 63COFF64-NEXT: 00000000 d L.str 64COFF64-NEXT: U SomeOtherFunction 65COFF64-NEXT: 00000000 T main 66COFF64-NEXT: U puts 67 68COFF-COMMON: 00000000 b .bss 69COFF-COMMON-NEXT: 00000000 d .data 70COFF-COMMON-NEXT: 00000000 d .drectve 71COFF-COMMON-NEXT: 00000000 n .file 72COFF-COMMON-NEXT: 00000000 r .rdata$zzz 73COFF-COMMON-NEXT: 00000000 t .text 74COFF-COMMON-NEXT: C _a 75 76 77ELF-NOT: U 78ELF: U SomeOtherFunction 79ELF: 00000000 T main 80ELF: U puts 81 82FIXME: we should not print the size of undefined symbols. 83ELF-SIZE: 00000000 U SomeOtherFunction 84ELF-SIZE-NEXT: 00000000 00000024 T main 85ELF-SIZE-NEXT: 00000000 U puts 86 87ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction 88ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main 89ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts 90 91ELF-u: U SomeOtherFunction 92ELF-u: U puts 93 94ELF64: U SomeOtherFunction 95ELF64: 0000000000000000 T main 96ELF64: U puts 97 98WEAK-ELF64: w f1 99WEAK-ELF64: 0000000000000000 W f2 100WEAK-ELF64: v x1 101WEAK-ELF64: 0000000000000000 V x2 102 103ABSOLUTE-ELF64: 0000000000000123 a a1 104ABSOLUTE-ELF64: 0000000000000123 A a2 105 106macho: U _SomeOtherFunction 107macho: 00000000 T _main 108macho: U _puts 109 110macho-U-NOT: U _SomeOtherFunction 111macho-U: 00000000 T _main 112macho-U-NOT: U _puts 113 114macho64: 0000000000000028 s L_.str 115macho64: U _SomeOtherFunction 116macho64: 0000000000000000 T _main 117macho64: U _puts 118 119macho-tdb: 0000000000000030 s EH_frame0 120macho-tdb: 0000000000000070 b _b 121macho-tdb: 000000000000000c D _d 122macho-tdb: 0000000000000000 T _t 123macho-tdb: 0000000000000048 S _t.eh 124 125macho-j: EH_frame0 126macho-j: _b 127macho-j: _d 128macho-j: _t 129macho-j: _t.eh 130 131macho-r: 0000000000000048 S _t.eh 132macho-r-NEXT: 0000000000000000 T _t 133macho-r-NEXT: 000000000000000c D _d 134macho-r-NEXT: 0000000000000070 b _b 135macho-r-NEXT: 0000000000000030 s EH_frame0 136 137macho-s: 000000000000000c D _d 138macho-s-NOT: 0000000000000048 S _t.eh 139macho-s-NOT: 0000000000000000 T _t 140macho-s-NOT: 0000000000000070 b _b 141macho-s-NOT: 0000000000000030 s EH_frame0 142 143macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0 144macho-x: 0000000000000070 0e 03 0000 0000000d _b 145macho-x: 000000000000000c 0f 02 0000 00000004 _d 146macho-x: 0000000000000000 0f 01 0000 00000001 _t 147macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh 148 149 150macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0 151macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b 152macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d 153macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t 154macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh 155 156macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/ 157macho-pa: 0000000000000000 - 00 0000 SO hello.c 158macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o 159macho-pa: 0000000100000f30 - 01 0000 BNSYM 160macho-pa: 0000000100000f30 - 01 0000 FUN _main 161macho-pa: 000000000000003b - 00 0000 FUN 162macho-pa: 000000000000003b - 01 0000 ENSYM 163macho-pa: 0000000000000000 - 01 0000 SO 164macho-pa: 0000000100000000 T __mh_execute_header 165macho-pa: 0000000100000f30 T _main 166macho-pa: U _printf 167macho-pa: U dyld_stub_binder 168 169macho-u: _printf 170macho-u: dyld_stub_binder 171 172Test that nm uses addresses even with ELF .o files. 173ELF-SEC-ADDR64: 0000000000000058 D a 174ELF-SEC-ADDR64-NEXT: 000000000000005c D b 175ELF-SEC-ADDR64-NEXT: 0000000000000040 T f 176ELF-SEC-ADDR64-NEXT: 0000000000000050 T g 177ELF-SEC-ADDR64-NEXT: 0000000000000060 D p 178 179 180Test that we drop the thumb bit only from function addresses. 181ELF-THUMB: 00000000 t f 182ELF-THUMB: 00000003 t g 183 184A-OUT: U _SomeOtherFunction 185A-OUT: 00000000 T _main 186A-OUT: U _puts 187