[lldb][ObjectFile] Relocate sections for in-memory objects (e.g. received via JITLoad...
authorStefan Gränitz <stefan.graenitz@gmail.com>
Tue, 10 Nov 2020 10:36:59 +0000 (11:36 +0100)
committerStefan Gränitz <stefan.graenitz@gmail.com>
Tue, 10 Nov 2020 10:37:53 +0000 (11:37 +0100)
commit203b4774b88322de22c99881a3e1e4c78a9d5a0e
treee67bad2b37d6048f5b1582c7877235da22617c64
parenta75d6178b809cf11d54af91e8e1254064d58f6eb
[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
lldb/source/Symbol/ObjectFile.cpp
lldb/test/Shell/Breakpoint/jitbp_elf.test