[llvm] [LegacyLTO] Emit the error message that was silently dropped (PR #152172)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 09:31:32 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lto
Author: Steven Wu (cachemeifyoucan)
<details>
<summary>Changes</summary>
Using LLVMContext to emit the error from `TargetRegistry::lookupTarget`
that was silently ignored and not propagated. This allows user to better
identify the kind of error occured.
rdar://157542119
---
Full diff: https://github.com/llvm/llvm-project/pull/152172.diff
1 Files Affected:
- (modified) llvm/lib/LTO/LTOModule.cpp (+3-1)
``````````diff
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index e0a975806a31d..7dd06118e2a57 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -203,8 +203,10 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
// find machine architecture for this module
std::string errMsg;
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
- if (!march)
+ if (!march) {
+ Context.emitError(errMsg);
return make_error_code(object::object_error::arch_not_found);
+ }
// construct LTOModule, hand over ownership of module and target
SubtargetFeatures Features;
``````````
</details>
https://github.com/llvm/llvm-project/pull/152172
More information about the llvm-commits
mailing list