[lldb][ObjectFile] Relocate sections for in-memory objects (e.g. received via…

Authored by sgraenitz on Nov 10 2020, 2:36 AM.


[lldb][ObjectFile] Relocate sections for in-memory objects (e.g. received via JITLoaderGDB)

Part 2 of a fix for JITed code debugging. This has been a regression from 5.0 to 6.0 and it's still reproducible on current master: https://bugs.llvm.org/show_bug.cgi?id=36209 Part 1 was D61611 a while ago.

The in-memory object files we obtain from JITLoaderGDB are not yet relocated. It looks like this used to happen on the LLDB side and my guess is that it broke with D38142. (However, it's hard to tell because the whole thing was broken already due to the bug in part 1.) The patch moved relocation resolution to a later point in time and didn't apply it to in-memory objects. I am not aware of any reason why we wouldn't resolve relocations per-se, so I made it unconditional here. On Debian, it fixes the bug for me and all tests in check-lldb are still fine.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D90769