[PATCH] D41922: [WebAssembly] When loading libraries look for companion `.imports` file

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 23:13:11 PST 2018


ruiu added inline comments.


================
Comment at: wasm/Driver.cpp:176-185
+  if (identify_magic(MBRef.getBuffer()) == file_magic::archive) {
     Files.push_back(make<ArchiveFile>(MBRef));
-  else
+    SmallString<128> ImportFile = Path;
+    path::replace_extension(ImportFile, ".imports");
+    if (fs::exists(ImportFile))
+      processImportFile(ImportFile.str());
+  } else {
----------------
This looks suspicious --

1. It loads an entire .import file for an .a file, even if we won't end up linking any object file from that archive file. That doesn't make much sense to me. Shouldn't this be per-file?

2. IMO a side-by-side magic text file is in general not a good idea. We don't have such notion in Unix linker, and we get used to copy .a and .o files to other directories expecting that they would just work fine. This seems error-prone.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41922





More information about the llvm-commits mailing list