Kevin Enderby | 4fc2edb | 2014-06-23 20:27:53 +0000 | [diff] [blame] | 1 | RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm - \ |
Matt Beaumont-Gay | 99fc2e1 | 2012-08-02 21:52:49 +0000 | [diff] [blame] | 2 | RUN: | FileCheck %s -check-prefix COFF |
Kevin Enderby | 4fc2edb | 2014-06-23 20:27:53 +0000 | [diff] [blame] | 3 | RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm - \ |
Rafael Espindola | 3721257 | 2013-04-26 17:54:46 +0000 | [diff] [blame] | 4 | RUN: | FileCheck %s -check-prefix COFF |
Matt Beaumont-Gay | 1c1a2b8 | 2011-10-31 23:56:52 +0000 | [diff] [blame] | 5 | RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \ |
Michael J. Spencer | 2d67ed8 | 2011-01-20 06:39:15 +0000 | [diff] [blame] | 6 | RUN: | FileCheck %s -check-prefix ELF |
Matt Beaumont-Gay | 1c1a2b8 | 2011-10-31 23:56:52 +0000 | [diff] [blame] | 7 | RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \ |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 8 | RUN: | FileCheck %s -check-prefix ELF64 |
Rafael Espindola | f42c58d | 2014-02-04 23:53:15 +0000 | [diff] [blame] | 9 | RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \ |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 10 | RUN: | FileCheck %s -check-prefix WEAK-ELF64 |
Rafael Espindola | 02eac9a | 2014-02-05 04:36:47 +0000 | [diff] [blame] | 11 | RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \ |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 12 | RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64 |
Danil Malyshev | cbe72fc | 2011-11-29 17:40:10 +0000 | [diff] [blame] | 13 | RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \ |
| 14 | RUN: | FileCheck %s -check-prefix macho |
Kevin Enderby | acaaf90 | 2014-07-03 18:18:50 +0000 | [diff] [blame] | 15 | RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \ |
| 16 | RUN: | FileCheck %s -check-prefix macho-U |
Danil Malyshev | cbe72fc | 2011-11-29 17:40:10 +0000 | [diff] [blame] | 17 | RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \ |
| 18 | RUN: | FileCheck %s -check-prefix macho64 |
Kevin Enderby | 1e1b992 | 2014-06-19 22:49:21 +0000 | [diff] [blame] | 19 | RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \ |
| 20 | RUN: | FileCheck %s -check-prefix macho-tdb |
Kevin Enderby | 0fd8aac | 2014-07-03 21:51:07 +0000 | [diff] [blame] | 21 | RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \ |
| 22 | RUN: | FileCheck %s -check-prefix macho-j |
Kevin Enderby | 25a614b | 2014-07-02 23:23:58 +0000 | [diff] [blame] | 23 | RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \ |
| 24 | RUN: | FileCheck %s -check-prefix macho-r |
Kevin Enderby | fe6ad97 | 2014-07-11 20:30:00 +0000 | [diff] [blame] | 25 | RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \ |
| 26 | RUN: | FileCheck %s -check-prefix macho-s |
Kevin Enderby | 77b968e | 2014-07-16 17:38:26 +0000 | [diff] [blame] | 27 | RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \ |
| 28 | RUN: | FileCheck %s -check-prefix macho-x |
Kevin Enderby | 407cc21 | 2014-07-17 22:47:16 +0000 | [diff] [blame^] | 29 | RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \ |
| 30 | RUN: | FileCheck %s -check-prefix macho-pa |
Rafael Espindola | fb66ef0 | 2014-02-04 23:18:52 +0000 | [diff] [blame] | 31 | RUN: llvm-nm %p/Inputs/common.coff-i386 \ |
| 32 | RUN: | FileCheck %s -check-prefix COFF-COMMON |
Rafael Espindola | b4865d6 | 2014-04-03 00:19:35 +0000 | [diff] [blame] | 33 | RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \ |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 34 | RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64 |
Rafael Espindola | 5091f93 | 2014-04-03 02:20:43 +0000 | [diff] [blame] | 35 | RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \ |
| 36 | RUN: | FileCheck %s -check-prefix ELF-THUMB |
Kevin Enderby | 4fc2edb | 2014-06-23 20:27:53 +0000 | [diff] [blame] | 37 | RUN: mkdir -p %t |
| 38 | RUN: cd %t |
| 39 | RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out |
| 40 | RUN: llvm-nm | FileCheck %s -check-prefix A-OUT |
NAKAMURA Takumi | 0c2a080 | 2014-06-23 21:07:04 +0000 | [diff] [blame] | 41 | REQUIRES: shell |
Rafael Espindola | 5091f93 | 2014-04-03 02:20:43 +0000 | [diff] [blame] | 42 | |
Michael J. Spencer | 2d67ed8 | 2011-01-20 06:39:15 +0000 | [diff] [blame] | 43 | |
| 44 | COFF: 00000000 d .data |
| 45 | COFF: 00000000 t .text |
| 46 | COFF: 00000000 d L{{_?}}.str |
| 47 | COFF: U {{_?}}SomeOtherFunction |
| 48 | COFF: 00000000 T {{_?}}main |
| 49 | COFF: U {{_?}}puts |
| 50 | |
Rafael Espindola | fb66ef0 | 2014-02-04 23:18:52 +0000 | [diff] [blame] | 51 | COFF-COMMON: 00000000 b .bss |
| 52 | COFF-COMMON-NEXT: 00000000 d .data |
| 53 | COFF-COMMON-NEXT: 00000000 d .drectve |
| 54 | COFF-COMMON-NEXT: 00000000 n .file |
| 55 | COFF-COMMON-NEXT: 00000000 r .rdata$zzz |
| 56 | COFF-COMMON-NEXT: 00000000 t .text |
| 57 | COFF-COMMON-NEXT: C _a |
| 58 | |
| 59 | |
Rafael Espindola | 0d6b347 | 2013-07-22 19:24:34 +0000 | [diff] [blame] | 60 | ELF-NOT: U |
Michael J. Spencer | 2d67ed8 | 2011-01-20 06:39:15 +0000 | [diff] [blame] | 61 | ELF: U SomeOtherFunction |
| 62 | ELF: 00000000 T main |
| 63 | ELF: U puts |
Danil Malyshev | cbe72fc | 2011-11-29 17:40:10 +0000 | [diff] [blame] | 64 | |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 65 | ELF64: U SomeOtherFunction |
| 66 | ELF64: 0000000000000000 T main |
| 67 | ELF64: U puts |
Danil Malyshev | cbe72fc | 2011-11-29 17:40:10 +0000 | [diff] [blame] | 68 | |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 69 | WEAK-ELF64: w f1 |
| 70 | WEAK-ELF64: 0000000000000000 W f2 |
| 71 | WEAK-ELF64: v x1 |
| 72 | WEAK-ELF64: 0000000000000000 V x2 |
| 73 | |
| 74 | ABSOLUTE-ELF64: 0000000000000123 a a1 |
| 75 | ABSOLUTE-ELF64: 0000000000000123 A a2 |
Rafael Espindola | 02eac9a | 2014-02-05 04:36:47 +0000 | [diff] [blame] | 76 | |
Kevin Enderby | 1b985af | 2014-05-20 23:04:47 +0000 | [diff] [blame] | 77 | macho: U _SomeOtherFunction |
Rafael Espindola | a135632 | 2013-11-02 05:03:24 +0000 | [diff] [blame] | 78 | macho: 00000000 T _main |
Kevin Enderby | 1b985af | 2014-05-20 23:04:47 +0000 | [diff] [blame] | 79 | macho: U _puts |
Danil Malyshev | cbe72fc | 2011-11-29 17:40:10 +0000 | [diff] [blame] | 80 | |
Kevin Enderby | acaaf90 | 2014-07-03 18:18:50 +0000 | [diff] [blame] | 81 | macho-U-NOT: U _SomeOtherFunction |
| 82 | macho-U: 00000000 T _main |
| 83 | macho-U-NOT: U _puts |
| 84 | |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 85 | macho64: 0000000000000028 s L_.str |
Kevin Enderby | 1b985af | 2014-05-20 23:04:47 +0000 | [diff] [blame] | 86 | macho64: U _SomeOtherFunction |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 87 | macho64: 0000000000000000 T _main |
Kevin Enderby | 1b985af | 2014-05-20 23:04:47 +0000 | [diff] [blame] | 88 | macho64: U _puts |
Rafael Espindola | b4865d6 | 2014-04-03 00:19:35 +0000 | [diff] [blame] | 89 | |
Kevin Enderby | 1e1b992 | 2014-06-19 22:49:21 +0000 | [diff] [blame] | 90 | macho-tdb: 0000000000000030 s EH_frame0 |
| 91 | macho-tdb: 0000000000000070 b _b |
| 92 | macho-tdb: 000000000000000c D _d |
| 93 | macho-tdb: 0000000000000000 T _t |
| 94 | macho-tdb: 0000000000000048 S _t.eh |
Rafael Espindola | b4865d6 | 2014-04-03 00:19:35 +0000 | [diff] [blame] | 95 | |
Kevin Enderby | 0fd8aac | 2014-07-03 21:51:07 +0000 | [diff] [blame] | 96 | macho-j: EH_frame0 |
| 97 | macho-j: _b |
| 98 | macho-j: _d |
| 99 | macho-j: _t |
| 100 | macho-j: _t.eh |
| 101 | |
Kevin Enderby | 25a614b | 2014-07-02 23:23:58 +0000 | [diff] [blame] | 102 | macho-r: 0000000000000048 S _t.eh |
| 103 | macho-r-NEXT: 0000000000000000 T _t |
| 104 | macho-r-NEXT: 000000000000000c D _d |
| 105 | macho-r-NEXT: 0000000000000070 b _b |
| 106 | macho-r-NEXT: 0000000000000030 s EH_frame0 |
| 107 | |
Kevin Enderby | fe6ad97 | 2014-07-11 20:30:00 +0000 | [diff] [blame] | 108 | macho-s: 000000000000000c D _d |
| 109 | macho-s-NOT: 0000000000000048 S _t.eh |
| 110 | macho-s-NOT: 0000000000000000 T _t |
| 111 | macho-s-NOT: 0000000000000070 b _b |
| 112 | macho-s-NOT: 0000000000000030 s EH_frame0 |
| 113 | |
Kevin Enderby | 77b968e | 2014-07-16 17:38:26 +0000 | [diff] [blame] | 114 | macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0 |
| 115 | macho-x: 0000000000000070 0e 03 0000 0000000d _b |
| 116 | macho-x: 000000000000000c 0f 02 0000 00000004 _d |
| 117 | macho-x: 0000000000000000 0f 01 0000 00000001 _t |
| 118 | macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh |
| 119 | |
Kevin Enderby | 407cc21 | 2014-07-17 22:47:16 +0000 | [diff] [blame^] | 120 | macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/ |
| 121 | macho-pa: 0000000000000000 - 00 0000 SO hello.c |
| 122 | macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o |
| 123 | macho-pa: 0000000100000f30 - 01 0000 BNSYM |
| 124 | macho-pa: 0000000100000f30 - 01 0000 FUN _main |
| 125 | macho-pa: 000000000000003b - 00 0000 FUN |
| 126 | macho-pa: 000000000000003b - 01 0000 ENSYM |
| 127 | macho-pa: 0000000000000000 - 01 0000 SO |
| 128 | macho-pa: 0000000100000000 T __mh_execute_header |
| 129 | macho-pa: 0000000100000f30 T _main |
| 130 | macho-pa: U _printf |
| 131 | macho-pa: U dyld_stub_binder |
| 132 | |
Rafael Espindola | b4865d6 | 2014-04-03 00:19:35 +0000 | [diff] [blame] | 133 | Test that nm uses addresses even with ELF .o files. |
Kevin Enderby | 6abc2e5 | 2014-05-09 23:57:49 +0000 | [diff] [blame] | 134 | ELF-SEC-ADDR64: 0000000000000058 D a |
| 135 | ELF-SEC-ADDR64-NEXT: 000000000000005c D b |
| 136 | ELF-SEC-ADDR64-NEXT: 0000000000000040 T f |
| 137 | ELF-SEC-ADDR64-NEXT: 0000000000000050 T g |
| 138 | ELF-SEC-ADDR64-NEXT: 0000000000000060 D p |
Rafael Espindola | 5091f93 | 2014-04-03 02:20:43 +0000 | [diff] [blame] | 139 | |
| 140 | |
| 141 | Test that we drop the thumb bit only from function addresses. |
| 142 | ELF-THUMB: 00000000 t f |
| 143 | ELF-THUMB: 00000003 t g |
Kevin Enderby | 4fc2edb | 2014-06-23 20:27:53 +0000 | [diff] [blame] | 144 | |
| 145 | A-OUT: U _SomeOtherFunction |
| 146 | A-OUT: 00000000 T _main |
| 147 | A-OUT: U _puts |