blob: 01f17bcc8b6124e5ca2f1af63d68268d5ecbb04c [file] [log] [blame]
Rafael Espindolace7f52d2013-07-23 10:47:01 +00001RUN: rm -f %t.a
2RUN: llvm-ar rcs %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
Kevin Enderby8da4bd62014-07-08 23:47:31 +00003RUN: llvm-nm -M %t.a | FileCheck %s
Rafael Espindolace7f52d2013-07-23 10:47:01 +00004
5CHECK: Archive map
6CHECK-NEXT: main in trivial-object-test.elf-x86-64
7CHECK-NEXT: foo in trivial-object-test2.elf-x86-64
8CHECK-NEXT: main in trivial-object-test2.elf-x86-64
9CHECK-NOT: bar
10
11CHECK: trivial-object-test.elf-x86-64:
Kevin Enderby6abc2e52014-05-09 23:57:49 +000012CHECK-NEXT: U SomeOtherFunction
13CHECK-NEXT: 0000000000000000 T main
14CHECK-NEXT: U puts
Kevin Enderby26646102014-06-20 21:29:27 +000015
16CHECK: trivial-object-test2.elf-x86-64:
Kevin Enderby6abc2e52014-05-09 23:57:49 +000017CHECK-NEXT: 0000000000000000 t bar
18CHECK-NEXT: 0000000000000006 T foo
19CHECK-NEXT: 0000000000000016 T main
Rafael Espindolab6b5f52e2013-07-29 12:40:31 +000020
21RUN: rm -f %t.a
22RUN: llvm-ar rcS %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
Kevin Enderby8da4bd62014-07-08 23:47:31 +000023RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
Rafael Espindolab6b5f52e2013-07-29 12:40:31 +000024
25NOMAP-NOT: Archive map
26
27RUN: llvm-ar s %t.a
Kevin Enderby8da4bd62014-07-08 23:47:31 +000028RUN: llvm-nm -M %t.a | FileCheck %s
Rafael Espindolab6b5f52e2013-07-29 12:40:31 +000029
30check that the archive does have a corrupt symbol table.
31RUN: rm -f %t.a
32RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
Kevin Enderby8da4bd62014-07-08 23:47:31 +000033RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
Rafael Espindolab6b5f52e2013-07-29 12:40:31 +000034
35CORRUPT: Archive map
36CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
37CORRUPT-NEXT: foo in trivial-object-test2.elf-x86-64
38CORRUPT-NEXT: main in trivial-object-test2.elf-x86-64
39
40CORRUPT: trivial-object-test.elf-x86-64:
Kevin Enderby6abc2e52014-05-09 23:57:49 +000041CORRUPT-NEXT: U SomeOtherFunction
42CORRUPT-NEXT: 0000000000000000 T main
43CORRUPT-NEXT: U puts
Kevin Enderby26646102014-06-20 21:29:27 +000044
45CORRUPT: trivial-object-test2.elf-x86-64:
Kevin Enderby6abc2e52014-05-09 23:57:49 +000046CORRUPT-NEXT: 0000000000000000 t bar
47CORRUPT-NEXT: 0000000000000006 T foo
48CORRUPT-NEXT: 0000000000000016 T main
Rafael Espindolab6b5f52e2013-07-29 12:40:31 +000049
50check that the we *don't* update the symbol table.
51RUN: llvm-ar s %t.a
Kevin Enderby8da4bd62014-07-08 23:47:31 +000052RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
Rafael Espindola0c8a3522013-08-28 16:22:16 +000053
54repeate the test with llvm-ranlib
55
56RUN: rm -f %t.a
57RUN: llvm-ar rcS %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
Kevin Enderby8da4bd62014-07-08 23:47:31 +000058RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
Rafael Espindola0c8a3522013-08-28 16:22:16 +000059
60RUN: llvm-ranlib %t.a
Kevin Enderby8da4bd62014-07-08 23:47:31 +000061RUN: llvm-nm -M %t.a | FileCheck %s
Kevin Enderby8c50dbb2014-07-08 22:10:02 +000062
Kevin Enderby8da4bd62014-07-08 23:47:31 +000063RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
Nick Kledzikf44dbda2014-11-12 01:37:45 +000064RUN: llvm-nm -M %p/Inputs/macho-archive-unsorted-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
Kevin Enderby8c50dbb2014-07-08 22:10:02 +000065
66BSD-MachO: Archive map
67BSD-MachO: _bar in bar.o
68BSD-MachO: _foo in foo.o