This is an archive of the discontinued LLVM Phabricator instance.

[ORC] Fix weak hidden symbols failure on PPC with runtimedyld
ClosedPublic

Authored by sunho on Jul 6 2022, 1:23 AM.

Details

Summary

Fix "JIT session error: Symbols not found: [ DW.ref.__gxx_personality_v0 ] error" which happens when trying to use exceptions on ppc linux. To do this, it expands AutoClaimSymbols option in RTDyldObjectLinkingLayer to also claim weak symbols before they are tried to be resovled. In ppc linux, DW.ref symbols is emitted as weak hidden symbols in the later stage of MC pipeline. This means when using IRLayer (i.e. LLJIT), IRLayer will not claim responsibility for such symbols and RuntimeDyld will skip defining this symbol even though it couldn't resolve corresponding external symbol.

Diff Detail

Event Timeline

sunho created this revision.Jul 6 2022, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2022, 1:23 AM
sunho requested review of this revision.Jul 6 2022, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2022, 1:23 AM
sunho updated this revision to Diff 442464.Jul 6 2022, 1:39 AM
sunho updated this revision to Diff 442488.Jul 6 2022, 2:46 AM
sunho retitled this revision from [ORC] Add AutoClaimWeakHiddenSymbols option in RTDyldObjectLinkingLayer. to [ORC] Fix weak hidden symbols failure in PPC with runtimedyld.
sunho edited the summary of this revision. (Show Details)
sunho retitled this revision from [ORC] Fix weak hidden symbols failure in PPC with runtimedyld to [ORC] Fix weak hidden symbols failure on PPC with runtimedyld.Jul 6 2022, 2:48 AM
sunho edited the summary of this revision. (Show Details)
sunho edited the summary of this revision. (Show Details)Jul 6 2022, 3:04 AM
sunho updated this revision to Diff 442728.Jul 6 2022, 5:13 PM
sunho edited the summary of this revision. (Show Details)

Expand existing option instead.

This LGTM but I'd wait for @lhames.

Thanks for the patch! I think this is the right way forward.

llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
752

What about further conditions like isOSLinux() or isOSBinFormatELF()? The issue seems quite specific and AutoClaimResponsibility should be used with care. Intuitively, it seems we should tightening it to the exact platform as much as we can. It would also reduce the risk of breaking legacy use-cases downstream (which is the majority of RuntimeDyld users I think).

Are there good reasons why we wouldn't?

llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
154

SymbolStringPool::intern() involves a mutex lock and a string-map traversal. Might be worth doing it only once where ever we can.

sunho updated this revision to Diff 445827.Jul 19 2022, 8:05 AM

Address comments.

sunho marked 2 inline comments as done.Jul 19 2022, 8:06 AM
sunho added inline comments.
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
752

thanks for review! Yes, there was no paticular reason for not restricting the target.

sunho marked an inline comment as done.Jul 25 2022, 9:04 AM
sgraenitz accepted this revision.Jul 28 2022, 5:06 AM

Sorry for the delay, LGTM!

This revision is now accepted and ready to land.Jul 28 2022, 5:06 AM
This revision was landed with ongoing or failed builds.Jul 28 2022, 5:13 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2022, 5:13 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript