[PATCH] D69418: [llvm-ar] Add output option for extract operation

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 09:48:11 PDT 2019


rupprecht added a comment.

Not really opposed to this patch, but I think ruiu's comment makes sense to think about:

In D69418#1721179 <https://reviews.llvm.org/D69418#1721179>, @ruiu wrote:

> Maybe you should propose this option to GNU first?


+1 to this. It'd be good to broaden the audience to people that have been working with `ar` for longer.

Can you say more about the use case? A possible counter argument for the presented use case would be that if you need to extract your archive to a different directory, you should have just fetched it to the right place to begin with.

> build process with both the llvm-ar tool path and the output file path are relative

Does the path to `llvm-ar` affect the extraction? I think paths are either interpreted relative to cwd or the archive itself, not the tool path (which is commonly `/usr/bin/llvm-ar`)



================
Comment at: llvm/tools/llvm-ar/llvm-ar.cpp:540
+  if (!outputPath.empty())
+    outputFilePath = outputPath + '/' + outputFilePath;
+  failIfError(sys::fs::openFileForWrite(outputFilePath, FD,
----------------
I think `llvm::sys::path::append()` does this more generally (e.g. if `outputFilePath` is `foo/` -> avoids `foo//bar.a`)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69418/new/

https://reviews.llvm.org/D69418





More information about the llvm-commits mailing list