[PATCH] D81109: llvm-link: Add support for archive files as inputs.

Jan Sjödin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 12:35:23 PDT 2020


jsjodin marked 13 inline comments as done.
jsjodin added inline comments.


================
Comment at: llvm/tools/llvm-link/llvm-link.cpp:14
 
+#include "llvm//Object/Archive.h"
 #include "llvm/ADT/STLExtras.h"
----------------
JonChesterfield wrote:
> Double //, should be llvm/Object
Not sure how that got there. Fixed.


================
Comment at: llvm/tools/llvm-link/llvm-link.cpp:143
 
+static std::unique_ptr<Module> loadArFile(const char *argv0,
+                                          const std::string ArchiveName,
----------------
ABataev wrote:
> `Argv0`. Also, better to use `StringRef`, if possible
StringRef didn't simplify anything, so I kept the type, but fixed the name.


================
Comment at: llvm/tools/llvm-link/llvm-link.cpp:353
+    std::unique_ptr<Module> M =
+      (llvm::sys::path::extension(File) == ".a")
+          ? loadArFile(argv0, File, Context, L, Flags, ApplicableFlags)
----------------
JonChesterfield wrote:
> May be better to read the first few bytes, looking for '!<arch>', instead of going by extension. Don't have strong preferences though.
Maybe, but for now I will keep it as-is.  If we find this to be a problem in the future it can be fixed then.



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

https://reviews.llvm.org/D81109





More information about the llvm-commits mailing list