llvm-6502/test/Object/archive-symtab.test
Rafael Espindola cf48cf23de Add support for the 's' operation to llvm-ar.
If no other operation is specified, 's' becomes an operation instead of an
modifier. The s operation just creates a symbol table. It is the same as
running ranlib.

We assume the archive was created by a sane ar (like llvm-ar or gnu ar) and
if the symbol table is present, then it is current. We use that to optimize
the most common case: a broken build system that thinks it has to run ranlib.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187353 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-29 12:40:31 +00:00

51 lines
1.6 KiB
Plaintext

RUN: rm -f %t.a
RUN: llvm-ar rcs %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
RUN: llvm-nm -s %t.a | FileCheck %s
CHECK: Archive map
CHECK-NEXT: main in trivial-object-test.elf-x86-64
CHECK-NEXT: foo in trivial-object-test2.elf-x86-64
CHECK-NEXT: main in trivial-object-test2.elf-x86-64
CHECK-NOT: bar
CHECK: trivial-object-test.elf-x86-64:
CHECK-NEXT: U SomeOtherFunction
CHECK-NEXT: 00000000 T main
CHECK-NEXT: U puts
CHECK-NEXT: trivial-object-test2.elf-x86-64:
CHECK-NEXT: 00000000 t bar
CHECK-NEXT: 00000006 T foo
CHECK-NEXT: 00000016 T main
RUN: rm -f %t.a
RUN: llvm-ar rcS %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=NOMAP
NOMAP-NOT: Archive map
RUN: llvm-ar s %t.a
RUN: llvm-nm -s %t.a | FileCheck %s
check that the archive does have a corrupt symbol table.
RUN: rm -f %t.a
RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=CORRUPT
CORRUPT: Archive map
CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
CORRUPT-NEXT: foo in trivial-object-test2.elf-x86-64
CORRUPT-NEXT: main in trivial-object-test2.elf-x86-64
CORRUPT: trivial-object-test.elf-x86-64:
CORRUPT-NEXT: U SomeOtherFunction
CORRUPT-NEXT: 00000000 T main
CORRUPT-NEXT: U puts
CORRUPT-NEXT: trivial-object-test2.elf-x86-64:
CORRUPT-NEXT: 00000000 t bar
CORRUPT-NEXT: 00000006 T foo
CORRUPT-NEXT: 00000016 T main
check that the we *don't* update the symbol table.
RUN: llvm-ar s %t.a
RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=CORRUPT