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
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
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
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
22 CHECK: trivial-object-test.elf-x86-64:
23 CHECK-NEXT: U SomeOtherFunction
24 CHECK-NEXT: 0000000000000000 T main
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
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
36 NOMAP-NOT: Archive map
39 RUN: llvm-nm -M %t.a | FileCheck %s
41 check that the archive does have a corrupt symbol table.
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
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
51 CORRUPT: trivial-object-test.elf-x86-64:
52 CORRUPT-NEXT: U SomeOtherFunction
53 CORRUPT-NEXT: 0000000000000000 T main
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
61 check that the we *don't* update the symbol table.
63 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
65 repeate the test with llvm-ranlib
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
72 RUN: llvm-nm -M %t.a | FileCheck %s
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
77 BSD-MachO: Archive map
78 BSD-MachO: _bar in bar.o
79 BSD-MachO: _foo in foo.o
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
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
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
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
102 RUN: llvm-nm -M %p/Inputs/macho-toc64-archive-x86_64.a | FileCheck --check-prefix=MACHO-TOC64 %s
104 MACHO-TOC64: Archive map
105 MACHO-TOC64-NEXT: _test in test.o
106 MACHO-TOC64-NEXT: _test in xtest.o
109 RUN: llvm-ar --format=gnu rcsU %t.a %p/Inputs/coff-short-import-code %p/Inputs/coff-short-import-data
110 RUN: llvm-nm -M %t.a | FileCheck --check-prefix=COFF-SHORT-IMPORT %s
112 COFF-SHORT-IMPORT: Archive map
113 COFF-SHORT-IMPORT-NEXT: __imp__foo in coff-short-import-code
114 COFF-SHORT-IMPORT-NEXT: _foo in coff-short-import-code
115 COFF-SHORT-IMPORT-NEXT: __imp__bar in coff-short-import-data
116 COFF-SHORT-IMPORT-NOT: _bar in coff-short-import-data
118 Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
121 RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64
122 RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
123 MACHO-SYMTAB-ALIGN: !<arch>
124 MACHO-SYMTAB-ALIGN-NEXT: #1/12 {{..........}} 0 0 0 36 `
126 Test that we pad the symbol table so that it ends in a multiple of 8 bytes:
129 RUN: llvm-ar --format=bsd rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64 %p/Inputs/trivial-object-test.macho-x86-64
130 RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN2 %s < %t.a
131 MACHO-SYMTAB-ALIGN2: !<arch>
132 MACHO-SYMTAB-ALIGN2-NEXT: #1/12 0 0 0 0 52 `
134 With a gnu symbol table we only align to two
137 RUN: llvm-ar --format=gnu rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64
138 RUN: FileCheck --check-prefix=GNU-SYMTAB-ALIGN %s < %t.a
139 GNU-SYMTAB-ALIGN: !<arch>
140 GNU-SYMTAB-ALIGN-NEXT: / 0 0 0 0 14 `