1RUN: 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
3RUN: llvm-nm -M %t.a | FileCheck %s
4
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:
12CHECK-NEXT:                  U SomeOtherFunction
13CHECK-NEXT: 0000000000000000 T main
14CHECK-NEXT:                  U puts
15
16CHECK: trivial-object-test2.elf-x86-64:
17CHECK-NEXT: 0000000000000000 t bar
18CHECK-NEXT: 0000000000000006 T foo
19CHECK-NEXT: 0000000000000016 T main
20
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
23RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
24
25NOMAP-NOT: Archive map
26
27RUN: llvm-ar s %t.a
28RUN: llvm-nm -M %t.a | FileCheck %s
29
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
33RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
34
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:
41CORRUPT-NEXT:                  U SomeOtherFunction
42CORRUPT-NEXT: 0000000000000000 T main
43CORRUPT-NEXT:                  U puts
44
45CORRUPT: trivial-object-test2.elf-x86-64:
46CORRUPT-NEXT: 0000000000000000 t bar
47CORRUPT-NEXT: 0000000000000006 T foo
48CORRUPT-NEXT: 0000000000000016 T main
49
50check that the we *don't* update the symbol table.
51RUN: llvm-ar s %t.a
52RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
53
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
58RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
59
60RUN: llvm-ranlib %t.a
61RUN: llvm-nm -M %t.a | FileCheck %s
62
63RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
64RUN: llvm-nm -M %p/Inputs/macho-archive-unsorted-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
65
66BSD-MachO: Archive map
67BSD-MachO: _bar in bar.o
68BSD-MachO: _foo in foo.o
69