From cf48cf23de9207e4000df91aadc0beaa0989e33d Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 29 Jul 2013 12:40:31 +0000 Subject: 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 --- .../Inputs/archive-test.a-corrupt-symbol-table | Bin 0 -> 2792 bytes test/Object/archive-symtab.test | 32 +++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 test/Object/Inputs/archive-test.a-corrupt-symbol-table (limited to 'test/Object') diff --git a/test/Object/Inputs/archive-test.a-corrupt-symbol-table b/test/Object/Inputs/archive-test.a-corrupt-symbol-table new file mode 100644 index 0000000..34e5ed7 Binary files /dev/null and b/test/Object/Inputs/archive-test.a-corrupt-symbol-table differ diff --git a/test/Object/archive-symtab.test b/test/Object/archive-symtab.test index 1cf0ce4..0d2504d 100644 --- a/test/Object/archive-symtab.test +++ b/test/Object/archive-symtab.test @@ -16,3 +16,35 @@ 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 -- cgit v1.1