summaryrefslogtreecommitdiff
path: root/test/Object
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-29 12:40:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-29 12:40:31 +0000
commitcf48cf23de9207e4000df91aadc0beaa0989e33d (patch)
tree422e2b36c02d0c68da9bded48e086b254cc8f060 /test/Object
parentc63dce3c59ac24b2656e06f7017cd4dce4bf733c (diff)
downloadllvm-cf48cf23de9207e4000df91aadc0beaa0989e33d.tar.gz
llvm-cf48cf23de9207e4000df91aadc0beaa0989e33d.tar.bz2
llvm-cf48cf23de9207e4000df91aadc0beaa0989e33d.tar.xz
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
Diffstat (limited to 'test/Object')
-rw-r--r--test/Object/Inputs/archive-test.a-corrupt-symbol-tablebin0 -> 2792 bytes
-rw-r--r--test/Object/archive-symtab.test32
2 files changed, 32 insertions, 0 deletions
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 0000000000..34e5ed799d
--- /dev/null
+++ b/test/Object/Inputs/archive-test.a-corrupt-symbol-table
Binary files differ
diff --git a/test/Object/archive-symtab.test b/test/Object/archive-symtab.test
index 1cf0ce449d..0d2504d256 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