[lld] [LLD][COFF] Initial support for ARM64EC importlibs. (PR #107164)

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 03:40:05 PDT 2024


================
@@ -1019,9 +1020,16 @@ void ImportFile::parse() {
 
   // Read names and create an __imp_ symbol.
   StringRef buf = mb.getBuffer().substr(sizeof(*hdr));
-  StringRef name = saver().save(buf.split('\0').first);
+  StringRef nameBuf = buf.split('\0').first, name;
+  if (isArm64EC(hdr->Machine)) {
+    if (std::optional<std::string> demangledName =
+            getArm64ECDemangledFunctionName(nameBuf))
+      name = saver().save(*demangledName);
+  }
+  if (name.empty())
+    name = saver().save(nameBuf);
   StringRef impName = saver().save("__imp_" + name);
-  buf = buf.substr(name.size() + 1);
+  buf = buf.substr(nameBuf.size() + 1);
----------------
cjacek wrote:

Good point, I changed that. I think that with the additional `split` variable, we no longer need a separate `nameBuf`.

https://github.com/llvm/llvm-project/pull/107164


More information about the llvm-commits mailing list