summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-03-31 21:10:53 +0000
committerReid Kleckner <rnk@google.com>2017-03-31 21:10:53 +0000
commitf6e8c4dd29d23305d284fded62bdb519c739fc0f (patch)
tree0843da298d3a328c599cd7d9ee028b0d85f2a1ed /llvm/test
parent0d8801f991bb475fe20044de3fe8d373e937d112 (diff)
downloadbcm5719-llvm-f6e8c4dd29d23305d284fded62bdb519c739fc0f.tar.gz
bcm5719-llvm-f6e8c4dd29d23305d284fded62bdb519c739fc0f.zip
[llvm-ar] Extract objects to their basename in the CWD
This is helpful when extracting objects from archives produced by MSVC's lib.exe, which users absolute paths to describe the archive members. llvm-svn: 299264
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/tools/llvm-ar/Inputs/absolute-paths.lib0
-rw-r--r--llvm/test/tools/llvm-ar/absolute-paths.test20
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-ar/Inputs/absolute-paths.lib b/llvm/test/tools/llvm-ar/Inputs/absolute-paths.lib
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/Inputs/absolute-paths.lib
diff --git a/llvm/test/tools/llvm-ar/absolute-paths.test b/llvm/test/tools/llvm-ar/absolute-paths.test
new file mode 100644
index 00000000000..0b42d7d2dcb
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/absolute-paths.test
@@ -0,0 +1,20 @@
+MSVC's lib.exe produces archives with absolute paths to the members. It's useful
+for llvm-ar to extract them to their basename in the CWD, since usually the
+directories in the path in the archive won't exist during archive extraction.
+
+Get a temp clean cwd to extract into.
+RUN: rm -rf %t && mkdir %t && cd %t
+
+RUN: llvm-ar t %S/Inputs/absolute-paths.lib | FileCheck %s --check-prefix=CHECK-LIST
+CHECK-LIST: C:/src/llvm-project/build/dne/b.o
+CHECK-LIST: C:/src/llvm-project/build/dne/a.o
+
+Check that a.o comes out and defines foo.
+RUN: llvm-ar x %S/Inputs/absolute-paths.lib 'C:/src/llvm-project/build/dne/a.o'
+RUN: llvm-nm a.o | FileCheck %s --check-prefix=CHECK-A
+CHECK-A: T foo
+
+Check that b.o comes out and defines bar.
+RUN: llvm-ar x %S/Inputs/absolute-paths.lib C:/src/llvm-project/build/dne/b.o
+RUN: llvm-nm b.o | FileCheck %s --check-prefix=CHECK-B
+CHECK-B: T bar
OpenPOWER on IntegriCloud