aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFImportFile.cpp
diff options
context:
space:
mode:
authorJacek Caban <jacek@codeweavers.com>2024-02-10 12:46:42 +0100
committerGitHub <noreply@github.com>2024-02-10 12:46:42 +0100
commit33c6b77d2a18862fb5b16160ef9d600382e93f19 (patch)
treee281fdfc5e361caf9bb11411311b6df447703580 /llvm/lib/Object/COFFImportFile.cpp
parent8884ba43a8485bebef5c4d41e7ed457e3fa84f07 (diff)
downloadllvm-33c6b77d2a18862fb5b16160ef9d600382e93f19.zip
llvm-33c6b77d2a18862fb5b16160ef9d600382e93f19.tar.gz
llvm-33c6b77d2a18862fb5b16160ef9d600382e93f19.tar.bz2
[llvm-lib][Object] Add support for EC importlib symbols. (#81059)
ARM64EC import libraries expose two additional symbols: mangled thunk symbol (like `#func`) and auxiliary import symbol (like`__imp_aux_func`). The main functional change with this patch is that those symbols are properly added to static library ECSYMBOLS.
Diffstat (limited to 'llvm/lib/Object/COFFImportFile.cpp')
-rw-r--r--llvm/lib/Object/COFFImportFile.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp
index 51e6274..a3e5e78 100644
--- a/llvm/lib/Object/COFFImportFile.cpp
+++ b/llvm/lib/Object/COFFImportFile.cpp
@@ -684,6 +684,21 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path,
NameType = getNameType(SymbolName, E.Name, Machine, MinGW);
}
+ // On ARM64EC, use EXPORTAS to import demangled name for mangled symbols.
+ if (ImportType == IMPORT_CODE && isArm64EC(Machine)) {
+ if (std::optional<std::string> MangledName =
+ getArm64ECMangledFunctionName(Name)) {
+ if (ExportName.empty()) {
+ NameType = IMPORT_NAME_EXPORTAS;
+ ExportName.swap(Name);
+ }
+ Name = std::move(*MangledName);
+ } else if (ExportName.empty()) {
+ NameType = IMPORT_NAME_EXPORTAS;
+ ExportName = std::move(*getArm64ECDemangledFunctionName(Name));
+ }
+ }
+
Members.push_back(OF.createShortImport(Name, E.Ordinal, ImportType,
NameType, ExportName, Machine));
}