Skip to content

Commit 0adc814

Browse files
[LegacyLTO] Emit the error message that was silently dropped (llvm#152172)
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 (cherry picked from commit 09146a2)
1 parent 66f2f61 commit 0adc814

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/LTO/LTOModule.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
204204
// find machine architecture for this module
205205
std::string errMsg;
206206
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
207-
if (!march)
207+
if (!march) {
208+
Context.emitError(errMsg);
208209
return make_error_code(object::object_error::arch_not_found);
210+
}
209211

210212
// construct LTOModule, hand over ownership of module and target
211213
SubtargetFeatures Features;

0 commit comments

Comments
 (0)