ReleaseNotes: drop in-progress warning and svn checkout note
[oota-llvm.git] / test / Object / archive-symtab.test
1 RUN: rm -f %t.a
2 RUN: llvm-ar rcsU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
3 RUN: llvm-nm -M %t.a | FileCheck %s
4
5 CHECK: Archive map
6 CHECK-NEXT: main in trivial-object-test.elf-x86-64
7 CHECK-NEXT: foo in trivial-object-test2.elf-x86-64
8 CHECK-NEXT: main in trivial-object-test2.elf-x86-64
9 CHECK-NOT: bar
10
11
12 RUN: rm -f %t.a
13 RUN: llvm-ar --format=gnu rcT %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
14 RUN: llvm-nm -M %t.a | FileCheck --check-prefix=THIN %s
15
16 THIN: Archive map
17 THIN-NEXT: main in {{.*}}/Inputs/trivial-object-test.elf-x86-64
18 THIN-NEXT: foo in {{.*}}/Inputs/trivial-object-test2.elf-x86-64
19 THIN-NEXT: main in {{.*}}/Inputs/trivial-object-test2.elf-x86-64
20
21
22 CHECK: trivial-object-test.elf-x86-64:
23 CHECK-NEXT:                  U SomeOtherFunction
24 CHECK-NEXT: 0000000000000000 T main
25 CHECK-NEXT:                  U puts
26
27 CHECK: trivial-object-test2.elf-x86-64:
28 CHECK-NEXT: 0000000000000000 t bar
29 CHECK-NEXT: 0000000000000006 T foo
30 CHECK-NEXT: 0000000000000016 T main
31
32 RUN: rm -f %t.a
33 RUN: llvm-ar rcSU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
34 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
35
36 NOMAP-NOT: Archive map
37
38 RUN: llvm-ar s %t.a
39 RUN: llvm-nm -M %t.a | FileCheck %s
40
41 check that the archive does have a corrupt symbol table.
42 RUN: rm -f %t.a
43 RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
44 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
45
46 CORRUPT: Archive map
47 CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
48 CORRUPT-NEXT: foo in trivial-object-test2.elf-x86-64
49 CORRUPT-NEXT: main in trivial-object-test2.elf-x86-64
50
51 CORRUPT: trivial-object-test.elf-x86-64:
52 CORRUPT-NEXT:                  U SomeOtherFunction
53 CORRUPT-NEXT: 0000000000000000 T main
54 CORRUPT-NEXT:                  U puts
55
56 CORRUPT: trivial-object-test2.elf-x86-64:
57 CORRUPT-NEXT: 0000000000000000 t bar
58 CORRUPT-NEXT: 0000000000000006 T foo
59 CORRUPT-NEXT: 0000000000000016 T main
60
61 check that the we *don't* update the symbol table.
62 RUN: llvm-ar s %t.a
63 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
64
65 repeate the test with llvm-ranlib
66
67 RUN: rm -f %t.a
68 RUN: llvm-ar rcSU %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
69 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
70
71 RUN: llvm-ranlib %t.a
72 RUN: llvm-nm -M %t.a | FileCheck %s
73
74 RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
75 RUN: llvm-nm -M %p/Inputs/macho-archive-unsorted-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
76
77 BSD-MachO: Archive map
78 BSD-MachO: _bar in bar.o
79 BSD-MachO: _foo in foo.o
80
81 RUN: rm -f %t.a
82 RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test2.macho-x86-64
83 RUN: llvm-nm -M %t.a | FileCheck --check-prefix=MACHO %s
84
85 MACHO: Archive map
86 MACHO-NEXT: _main in trivial-object-test.macho-x86-64
87 MACHO-NEXT: _foo in trivial-object-test2.macho-x86-64
88 MACHO-NEXT: _main in trivial-object-test2.macho-x86-64
89 MACHO-NOT: {{^}}bar
90
91 MACHO: trivial-object-test.macho-x86-64
92 MACHO-NEXT: 0000000000000028 s L_.str
93 MACHO-NEXT:                  U _SomeOtherFunction
94 MACHO-NEXT: 0000000000000000 T _main
95 MACHO-NEXT:                  U _puts
96
97 MACHO: trivial-object-test2.macho-x86-64
98 MACHO-NEXT: 0000000000000000 t _bar
99 MACHO-NEXT: 0000000000000001 T _foo
100 MACHO-NEXT: 0000000000000002 T _main
101
102 RUN: rm -f %t.a
103 RUN: llvm-ar --format=gnu rcsU %t.a %p/Inputs/coff-short-import-code %p/Inputs/coff-short-import-data
104 RUN: llvm-nm -M %t.a | FileCheck --check-prefix=COFF-SHORT-IMPORT %s
105
106 COFF-SHORT-IMPORT:      Archive map
107 COFF-SHORT-IMPORT-NEXT: __imp__foo in coff-short-import-code
108 COFF-SHORT-IMPORT-NEXT: _foo in coff-short-import-code
109 COFF-SHORT-IMPORT-NEXT: __imp__bar in coff-short-import-data
110 COFF-SHORT-IMPORT-NOT:  _bar in coff-short-import-data
111
112 Test that we pad the symbol table so that it ends in a multiple of 4 bytes:
113 8 + 60 + 36 == 104
114 RUN: rm -f %t.a
115 RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64
116 RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
117 MACHO-SYMTAB-ALIGN: !<arch>
118 MACHO-SYMTAB-ALIGN-NEXT: #1/12           {{..........}}  0     0     0       36        `