This is an archive of the discontinued LLVM Phabricator instance.

Missing Dyld error handling
ClosedPublic

Authored by keder on Mar 10 2020, 5:36 AM.

Details

Summary

We are using code generation in our module and have encountered the following problem. There is missing error handling in MCJIT::finalizeLoadedModules in lib/ExecutionEngine/MCJIT/MCJIT.cpp. It calls resolveRelocations of dynamic linker which tries to find missing symbols, in case if symbol is missing in both loaded libraries and in executable, dynamic linker sets error, but MCJIT does not handles it in any way and puts nullptr. It leads to jump on zero address further in program execution.
The fix is quite tiny. I have just added error handling like in other functions of MCJIT. I have no commit access to repository by the way.

Diff Detail

Event Timeline

keder created this revision.Mar 10 2020, 5:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2020, 5:36 AM
keder updated this revision to Diff 249342.Mar 10 2020, 5:56 AM

added more context

lhames accepted this revision.Mar 13 2020, 9:16 AM

Thanks Keder!

This looks good to me. I’m just running the regression tests now.

This revision is now accepted and ready to land.Mar 13 2020, 9:16 AM
This revision was automatically updated to reflect the committed changes.