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