From a9d94834cd91fe93d8723ac4232fe7becdca61a7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 15 Nov 2024 16:14:37 +0100 Subject: [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. --- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp') diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp index 07389a5..2e0841b 100644 --- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -419,10 +419,15 @@ int llvm::libDriverMain(ArrayRef ArgsArr) { OutputFile = std::move(NativeDef->OutputFile); } - return writeImportLibrary(OutputFile, OutputPath, Def->Exports, LibMachine, - /*MinGW=*/false, NativeExports) - ? 1 - : 0; + if (Error E = + writeImportLibrary(OutputFile, OutputPath, Def->Exports, LibMachine, + /*MinGW=*/false, NativeExports)) { + handleAllErrors(std::move(E), [&](const ErrorInfoBase &EI) { + llvm::errs() << OutputPath << ": " << EI.message() << "\n"; + }); + return 1; + } + return 0; } // If no input files and not told otherwise, silently do nothing to match -- cgit v1.1