[lld] [LLD][COFF] Generate redirection metadata for custom ARM64EC export thunks. (PR #105901)

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 12:03:56 PDT 2024


================
@@ -2062,6 +2062,20 @@ void Writer::createECChunks() {
     if (auto thunk = dyn_cast<ECExportThunkChunk>(sym->getChunk())) {
       hexpthkSec->addChunk(thunk);
       exportThunks.push_back({thunk, thunk->target});
+    } else if (auto def = dyn_cast<DefinedRegular>(sym)) {
+      // Allow section chunk to be treated as an export thunk if it looks like
+      // one.
+      SectionChunk *chunk = def->getChunk();
+      if (!chunk->live || chunk->getMachine() != AMD64)
+        continue;
+      assert(sym->getName().starts_with("EXP+"));
+      StringRef targetName = sym->getName().substr(strlen("EXP+"));
+      Symbol *targetSym = ctx.symtab.find((targetName + "$hp_target").str());
+      if (!targetSym)
+        targetSym = ctx.symtab.find(targetName);
----------------
cjacek wrote:

Good point, I added a comment and merged. Thanks for reviews!

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


More information about the llvm-commits mailing list