David Majnemer | a271590 | 2014-10-31 05:07:00 +0000 | [diff] [blame] | 1 | RUN: llvm-nm -a %p/Inputs/archive-test.a-coff-i386 \ |
Michael J. Spencer | 9142ae2 | 2011-09-27 19:37:18 +0000 | [diff] [blame] | 2 | RUN: | FileCheck %s -check-prefix COFF |
Rafael Espindola | 09a7f60 | 2013-07-03 15:57:14 +0000 | [diff] [blame] | 3 | |
Michael J. Spencer | 9142ae2 | 2011-09-27 19:37:18 +0000 | [diff] [blame] | 4 | COFF: trivial-object-test.coff-i386: |
| 5 | COFF-NEXT: 00000000 d .data |
| 6 | COFF-NEXT: 00000000 t .text |
| 7 | COFF-NEXT: 00000000 d L_.str |
| 8 | COFF-NEXT: U _SomeOtherFunction |
| 9 | COFF-NEXT: 00000000 T _main |
| 10 | COFF-NEXT: U _puts |
| 11 | |
David Majnemer | a271590 | 2014-10-31 05:07:00 +0000 | [diff] [blame] | 12 | RUN: llvm-nm -a -o %p/Inputs/archive-test.a-coff-i386 \ |
Kevin Enderby | fb0326c | 2014-07-24 23:31:52 +0000 | [diff] [blame] | 13 | RUN: | FileCheck %s -check-prefix COFF-o |
| 14 | |
| 15 | COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 d .data |
| 16 | COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 t .text |
| 17 | COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 d L_.str |
| 18 | COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: U _SomeOtherFunction |
| 19 | COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 T _main |
| 20 | COFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: U _puts |
Rafael Espindola | 5159718 | 2013-07-10 20:14:22 +0000 | [diff] [blame] | 21 | |
| 22 | RUN: llvm-as %p/Inputs/trivial.ll -o=%t1 |
| 23 | RUN: rm -f %t2 |
| 24 | RUN: llvm-ar rcs %t2 %t1 |
| 25 | RUN: llvm-nm %t2 | FileCheck %s -check-prefix BITCODE |
| 26 | |
Peter Collingbourne | 1d815ca | 2015-06-09 21:50:22 +0000 | [diff] [blame] | 27 | RUN: rm -f %t2 |
| 28 | RUN: llvm-lib /out:%t2 %t1 |
| 29 | RUN: llvm-nm %t2 | FileCheck %s -check-prefix BITCODE |
| 30 | |
| 31 | RUN: rm -f %t2 |
| 32 | RUN: echo /out:%t2 %t1 > %t.rsp |
| 33 | RUN: llvm-lib @%t.rsp |
| 34 | RUN: llvm-nm %t2 | FileCheck %s -check-prefix BITCODE |
| 35 | |
Michael J. Spencer | 9142ae2 | 2011-09-27 19:37:18 +0000 | [diff] [blame] | 36 | BITCODE: U SomeOtherFunction |
| 37 | BITCODE-NEXT: T main |
| 38 | BITCODE-NEXT: U puts |
Rafael Espindola | ada0f6a | 2014-07-04 15:03:17 +0000 | [diff] [blame] | 39 | BITCODE-NEXT: D var |
Rafael Espindola | 5159718 | 2013-07-10 20:14:22 +0000 | [diff] [blame] | 40 | |
| 41 | |
| 42 | Test we don't error with an archive with no symtab. |
| 43 | RUN: llvm-nm %p/Inputs/archive-test.a-gnu-no-symtab |
| 44 | |
| 45 | |
| 46 | Or in an archive with no symtab or string table. |
| 47 | RUN: llvm-nm %p/Inputs/archive-test.a-gnu-minimal |
| 48 | |
| 49 | |
Alp Toker | 087ab61 | 2013-12-05 05:44:44 +0000 | [diff] [blame] | 50 | And don't crash when asked to print a non-existing symtab. |
Kevin Enderby | e3108d3 | 2014-07-08 23:47:31 +0000 | [diff] [blame] | 51 | RUN: llvm-nm -M %p/Inputs/archive-test.a-gnu-minimal |
Rafael Espindola | 5e102c6 | 2013-07-12 13:32:28 +0000 | [diff] [blame] | 52 | |
| 53 | Don't reject an empty archive. |
| 54 | RUN: llvm-nm %p/Inputs/archive-test.a-empty |
Rafael Espindola | 7f2f94f | 2014-06-16 16:41:00 +0000 | [diff] [blame] | 55 | |
| 56 | This archive has an unaligned member and a unknown format member. |
| 57 | GNU AR is able to parse the unaligned member and warns about the member with |
Kevin Enderby | 77be094 | 2016-05-17 17:10:12 +0000 | [diff] [blame] | 58 | the unknown format. We should probably simply warn on both. For now we just |
| 59 | produce an error for the unknown format. |
| 60 | RUN: not llvm-nm %p/Inputs/corrupt-archive.a 2>&1 | FileCheck %s -check-prefix CORRUPT |
Rafael Espindola | e2d20cb | 2017-10-10 20:00:07 +0000 | [diff] [blame] | 61 | CORRUPT: corrupt-archive.a(trivial-object-test2.elf-x86-64) Insufficient alignment |
Rafael Espindola | bd58d4e | 2015-07-22 18:29:39 +0000 | [diff] [blame] | 62 | |
| 63 | |
| 64 | RUN: llvm-nm %p/Inputs/thin.a | FileCheck %s -check-prefix THIN |
| 65 | |
| 66 | THIN: IsNAN.o: |
| 67 | THIN: 00000014 T _ZN4llvm5IsNANEd |
| 68 | THIN: 00000000 T _ZN4llvm5IsNANEf |
| 69 | THIN: U __isnan |
| 70 | THIN: U __isnanf |