aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFImportFile.cpp
diff options
context:
space:
mode:
authorJacek Caban <jacek@codeweavers.com>2024-11-15 16:14:37 +0100
committerGitHub <noreply@github.com>2024-11-15 16:14:37 +0100
commita9d94834cd91fe93d8723ac4232fe7becdca61a7 (patch)
tree4e48ce5935e8f6cbb01d6d7500338bb1548049cd /llvm/lib/Object/COFFImportFile.cpp
parent0fb8fac5d6c10610574e6e472670823eaff0c949 (diff)
downloadllvm-a9d94834cd91fe93d8723ac4232fe7becdca61a7.zip
llvm-a9d94834cd91fe93d8723ac4232fe7becdca61a7.tar.gz
llvm-a9d94834cd91fe93d8723ac4232fe7becdca61a7.tar.bz2
[llvm-lib][llvm-dlltool] Fix handling of invalid ARM64EC function names (#116250)
This is a follow-up to #115567. Emit an error for invalid function names, similar to MSVC's `lib.exe` behavior. Returning an error from `writeImportLibrary` exposed bugs in error handling by its callers, which have been addressed in this patch.
Diffstat (limited to 'llvm/lib/Object/COFFImportFile.cpp')
-rw-r--r--llvm/lib/Object/COFFImportFile.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp
index cc0a5da..ff3dcf9 100644
--- a/llvm/lib/Object/COFFImportFile.cpp
+++ b/llvm/lib/Object/COFFImportFile.cpp
@@ -756,8 +756,15 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path,
}
Name = std::move(*MangledName);
} else if (!E.Noname && ExportName.empty()) {
+ std::optional<std::string> DemangledName =
+ getArm64ECDemangledFunctionName(Name);
+ if (!DemangledName)
+ return make_error<StringError>(
+ StringRef(Twine("Invalid ARM64EC function name '" + Name + "'")
+ .str()),
+ object_error::parse_failed);
NameType = IMPORT_NAME_EXPORTAS;
- ExportName = std::move(*getArm64ECDemangledFunctionName(Name));
+ ExportName = std::move(*DemangledName);
}
}