Page MenuHomePhabricator

[Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors
ClosedPublic

Authored by sgraenitz on Thu, Jan 14, 7:37 AM.

Details

Summary

It can be useful for an ObjectLinkingLayerCreator to allow callee errors to get propagated to the builder. Specifically, this is the case when the ObjectLayer uses the EHFrameRegistrationPlugin, because it requires a TPCEHFrameRegistrar and instantiation for it may fail (e.g. if the required registration symbols are missing in the target process).

Diff Detail

Event Timeline

sgraenitz created this revision.Thu, Jan 14, 7:37 AM
sgraenitz requested review of this revision.Thu, Jan 14, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Jan 14, 7:37 AM
lhames added inline comments.Thu, Jan 14, 12:52 PM
llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/LLJITWithCustomObjectLinkingLayer.cpp
48 ↗(On Diff #316658)

Rather than pass an Error by reference here, could you change ObjectLinkingLayerCreator's signature to return an Expected<std::unique_ptr<ObjectLayer>> ?

sgraenitz marked an inline comment as done.Thu, Jan 14, 12:55 PM
sgraenitz added inline comments.
llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/LLJITWithCustomObjectLinkingLayer.cpp
48 ↗(On Diff #316658)

Yes good point. I will make an update.

sgraenitz updated this revision to Diff 316764.Thu, Jan 14, 1:18 PM
sgraenitz marked an inline comment as done.

Drop the Error output parameter and return an Expected instead

sgraenitz retitled this revision from [Orc] Allow errors via output parameter in LLJITBuilder's CreateObjectLinkingLayer to [Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors.Thu, Jan 14, 1:19 PM
lhames accepted this revision.Thu, Jan 14, 1:26 PM

Great. Thanks very much Stefan!

This revision is now accepted and ready to land.Thu, Jan 14, 1:26 PM
This revision was landed with ongoing or failed builds.Fri, Jan 15, 3:54 AM
This revision was automatically updated to reflect the committed changes.