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

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 01:40:59 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))
----------------
mstorsjo wrote:

Unrelated to this patch, but I took the time to read the `getArm64ECDemangledFunctionName` and `getArm64ECMangledFunctionName` implementations. I think both of them would benefit of some code comments explaining what the actual cases handled are, and what the code really does.

Plus, within `getArm64ECMangledFunctionName`, the `Prefix` variable feels misnamed to me, as this doesn't appear at the start of a string, but is injected in the middle of a string. 

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


More information about the llvm-commits mailing list